aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author(no author) <(no author)@138bc75d-0d04-0410-961f-82ee72b054a4>2003-11-25 02:13:48 +0000
committer(no author) <(no author)@138bc75d-0d04-0410-961f-82ee72b054a4>2003-11-25 02:13:48 +0000
commit0dcd53ac9bc4fd6d0a8fa9ca348167e1693f8d82 (patch)
tree0c24fc8b97898b56430f11dcd204624dc1793b8d
parent385c47995497acd921b981971699c0a0629015ec (diff)
This commit was manufactured by cvs2svn to create branch
'tree-ssa-20020619-branch'. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/tree-ssa-20020619-branch@73908 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ada/35soccon.ads158
-rw-r--r--gcc/ada/45intnam.ads136
-rw-r--r--gcc/ada/55osinte.adb108
-rw-r--r--gcc/ada/55osinte.ads630
-rw-r--r--gcc/ada/56system.ads150
-rw-r--r--gcc/ada/5nsystem.ads150
-rw-r--r--gcc/ada/5zintman.ads123
-rw-r--r--gcc/config/mips/irix6-crti.asm33
-rw-r--r--gcc/config/mips/irix6-crtn.asm27
-rw-r--r--gcc/config/mips/t-iris6gld9
-rw-r--r--gcc/config/t-slibgcc-darwin30
-rw-r--r--gcc/libgcc-darwin.ver213
-rw-r--r--gcc/testsuite/g++.dg/ext/cond1.C4
-rw-r--r--gcc/testsuite/g++.dg/init/cleanup1.C16
-rw-r--r--gcc/testsuite/g++.dg/init/cleanup2.C19
-rw-r--r--gcc/testsuite/g++.dg/init/placement1.C10
-rw-r--r--gcc/testsuite/g++.dg/init/placement2.C22
-rw-r--r--gcc/testsuite/g++.dg/lookup/using9.C30
-rw-r--r--gcc/testsuite/g++.dg/template/error3.C5
-rw-r--r--gcc/testsuite/g++.dg/template/memfriend1.C54
-rw-r--r--gcc/testsuite/g++.dg/template/memfriend2.C61
-rw-r--r--gcc/testsuite/g++.dg/template/memfriend3.C55
-rw-r--r--gcc/testsuite/g++.dg/template/memfriend4.C63
-rw-r--r--gcc/testsuite/g++.dg/template/memfriend5.C31
-rw-r--r--gcc/testsuite/g++.dg/template/memfriend6.C23
-rw-r--r--gcc/testsuite/g++.dg/template/memfriend7.C133
-rw-r--r--gcc/testsuite/g++.dg/template/memfriend8.C25
-rw-r--r--gcc/testsuite/g++.dg/template/static5.C17
-rw-r--r--gcc/testsuite/g++.dg/template/template-id-2.C22
-rw-r--r--gcc/testsuite/gcc.dg/cpp/assert4.c372
-rw-r--r--gcc/testsuite/gcc.dg/cpp/trad/xwin1.c13
-rw-r--r--gcc/testsuite/gcc.dg/nested-func-1.c35
-rw-r--r--libjava/gnu/java/awt/peer/gtk/GdkClasspathFontPeerMetrics.java116
-rw-r--r--libjava/java/awt/geom/doc-files/FlatteningPathIterator-1.html481
-rw-r--r--libjava/java/util/logging/logging.properties8
-rw-r--r--libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkClasspathFontPeerMetrics.c93
-rw-r--r--libjava/testsuite/libjava.compile/PR12857.java4
-rw-r--r--libstdc++-v3/include/debug/formatter.h389
-rw-r--r--libstdc++-v3/src/debug.cc660
-rw-r--r--libstdc++-v3/testsuite/22_locale/num_put/put/char/8.cc68
-rw-r--r--libstdc++-v3/testsuite/22_locale/num_put/put/wchar_t/8.cc68
-rw-r--r--libstdc++-v3/testsuite/24_iterators/istreambuf_iterator/1.cc52
-rw-r--r--libstdc++-v3/testsuite/24_iterators/istreambuf_iterator/2.cc117
-rw-r--r--libstdc++-v3/testsuite/24_iterators/istreambuf_iterator/2627.cc67
-rw-r--r--libstdc++-v3/testsuite/24_iterators/ostreambuf_iterator/1.cc50
-rw-r--r--libstdc++-v3/testsuite/24_iterators/ostreambuf_iterator/2.cc92
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_filebuf/imbue/wchar_t/12868.cc60
-rw-r--r--libstdc++-v3/testsuite/performance/wchar_t_in.cc84
-rw-r--r--libstdc++-v3/testsuite/performance/wchar_t_out.cc84
49 files changed, 5270 insertions, 0 deletions
diff --git a/gcc/ada/35soccon.ads b/gcc/ada/35soccon.ads
new file mode 100644
index 00000000000..cd19222e1a7
--- /dev/null
+++ b/gcc/ada/35soccon.ads
@@ -0,0 +1,158 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT COMPILER COMPONENTS --
+-- --
+-- G N A T . S O C K E T S . C O N S T A N T S --
+-- --
+-- S p e c --
+-- --
+-- Copyright (C) 2000-2003 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 2, 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. See the GNU General Public License --
+-- for more details. You should have received a copy of the GNU General --
+-- Public License distributed with GNAT; see file COPYING. If not, write --
+-- to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, --
+-- MA 02111-1307, USA. --
+-- --
+-- As a special exception, if other files instantiate generics from this --
+-- unit, or you link this unit with other files to produce an executable, --
+-- this unit does not by itself cause the resulting executable to be --
+-- covered by the GNU General Public License. This exception does not --
+-- however invalidate any other reasons why the executable file might be --
+-- covered by the GNU Public License. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+-- This package provides target dependent definitions of constant for use
+-- by the GNAT.Sockets package (g-socket.ads). This package should not be
+-- directly with'ed by an applications program.
+
+-- This is the version for i386 FreeBSD
+
+package GNAT.Sockets.Constants is
+
+ --------------
+ -- Families --
+ --------------
+
+ AF_INET : constant := 2; -- IPv4 address family
+ AF_INET6 : constant := 28; -- IPv6 address family
+
+ -----------
+ -- Modes --
+ -----------
+
+ SOCK_STREAM : constant := 1; -- Stream socket
+ SOCK_DGRAM : constant := 2; -- Datagram socket
+
+ -------------------
+ -- Socket errors --
+ -------------------
+
+ EACCES : constant := 13; -- Permission denied
+ EADDRINUSE : constant := 48; -- Address already in use
+ EADDRNOTAVAIL : constant := 49; -- Cannot assign address
+ EAFNOSUPPORT : constant := 47; -- Addr family not supported
+ EALREADY : constant := 37; -- Operation in progress
+ EBADF : constant := 9; -- Bad file descriptor
+ ECONNABORTED : constant := 53; -- Connection aborted
+ ECONNREFUSED : constant := 61; -- Connection refused
+ ECONNRESET : constant := 54; -- Connection reset by peer
+ EDESTADDRREQ : constant := 39; -- Destination addr required
+ EFAULT : constant := 14; -- Bad address
+ EHOSTDOWN : constant := 64; -- Host is down
+ EHOSTUNREACH : constant := 65; -- No route to host
+ EINPROGRESS : constant := 36; -- Operation now in progress
+ EINTR : constant := 4; -- Interrupted system call
+ EINVAL : constant := 22; -- Invalid argument
+ EIO : constant := 5; -- Input output error
+ EISCONN : constant := 56; -- Socket already connected
+ ELOOP : constant := 62; -- Too many symbolic lynks
+ EMFILE : constant := 24; -- Too many open files
+ EMSGSIZE : constant := 40; -- Message too long
+ ENAMETOOLONG : constant := 63; -- Name too long
+ ENETDOWN : constant := 50; -- Network is down
+ ENETRESET : constant := 52; -- Disconn. on network reset
+ ENETUNREACH : constant := 51; -- Network is unreachable
+ ENOBUFS : constant := 55; -- No buffer space available
+ ENOPROTOOPT : constant := 42; -- Protocol not available
+ ENOTCONN : constant := 57; -- Socket not connected
+ ENOTSOCK : constant := 38; -- Operation on non socket
+ EOPNOTSUPP : constant := 45; -- Operation not supported
+ EPFNOSUPPORT : constant := 46; -- Unknown protocol family
+ EPROTONOSUPPORT : constant := 43; -- Unknown protocol
+ EPROTOTYPE : constant := 41; -- Unknown protocol type
+ ESHUTDOWN : constant := 58; -- Cannot send once shutdown
+ ESOCKTNOSUPPORT : constant := 44; -- Socket type not supported
+ ETIMEDOUT : constant := 60; -- Connection timed out
+ ETOOMANYREFS : constant := 59; -- Too many references
+ EWOULDBLOCK : constant := 35; -- Operation would block
+
+ -----------------
+ -- Host errors --
+ -----------------
+
+ HOST_NOT_FOUND : constant := 1; -- Unknown host
+ TRY_AGAIN : constant := 2; -- Host name lookup failure
+ NO_DATA : constant := 4; -- No data record for name
+ NO_RECOVERY : constant := 3; -- Non recoverable errors
+
+ -------------------
+ -- Control flags --
+ -------------------
+
+ FIONBIO : constant := -2147195266; -- Set/clear non-blocking io
+ FIONREAD : constant := 1074030207; -- How many bytes to read
+
+ --------------------
+ -- Shutdown modes --
+ --------------------
+
+ SHUT_RD : constant := 0; -- No more recv
+ SHUT_WR : constant := 1; -- No more send
+ SHUT_RDWR : constant := 2; -- No more recv/send
+
+ ---------------------
+ -- Protocol levels --
+ ---------------------
+
+ SOL_SOCKET : constant := 65535; -- Options for socket level
+ IPPROTO_IP : constant := 0; -- Dummy protocol for IP
+ IPPROTO_UDP : constant := 17; -- UDP
+ IPPROTO_TCP : constant := 6; -- TCP
+
+ -------------------
+ -- Request flags --
+ -------------------
+
+ MSG_OOB : constant := 1; -- Process out-of-band data
+ MSG_PEEK : constant := 2; -- Peek at incoming data
+ MSG_EOR : constant := 8; -- Send end of record
+ MSG_WAITALL : constant := 64; -- Wait for full reception
+
+ --------------------
+ -- Socket options --
+ --------------------
+
+ TCP_NODELAY : constant := 1; -- Do not coalesce packets
+ SO_SNDBUF : constant := 4097; -- Set/get send buffer size
+ SO_RCVBUF : constant := 4098; -- Set/get recv buffer size
+ SO_REUSEADDR : constant := 4; -- Bind reuse local address
+ SO_KEEPALIVE : constant := 8; -- Enable keep-alive msgs
+ SO_LINGER : constant := 128; -- Defer close to flush data
+ SO_ERROR : constant := 4103; -- Get/clear error status
+ SO_BROADCAST : constant := 32; -- Can send broadcast msgs
+ IP_ADD_MEMBERSHIP : constant := 12; -- Join a multicast group
+ IP_DROP_MEMBERSHIP : constant := 13; -- Leave a multicast group
+ IP_MULTICAST_TTL : constant := 10; -- Set/get multicast TTL
+ IP_MULTICAST_LOOP : constant := 11; -- Set/get mcast loopback
+
+end GNAT.Sockets.Constants;
diff --git a/gcc/ada/45intnam.ads b/gcc/ada/45intnam.ads
new file mode 100644
index 00000000000..eb05daaa912
--- /dev/null
+++ b/gcc/ada/45intnam.ads
@@ -0,0 +1,136 @@
+------------------------------------------------------------------------------
+-- --
+-- GNU ADA RUN-TIME LIBRARY (GNARL) COMPONENTS --
+-- --
+-- A D A . I N T E R R U P T S . N A M E S --
+-- --
+-- S p e c --
+-- --
+-- Copyright (C) 1991-2003 Free Software Foundation, Inc. --
+-- --
+-- GNARL 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 2, or (at your option) any later ver- --
+-- sion. GNARL 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. See the GNU General Public License --
+-- for more details. You should have received a copy of the GNU General --
+-- Public License distributed with GNARL; see file COPYING. If not, write --
+-- to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, --
+-- MA 02111-1307, USA. --
+-- --
+-- As a special exception, if other files instantiate generics from this --
+-- unit, or you link this unit with other files to produce an executable, --
+-- this unit does not by itself cause the resulting executable to be --
+-- covered by the GNU General Public License. This exception does not --
+-- however invalidate any other reasons why the executable file might be --
+-- covered by the GNU Public License. --
+-- --
+-- GNARL was developed by the GNARL team at Florida State University. --
+-- Extensive contributions were provided by Ada Core Technologies, Inc. --
+-- --
+------------------------------------------------------------------------------
+
+-- This is the FreeBSD THREADS version of this package
+
+with System.OS_Interface;
+-- used for names of interrupts
+
+package Ada.Interrupts.Names is
+
+ SIGHUP : constant Interrupt_ID :=
+ System.OS_Interface.SIGHUP; -- hangup
+
+ SIGINT : constant Interrupt_ID :=
+ System.OS_Interface.SIGINT; -- interrupt (rubout)
+
+ SIGQUIT : constant Interrupt_ID :=
+ System.OS_Interface.SIGQUIT; -- quit (ASCD FS)
+
+ SIGILL : constant Interrupt_ID :=
+ System.OS_Interface.SIGILL; -- illegal instruction (not reset)
+
+ SIGTRAP : constant Interrupt_ID :=
+ System.OS_Interface.SIGTRAP; -- trace trap (not reset)
+
+ SIGIOT : constant Interrupt_ID :=
+ System.OS_Interface.SIGIOT; -- IOT instruction
+
+ SIGABRT : constant Interrupt_ID := -- used by abort,
+ System.OS_Interface.SIGABRT; -- replace SIGIOT in the future
+
+ SIGFPE : constant Interrupt_ID :=
+ System.OS_Interface.SIGFPE; -- floating point exception
+
+ SIGKILL : constant Interrupt_ID :=
+ System.OS_Interface.SIGKILL; -- kill (cannot be caught or ignored)
+
+ SIGBUS : constant Interrupt_ID :=
+ System.OS_Interface.SIGBUS; -- bus error
+
+ SIGSEGV : constant Interrupt_ID :=
+ System.OS_Interface.SIGSEGV; -- segmentation violation
+
+ SIGPIPE : constant Interrupt_ID := -- write on a pipe with
+ System.OS_Interface.SIGPIPE; -- no one to read it
+
+ SIGALRM : constant Interrupt_ID :=
+ System.OS_Interface.SIGALRM; -- alarm clock
+
+ SIGTERM : constant Interrupt_ID :=
+ System.OS_Interface.SIGTERM; -- software termination signal from kill
+
+ SIGURG : constant Interrupt_ID :=
+ System.OS_Interface.SIGURG; -- urgent condition on IO channel
+
+ SIGSTOP : constant Interrupt_ID :=
+ System.OS_Interface.SIGSTOP; -- stop (cannot be caught or ignored)
+
+ SIGTSTP : constant Interrupt_ID :=
+ System.OS_Interface.SIGTSTP; -- user stop requested from tty
+
+ SIGCONT : constant Interrupt_ID :=
+ System.OS_Interface.SIGCONT; -- stopped process has been continued
+
+ SIGCHLD : constant Interrupt_ID :=
+ System.OS_Interface.SIGCHLD; -- 4.3BSD's/POSIX name for SIGCLD
+
+ SIGCLD : constant Interrupt_ID :=
+ System.OS_Interface.SIGCLD; -- child status change
+
+ SIGTTIN : constant Interrupt_ID :=
+ System.OS_Interface.SIGTTIN; -- background tty read attempted
+
+ SIGTTOU : constant Interrupt_ID :=
+ System.OS_Interface.SIGTTOU; -- background tty write attempted
+
+ SIGIO : constant Interrupt_ID := -- input/output possible,
+ System.OS_Interface.SIGIO; -- SIGPOLL alias (Solaris)
+
+ SIGXCPU : constant Interrupt_ID :=
+ System.OS_Interface.SIGXCPU; -- CPU time limit exceeded
+
+ SIGXFSZ : constant Interrupt_ID :=
+ System.OS_Interface.SIGXFSZ; -- filesize limit exceeded
+
+ SIGVTALRM : constant Interrupt_ID :=
+ System.OS_Interface.SIGVTALRM; -- virtual timer expired
+
+ SIGPROF : constant Interrupt_ID :=
+ System.OS_Interface.SIGPROF; -- profiling timer expired
+
+ SIGWINCH : constant Interrupt_ID :=
+ System.OS_Interface.SIGWINCH; -- window size change
+
+ SIGUSR1 : constant Interrupt_ID :=
+ System.OS_Interface.SIGUSR1; -- user defined signal 1
+
+ SIGUSR2 : constant Interrupt_ID :=
+ System.OS_Interface.SIGUSR2; -- user defined signal 2
+
+ -- Beware that the mapping of names to signals may be
+ -- many-to-one. There may be aliases. Also, for all
+ -- signal names that are not supported on the current system
+ -- the value of the corresponding constant will be zero.
+
+end Ada.Interrupts.Names;
diff --git a/gcc/ada/55osinte.adb b/gcc/ada/55osinte.adb
new file mode 100644
index 00000000000..466a15d2b33
--- /dev/null
+++ b/gcc/ada/55osinte.adb
@@ -0,0 +1,108 @@
+------------------------------------------------------------------------------
+-- --
+-- GNU ADA RUNTIME LIBRARY (GNARL) COMPONENTS --
+-- --
+-- S Y S T E M . O S _ I N T E R F A C E --
+-- --
+-- B o d y --
+-- --
+-- Copyright (C) 1991-2003 Free Software Foundation, Inc. --
+-- --
+-- GNARL 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 2, or (at your option) any later ver- --
+-- sion. GNARL 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. See the GNU General Public License --
+-- for more details. You should have received a copy of the GNU General --
+-- Public License distributed with GNARL; see file COPYING. If not, write --
+-- to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, --
+-- MA 02111-1307, USA. --
+-- --
+-- As a special exception, if other files instantiate generics from this --
+-- unit, or you link this unit with other files to produce an executable, --
+-- this unit does not by itself cause the resulting executable to be --
+-- covered by the GNU General Public License. This exception does not --
+-- however invalidate any other reasons why the executable file might be --
+-- covered by the GNU Public License. --
+-- --
+-- GNARL was developed by the GNARL team at Florida State University. It is --
+-- now maintained by Ada Core Technologies Inc. in cooperation with Florida --
+-- State University (http://www.gnat.com). --
+-- --
+------------------------------------------------------------------------------
+
+-- This is the FreeBSD THREADS version of this package
+
+with Interfaces.C; use Interfaces.C;
+
+package body System.OS_Interface is
+
+ function Errno return int is
+ type int_ptr is access all int;
+
+ function internal_errno return int_ptr;
+ pragma Import (C, internal_errno, "__error");
+ begin
+ return (internal_errno.all);
+ end Errno;
+
+ function Get_Stack_Base (thread : pthread_t) return Address is
+ pragma Unreferenced (thread);
+ begin
+ return (0);
+ end Get_Stack_Base;
+
+ procedure pthread_init is
+ begin
+ null;
+ end pthread_init;
+
+ -----------------
+ -- To_Duration --
+ -----------------
+
+ function To_Duration (TS : timespec) return Duration is
+ begin
+ return Duration (TS.ts_sec) + Duration (TS.ts_nsec) / 10#1#E9;
+ end To_Duration;
+
+ -----------------
+ -- To_Timespec --
+ -----------------
+
+ function To_Timespec (D : Duration) return timespec is
+ S : time_t;
+ F : Duration;
+ begin
+ S := time_t (Long_Long_Integer (D));
+ F := D - Duration (S);
+
+ -- If F has negative value due to a round-up, adjust for positive F
+ -- value.
+ if F < 0.0 then S := S - 1; F := F + 1.0; end if;
+ return timespec'(ts_sec => S,
+ ts_nsec => long (Long_Long_Integer (F * 10#1#E9)));
+ end To_Timespec;
+
+
+ function To_Duration (TV : struct_timeval) return Duration is
+ begin
+ return Duration (TV.tv_sec) + Duration (TV.tv_usec) / 10#1#E6;
+ end To_Duration;
+
+ function To_Timeval (D : Duration) return struct_timeval is
+ S : long;
+ F : Duration;
+ begin
+ S := long (Long_Long_Integer (D));
+ F := D - Duration (S);
+
+ -- If F has negative value due to a round-up, adjust for positive F
+ -- value.
+ if F < 0.0 then S := S - 1; F := F + 1.0; end if;
+ return struct_timeval'(tv_sec => S,
+ tv_usec => long (Long_Long_Integer (F * 10#1#E6)));
+ end To_Timeval;
+
+end System.OS_Interface;
diff --git a/gcc/ada/55osinte.ads b/gcc/ada/55osinte.ads
new file mode 100644
index 00000000000..fb74ce4a6e5
--- /dev/null
+++ b/gcc/ada/55osinte.ads
@@ -0,0 +1,630 @@
+------------------------------------------------------------------------------
+-- --
+-- GNU ADA RUNTIME LIBRARY (GNARL) COMPONENTS --
+-- --
+-- S Y S T E M . O S _ I N T E R F A C E --
+-- --
+-- S p e c --
+-- --
+-- Copyright (C) 1991-2003 Free Software Foundation, Inc. --
+-- --
+-- GNARL 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 2, or (at your option) any later ver- --
+-- sion. GNARL 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. See the GNU General Public License --
+-- for more details. You should have received a copy of the GNU General --
+-- Public License distributed with GNARL; see file COPYING. If not, write --
+-- to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, --
+-- MA 02111-1307, USA. --
+-- --
+-- As a special exception, if other files instantiate generics from this --
+-- unit, or you link this unit with other files to produce an executable, --
+-- this unit does not by itself cause the resulting executable to be --
+-- covered by the GNU General Public License. This exception does not --
+-- however invalidate any other reasons why the executable file might be --
+-- covered by the GNU Public License. --
+-- --
+-- GNARL was developed by the GNARL team at Florida State University. It is --
+-- now maintained by Ada Core Technologies Inc. in cooperation with Florida --
+-- State University (http://www.gnat.com). --
+-- --
+------------------------------------------------------------------------------
+
+-- This is the FreeBSD PTHREADS version of this package
+
+with Interfaces.C;
+package System.OS_Interface is
+ pragma Preelaborate;
+
+ pragma Linker_Options ("-pthread");
+
+ subtype int is Interfaces.C.int;
+ subtype short is Interfaces.C.short;
+ subtype long is Interfaces.C.long;
+ subtype unsigned is Interfaces.C.unsigned;
+ subtype unsigned_short is Interfaces.C.unsigned_short;
+ subtype unsigned_long is Interfaces.C.unsigned_long;
+ subtype unsigned_char is Interfaces.C.unsigned_char;
+ subtype plain_char is Interfaces.C.plain_char;
+ subtype size_t is Interfaces.C.size_t;
+
+ -----------
+ -- Errno --
+ -----------
+
+ function Errno return int;
+ pragma Inline (Errno);
+
+ EAGAIN : constant := 35;
+ EINTR : constant := 4;
+ EINVAL : constant := 22;
+ ENOMEM : constant := 12;
+ ETIMEDOUT : constant := 60;
+
+ -------------
+ -- Signals --
+ -------------
+
+ Max_Interrupt : constant := 31;
+ type Signal is new int range 0 .. Max_Interrupt;
+ for Signal'Size use int'Size;
+
+ SIGHUP : constant := 1; -- hangup
+ SIGINT : constant := 2; -- interrupt (rubout)
+ SIGQUIT : constant := 3; -- quit (ASCD FS)
+ SIGILL : constant := 4; -- illegal instruction (not reset)
+ SIGTRAP : constant := 5; -- trace trap (not reset)
+ SIGIOT : constant := 6; -- IOT instruction
+ SIGABRT : constant := 6; -- used by abort, replace SIGIOT in the future
+ SIGEMT : constant := 7; -- EMT instruction
+ SIGFPE : constant := 8; -- floating point exception
+ SIGKILL : constant := 9; -- kill (cannot be caught or ignored)
+ SIGBUS : constant := 10; -- bus error
+ SIGSEGV : constant := 11; -- segmentation violation
+ SIGSYS : constant := 12; -- bad argument to system call
+ SIGPIPE : constant := 13; -- write on a pipe with no one to read it
+ SIGALRM : constant := 14; -- alarm clock
+ SIGTERM : constant := 15; -- software termination signal from kill
+ SIGURG : constant := 16; -- urgent condition on IO channel
+ SIGSTOP : constant := 17; -- stop (cannot be caught or ignored)
+ SIGTSTP : constant := 18; -- user stop requested from tty
+ SIGCONT : constant := 19; -- stopped process has been continued
+ SIGCLD : constant := 20; -- alias for SIGCHLD
+ SIGCHLD : constant := 20; -- child status change
+ SIGTTIN : constant := 21; -- background tty read attempted
+ SIGTTOU : constant := 22; -- background tty write attempted
+ SIGIO : constant := 23; -- I/O possible (Solaris SIGPOLL alias)
+ SIGXCPU : constant := 24; -- CPU time limit exceeded
+ SIGXFSZ : constant := 25; -- filesize limit exceeded
+ SIGVTALRM : constant := 26; -- virtual timer expired
+ SIGPROF : constant := 27; -- profiling timer expired
+ SIGWINCH : constant := 28; -- window size change
+ SIGINFO : constant := 29; -- information request (NetBSD/FreeBSD)
+ SIGUSR1 : constant := 30; -- user defined signal 1
+ SIGUSR2 : constant := 31; -- user defined signal 2
+
+ SIGADAABORT : constant := SIGABRT;
+ -- Change this if you want to use another signal for task abort.
+ -- SIGTERM might be a good one.
+
+ type Signal_Set is array (Natural range <>) of Signal;
+
+ -- Interrupts that must be unmasked at all times. FreeBSD
+ -- pthreads will not allow an application to mask out any
+ -- interrupt needed by the threads library.
+ Unmasked : constant Signal_Set :=
+ (SIGTRAP, SIGBUS, SIGTTIN, SIGTTOU, SIGTSTP);
+
+ -- FreeBSD will uses SIGPROF for timing. Do not allow a
+ -- handler to attach to this signal.
+ Reserved : constant Signal_Set := (0 .. 0 => SIGPROF);
+
+ type sigset_t is private;
+
+ function sigaddset
+ (set : access sigset_t;
+ sig : Signal) return int;
+ pragma Import (C, sigaddset, "sigaddset");
+
+ function sigdelset
+ (set : access sigset_t;
+ sig : Signal) return int;
+ pragma Import (C, sigdelset, "sigdelset");
+
+ function sigfillset (set : access sigset_t) return int;
+ pragma Import (C, sigfillset, "sigfillset");
+
+ function sigismember
+ (set : access sigset_t;
+ sig : Signal) return int;
+ pragma Import (C, sigismember, "sigismember");
+
+ function sigemptyset (set : access sigset_t) return int;
+ pragma Import (C, sigemptyset, "sigemptyset");
+
+ -- sigcontext is architecture dependent, so define it private
+ type struct_sigcontext is private;
+
+ type old_struct_sigaction is record
+ sa_handler : System.Address;
+ sa_mask : sigset_t;
+ sa_flags : int;
+ end record;
+ pragma Convention (C, old_struct_sigaction);
+
+ type new_struct_sigaction is record
+ sa_handler : System.Address;
+ sa_flags : int;
+ sa_mask : sigset_t;
+ end record;
+ pragma Convention (C, new_struct_sigaction);
+
+ subtype struct_sigaction is new_struct_sigaction;
+ type struct_sigaction_ptr is access all struct_sigaction;
+
+ SIG_BLOCK : constant := 1;
+ SIG_UNBLOCK : constant := 2;
+ SIG_SETMASK : constant := 3;
+
+ SIG_DFL : constant := 0;
+ SIG_IGN : constant := 1;
+
+ function sigaction
+ (sig : Signal;
+ act : struct_sigaction_ptr;
+ oact : struct_sigaction_ptr) return int;
+ pragma Import (C, sigaction, "sigaction");
+
+ ----------
+ -- Time --
+ ----------
+
+ Time_Slice_Supported : constant Boolean := True;
+ -- Indicates wether time slicing is supported (i.e SCHED_RR is supported)
+
+ type timespec is private;
+
+ function nanosleep (rqtp, rmtp : access timespec) return int;
+ pragma Import (C, nanosleep, "nanosleep");
+
+ type clockid_t is private;
+
+ CLOCK_REALTIME : constant clockid_t;
+
+ function clock_gettime
+ (clock_id : clockid_t;
+ tp : access timespec)
+ return int;
+ pragma Import (C, clock_gettime, "clock_gettime");
+
+ function To_Duration (TS : timespec) return Duration;
+ pragma Inline (To_Duration);
+
+ function To_Timespec (D : Duration) return timespec;
+ pragma Inline (To_Timespec);
+
+ type struct_timezone is record
+ tz_minuteswest : int;
+ tz_dsttime : int;
+ end record;
+ pragma Convention (C, struct_timezone);
+ type struct_timeval is private;
+ -- This is needed on systems that do not have clock_gettime()
+ -- but do have gettimeofday().
+
+ function To_Duration (TV : struct_timeval) return Duration;
+ pragma Inline (To_Duration);
+
+ function To_Timeval (D : Duration) return struct_timeval;
+ pragma Inline (To_Timeval);
+
+ function gettimeofday
+ (tv : access struct_timeval;
+ tz : System.Address) return int;
+ pragma Import (C, gettimeofday, "gettimeofday");
+
+ procedure usleep (useconds : unsigned_long);
+ pragma Import (C, usleep, "usleep");
+
+ -------------------------
+ -- Priority Scheduling --
+ -------------------------
+
+ SCHED_FIFO : constant := 1;
+ SCHED_OTHER : constant := 2;
+ SCHED_RR : constant := 3;
+
+ -------------
+ -- Process --
+ -------------
+
+ type pid_t is private;
+
+ Self_PID : constant pid_t;
+
+ function kill (pid : pid_t; sig : Signal) return int;
+ pragma Import (C, kill, "kill");
+
+ function getpid return pid_t;
+ pragma Import (C, getpid, "getpid");
+
+ ---------
+ -- LWP --
+ ---------
+
+ function lwp_self return System.Address;
+ -- lwp_self does not exist on this thread library, revert to pthread_self
+ -- which is the closest approximation (with getpid). This function is
+ -- needed to share 7staprop.adb across POSIX-like targets.
+ pragma Import (C, lwp_self, "pthread_self");
+
+ -------------
+ -- Threads --
+ -------------
+
+ type Thread_Body is access
+ function (arg : System.Address) return System.Address;
+
+ type pthread_t is private;
+ subtype Thread_Id is pthread_t;
+
+ type pthread_mutex_t is limited private;
+ type pthread_cond_t is limited private;
+ type pthread_attr_t is limited private;
+ type pthread_mutexattr_t is limited private;
+ type pthread_condattr_t is limited private;
+ type pthread_key_t is private;
+
+ PTHREAD_CREATE_DETACHED : constant := 1;
+ PTHREAD_CREATE_JOINABLE : constant := 0;
+
+ -----------
+ -- Stack --
+ -----------
+
+ Stack_Base_Available : constant Boolean := False;
+ -- Indicates wether the stack base is available on this target.
+ -- This allows us to share s-osinte.adb between all the FSU run time.
+ -- Note that this value can only be true if pthread_t has a complete
+ -- definition that corresponds exactly to the C header files.
+
+ function Get_Stack_Base (thread : pthread_t) return Address;
+ pragma Inline (Get_Stack_Base);
+ -- returns the stack base of the specified thread.
+ -- Only call this function when Stack_Base_Available is True.
+
+ function Get_Page_Size return size_t;
+ function Get_Page_Size return Address;
+ pragma Import (C, Get_Page_Size, "getpagesize");
+ -- returns the size of a page, or 0 if this is not relevant on this
+ -- target
+
+ PROT_NONE : constant := 0;
+ PROT_READ : constant := 1;
+ PROT_WRITE : constant := 2;
+ PROT_EXEC : constant := 4;
+ PROT_ALL : constant := PROT_READ + PROT_WRITE + PROT_EXEC;
+
+ PROT_ON : constant := PROT_NONE;
+ PROT_OFF : constant := PROT_ALL;
+
+ function mprotect
+ (addr : Address; len : size_t; prot : int) return int;
+ pragma Import (C, mprotect);
+
+ -----------------------------------------
+ -- Nonstandard Thread Initialization --
+ -----------------------------------------
+ -- FSU_THREADS requires pthread_init, which is nonstandard
+ -- and this should be invoked during the elaboration of s-taprop.adb
+ --
+ -- FreeBSD does not require this so we provide an empty Ada body.
+ procedure pthread_init;
+
+ ---------------------------
+ -- POSIX.1c Section 3 --
+ ---------------------------
+
+ function sigwait
+ (set : access sigset_t;
+ sig : access Signal) return int;
+ pragma Import (C, sigwait, "sigwait");
+
+ function pthread_kill
+ (thread : pthread_t;
+ sig : Signal) return int;
+ pragma Import (C, pthread_kill, "pthread_kill");
+
+ type sigset_t_ptr is access all sigset_t;
+
+ function pthread_sigmask
+ (how : int;
+ set : sigset_t_ptr;
+ oset : sigset_t_ptr) return int;
+ pragma Import (C, pthread_sigmask, "pthread_sigmask");
+
+ ----------------------------
+ -- POSIX.1c Section 11 --
+ ----------------------------
+
+ function pthread_mutexattr_init
+ (attr : access pthread_mutexattr_t) return int;
+ pragma Import (C, pthread_mutexattr_init, "pthread_mutexattr_init");
+
+ function pthread_mutexattr_destroy
+ (attr : access pthread_mutexattr_t) return int;
+ pragma Import (C, pthread_mutexattr_destroy, "pthread_mutexattr_destroy");
+
+ function pthread_mutex_init
+ (mutex : access pthread_mutex_t;
+ attr : access pthread_mutexattr_t) return int;
+ pragma Import (C, pthread_mutex_init, "pthread_mutex_init");
+
+ function pthread_mutex_destroy (mutex : access pthread_mutex_t) return int;
+ pragma Import (C, pthread_mutex_destroy, "pthread_mutex_destroy");
+
+ function pthread_mutex_lock (mutex : access pthread_mutex_t) return int;
+ pragma Import (C, pthread_mutex_lock, "pthread_mutex_lock");
+
+ function pthread_mutex_unlock (mutex : access pthread_mutex_t) return int;
+ pragma Import (C, pthread_mutex_unlock, "pthread_mutex_unlock");
+
+ function pthread_condattr_init
+ (attr : access pthread_condattr_t) return int;
+ pragma Import (C, pthread_condattr_init, "pthread_condattr_init");
+
+ function pthread_condattr_destroy
+ (attr : access pthread_condattr_t) return int;
+ pragma Import (C, pthread_condattr_destroy, "pthread_condattr_destroy");
+
+ function pthread_cond_init
+ (cond : access pthread_cond_t;
+ attr : access pthread_condattr_t) return int;
+ pragma Import (C, pthread_cond_init, "pthread_cond_init");
+
+ function pthread_cond_destroy (cond : access pthread_cond_t) return int;
+ pragma Import (C, pthread_cond_destroy, "pthread_cond_destroy");
+
+ function pthread_cond_signal (cond : access pthread_cond_t) return int;
+ pragma Import (C, pthread_cond_signal, "pthread_cond_signal");
+
+ function pthread_cond_wait
+ (cond : access pthread_cond_t;
+ mutex : access pthread_mutex_t) return int;
+ pragma Import (C, pthread_cond_wait, "pthread_cond_wait");
+
+ function pthread_cond_timedwait
+ (cond : access pthread_cond_t;
+ mutex : access pthread_mutex_t;
+ abstime : access timespec) return int;
+ pragma Import (C, pthread_cond_timedwait, "pthread_cond_timedwait");
+
+ Relative_Timed_Wait : constant Boolean := False;
+ -- pthread_cond_timedwait requires an absolute delay time
+
+ ----------------------------
+ -- POSIX.1c Section 13 --
+ ----------------------------
+
+ PTHREAD_PRIO_NONE : constant := 0;
+ PTHREAD_PRIO_PROTECT : constant := 2;
+ PTHREAD_PRIO_INHERIT : constant := 1;
+
+ function pthread_mutexattr_setprotocol
+ (attr : access pthread_mutexattr_t;
+ protocol : int) return int;
+ pragma Import
+ (C, pthread_mutexattr_setprotocol, "pthread_mutexattr_setprotocol");
+
+ function pthread_mutexattr_getprotocol
+ (attr : access pthread_mutexattr_t;
+ protocol : access int) return int;
+ pragma Import
+ (C, pthread_mutexattr_getprotocol, "pthread_mutexattr_getprotocol");
+
+ function pthread_mutexattr_setprioceiling
+ (attr : access pthread_mutexattr_t;
+ prioceiling : int) return int;
+ pragma Import
+ (C, pthread_mutexattr_setprioceiling,
+ "pthread_mutexattr_setprioceiling");
+
+ function pthread_mutexattr_getprioceiling
+ (attr : access pthread_mutexattr_t;
+ prioceiling : access int) return int;
+ pragma Import
+ (C, pthread_mutexattr_getprioceiling,
+ "pthread_mutexattr_getprioceiling");
+
+ type struct_sched_param is record
+ sched_priority : int;
+ end record;
+ pragma Convention (C, struct_sched_param);
+
+ function pthread_getschedparam
+ (thread : pthread_t;
+ policy : access int;
+ param : access struct_sched_param) return int;
+ pragma Import (C, pthread_getschedparam, "pthread_getschedparam");
+
+ function pthread_setschedparam
+ (thread : pthread_t;
+ policy : int;
+ param : access struct_sched_param) return int;
+ pragma Import (C, pthread_setschedparam, "pthread_setschedparam");
+
+ function pthread_attr_setscope
+ (attr : access pthread_attr_t;
+ contentionscope : int) return int;
+ pragma Import (C, pthread_attr_setscope, "pthread_attr_setscope");
+
+ function pthread_attr_getscope
+ (attr : access pthread_attr_t;
+ contentionscope : access int) return int;
+ pragma Import (C, pthread_attr_getscope, "pthread_attr_getscope");
+
+ function pthread_attr_setinheritsched
+ (attr : access pthread_attr_t;
+ inheritsched : int) return int;
+ pragma Import
+ (C, pthread_attr_setinheritsched, "pthread_attr_setinheritsched");
+
+ function pthread_attr_getinheritsched
+ (attr : access pthread_attr_t;
+ inheritsched : access int) return int;
+ pragma Import
+ (C, pthread_attr_getinheritsched, "pthread_attr_getinheritsched");
+
+ function pthread_attr_setschedpolicy
+ (attr : access pthread_attr_t;
+ policy : int) return int;
+ pragma Import (C, pthread_attr_setschedpolicy,
+ "pthread_attr_setschedpolicy");
+
+ function pthread_attr_getschedpolicy
+ (attr : access pthread_attr_t;
+ policy : access int) return int;
+ pragma Import (C, pthread_attr_getschedpolicy,
+ "pthread_attr_getschedpolicy");
+
+ function pthread_attr_setschedparam
+ (attr : access pthread_attr_t;
+ sched_param : int) return int;
+ pragma Import (C, pthread_attr_setschedparam, "pthread_attr_setschedparam");
+
+ function pthread_attr_getschedparam
+ (attr : access pthread_attr_t;
+ sched_param : access int) return int;
+ pragma Import (C, pthread_attr_getschedparam, "pthread_attr_getschedparam");
+
+ function sched_yield return int;
+ pragma Import (C, sched_yield, "pthread_yield");
+
+ -----------------------------
+ -- P1003.1c - Section 16 --
+ -----------------------------
+
+ function pthread_attr_init (attributes : access pthread_attr_t) return int;
+ pragma Import (C, pthread_attr_init, "pthread_attr_init");
+
+ function pthread_attr_destroy
+ (attributes : access pthread_attr_t) return int;
+ pragma Import (C, pthread_attr_destroy, "pthread_attr_destroy");
+
+ function pthread_attr_setdetachstate
+ (attr : access pthread_attr_t;
+ detachstate : int) return int;
+ pragma Import
+ (C, pthread_attr_setdetachstate, "pthread_attr_setdetachstate");
+
+ function pthread_attr_getdetachstate
+ (attr : access pthread_attr_t;
+ detachstate : access int) return int;
+ pragma Import
+ (C, pthread_attr_getdetachstate, "pthread_attr_getdetachstate");
+
+ function pthread_attr_getstacksize
+ (attr : access pthread_attr_t;
+ stacksize : access size_t) return int;
+ pragma Import
+ (C, pthread_attr_getstacksize, "pthread_attr_getstacksize");
+
+ function pthread_attr_setstacksize
+ (attr : access pthread_attr_t;
+ stacksize : size_t) return int;
+ pragma Import
+ (C, pthread_attr_setstacksize, "pthread_attr_setstacksize");
+
+ function pthread_create
+ (thread : access pthread_t;
+ attributes : access pthread_attr_t;
+ start_routine : Thread_Body;
+ arg : System.Address) return int;
+ pragma Import (C, pthread_create, "pthread_create");
+
+ function pthread_detach (thread : pthread_t) return int;
+ pragma Import (C, pthread_detach, "pthread_detach");
+
+ procedure pthread_exit (status : System.Address);
+ pragma Import (C, pthread_exit, "pthread_exit");
+
+ function pthread_self return pthread_t;
+ pragma Import (C, pthread_self, "pthread_self");
+
+ ----------------------------
+ -- POSIX.1c Section 17 --
+ ----------------------------
+
+ function pthread_setspecific
+ (key : pthread_key_t;
+ value : System.Address) return int;
+ pragma Import (C, pthread_setspecific, "pthread_setspecific");
+
+ function pthread_getspecific (key : pthread_key_t) return System.Address;
+ pragma Import (C, pthread_getspecific, "pthread_getspecific");
+
+ type destructor_pointer is access
+ procedure (arg : System.Address);
+
+ function pthread_key_create
+ (key : access pthread_key_t;
+ destructor : destructor_pointer) return int;
+ pragma Import (C, pthread_key_create, "pthread_key_create");
+
+ --------------------------------------
+ -- Non-portable pthread functions --
+ --------------------------------------
+
+ function pthread_set_name_np
+ (thread : pthread_t;
+ name : System.Address) return int;
+ pragma Import (C, pthread_set_name_np, "pthread_set_name_np");
+
+private
+
+ type sigset_t is array (1 .. 4) of unsigned;
+
+ -- In FreeBSD the component sa_handler turns out to
+ -- be one a union type, and the selector is a macro:
+ -- #define sa_handler __sigaction_u._handler
+ -- #define sa_sigaction __sigaction_u._sigaction
+
+ -- Should we add a signal_context type here ?
+ -- How could it be done independent of the CPU architecture ?
+ -- 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.
+ type struct_sigcontext is null record;
+ pragma Convention (C, struct_sigcontext);
+
+ type pid_t is new int;
+ Self_PID : constant pid_t := 0;
+
+ type time_t is new long;
+
+ type timespec is record
+ ts_sec : time_t;
+ ts_nsec : long;
+ end record;
+ pragma Convention (C, timespec);
+
+ type clockid_t is new int;
+ CLOCK_REALTIME : constant clockid_t := 0;
+
+ type struct_timeval is record
+ tv_sec : long;
+ tv_usec : long;
+ end record;
+ pragma Convention (C, struct_timeval);
+
+ type pthread_t is new System.Address;
+ type pthread_attr_t is new System.Address;
+ type pthread_mutex_t is new System.Address;
+ type pthread_mutexattr_t is new System.Address;
+ type pthread_cond_t is new System.Address;
+ type pthread_condattr_t is new System.Address;
+ type pthread_key_t is new int;
+
+end System.OS_Interface;
diff --git a/gcc/ada/56system.ads b/gcc/ada/56system.ads
new file mode 100644
index 00000000000..a7371a2d9a2
--- /dev/null
+++ b/gcc/ada/56system.ads
@@ -0,0 +1,150 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT RUN-TIME COMPONENTS --
+-- --
+-- S Y S T E M --
+-- --
+-- S p e c --
+-- (FreeBSD/x86 Version) --
+-- --
+-- Copyright (C) 1992-2003 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 --
+-- apply solely to the contents of the part following the private keyword. --
+-- --
+-- 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 2, 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. See the GNU General Public License --
+-- for more details. You should have received a copy of the GNU General --
+-- Public License distributed with GNAT; see file COPYING. If not, write --
+-- to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, --
+-- MA 02111-1307, USA. --
+-- --
+-- As a special exception, if other files instantiate generics from this --
+-- unit, or you link this unit with other files to produce an executable, --
+-- this unit does not by itself cause the resulting executable to be --
+-- covered by the GNU General Public License. This exception does not --
+-- however invalidate any other reasons why the executable file might be --
+-- covered by the GNU Public License. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+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)
+
+ type Name is (SYSTEM_NAME_GNAT);
+ System_Name : constant Name := SYSTEM_NAME_GNAT;
+
+ -- System-Dependent Named Numbers
+
+ Min_Int : constant := Long_Long_Integer'First;
+ Max_Int : constant := Long_Long_Integer'Last;
+
+ Max_Binary_Modulus : constant := 2 ** Long_Long_Integer'Size;
+ Max_Nonbinary_Modulus : constant := Integer'Last;
+
+ Max_Base_Digits : constant := Long_Long_Float'Digits;
+ Max_Digits : constant := Long_Long_Float'Digits;
+
+ Max_Mantissa : constant := 63;
+ Fine_Delta : constant := 2.0 ** (-Max_Mantissa);
+
+ Tick : constant := 0.000_001;
+
+ -- Storage-related Declarations
+
+ type Address is private;
+ Null_Address : constant Address;
+
+ Storage_Unit : constant := 8;
+ Word_Size : constant := 32;
+ Memory_Size : constant := 2 ** 32;
+
+ -- Address comparison
+
+ function "<" (Left, Right : Address) return Boolean;
+ function "<=" (Left, Right : Address) return Boolean;
+ function ">" (Left, Right : Address) return Boolean;
+ function ">=" (Left, Right : Address) return Boolean;
+ function "=" (Left, Right : Address) return Boolean;
+
+ pragma Import (Intrinsic, "<");
+ pragma Import (Intrinsic, "<=");
+ pragma Import (Intrinsic, ">");
+ pragma Import (Intrinsic, ">=");
+ pragma Import (Intrinsic, "=");
+
+ -- Other System-Dependent Declarations
+
+ type Bit_Order is (High_Order_First, Low_Order_First);
+ Default_Bit_Order : constant Bit_Order := Low_Order_First;
+
+ -- Priority-related Declarations (RM D.1)
+
+ Max_Priority : constant Positive := 30;
+ Max_Interrupt_Priority : constant Positive := 31;
+
+ subtype Any_Priority is Integer range 0 .. 31;
+ subtype Priority is Any_Priority range 0 .. 30;
+ subtype Interrupt_Priority is Any_Priority range 31 .. 31;
+
+ Default_Priority : constant Priority := 15;
+
+private
+
+ type Address is mod Memory_Size;
+ Null_Address : constant Address := 0;
+
+ --------------------------------------
+ -- System Implementation Parameters --
+ --------------------------------------
+
+ -- These parameters provide information about the target that is used
+ -- by the compiler. They are in the private part of System, where they
+ -- can be accessed using the special circuitry in the Targparm unit
+ -- whose source should be consulted for more detailed descriptions
+ -- of the individual switch values.
+
+ AAMP : constant Boolean := False;
+ Backend_Divide_Checks : constant Boolean := False;
+ Backend_Overflow_Checks : constant Boolean := False;
+ Command_Line_Args : constant Boolean := True;
+ Configurable_Run_Time : constant Boolean := False;
+ Denorm : constant Boolean := True;
+ Duration_32_Bits : constant Boolean := False;
+ Exit_Status_Supported : constant Boolean := True;
+ Fractional_Fixed_Ops : constant Boolean := False;
+ Frontend_Layout : constant Boolean := False;
+ Functions_Return_By_DSP : constant Boolean := False;
+ Machine_Overflows : constant Boolean := False;
+ Machine_Rounds : constant Boolean := True;
+ OpenVMS : constant Boolean := False;
+ Signed_Zeros : constant Boolean := True;
+ Stack_Check_Default : constant Boolean := False;
+ Stack_Check_Probes : constant Boolean := False;
+ Support_64_Bit_Divides : constant Boolean := True;
+ Support_Aggregates : constant Boolean := True;
+ Support_Composite_Assign : constant Boolean := True;
+ Support_Composite_Compare : constant Boolean := True;
+ Support_Long_Shifts : constant Boolean := True;
+ Suppress_Standard_Library : constant Boolean := False;
+ Use_Ada_Main_Program_Name : constant Boolean := False;
+ ZCX_By_Default : constant Boolean := False;
+ GCC_ZCX_Support : constant Boolean := False;
+ Front_End_ZCX_Support : constant Boolean := False;
+
+ -- Obsolete entries, to be removed eventually (bootstrap issues!)
+
+ High_Integrity_Mode : constant Boolean := False;
+ Long_Shifts_Inlined : constant Boolean := True;
+
+end System;
diff --git a/gcc/ada/5nsystem.ads b/gcc/ada/5nsystem.ads
new file mode 100644
index 00000000000..37a495d8870
--- /dev/null
+++ b/gcc/ada/5nsystem.ads
@@ -0,0 +1,150 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT RUN-TIME COMPONENTS --
+-- --
+-- S Y S T E M --
+-- --
+-- S p e c --
+-- (GNU-Linux/x86-64 Version) --
+-- --
+-- Copyright (C) 1992-2003 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 --
+-- apply solely to the contents of the part following the private keyword. --
+-- --
+-- 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 2, 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. See the GNU General Public License --
+-- for more details. You should have received a copy of the GNU General --
+-- Public License distributed with GNAT; see file COPYING. If not, write --
+-- to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, --
+-- MA 02111-1307, USA. --
+-- --
+-- As a special exception, if other files instantiate generics from this --
+-- unit, or you link this unit with other files to produce an executable, --
+-- this unit does not by itself cause the resulting executable to be --
+-- covered by the GNU General Public License. This exception does not --
+-- however invalidate any other reasons why the executable file might be --
+-- covered by the GNU Public License. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+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)
+
+ type Name is (SYSTEM_NAME_GNAT);
+ System_Name : constant Name := SYSTEM_NAME_GNAT;
+
+ -- System-Dependent Named Numbers
+
+ Min_Int : constant := Long_Long_Integer'First;
+ Max_Int : constant := Long_Long_Integer'Last;
+
+ Max_Binary_Modulus : constant := 2 ** Long_Long_Integer'Size;
+ Max_Nonbinary_Modulus : constant := Integer'Last;
+
+ Max_Base_Digits : constant := Long_Long_Float'Digits;
+ Max_Digits : constant := Long_Long_Float'Digits;
+
+ Max_Mantissa : constant := 63;
+ Fine_Delta : constant := 2.0 ** (-Max_Mantissa);
+
+ Tick : constant := 0.000_001;
+
+ -- Storage-related Declarations
+
+ type Address is private;
+ Null_Address : constant Address;
+
+ Storage_Unit : constant := 8;
+ Word_Size : constant := 64;
+ Memory_Size : constant := 2 ** 64;
+
+ -- Address comparison
+
+ function "<" (Left, Right : Address) return Boolean;
+ function "<=" (Left, Right : Address) return Boolean;
+ function ">" (Left, Right : Address) return Boolean;
+ function ">=" (Left, Right : Address) return Boolean;
+ function "=" (Left, Right : Address) return Boolean;
+
+ pragma Import (Intrinsic, "<");
+ pragma Import (Intrinsic, "<=");
+ pragma Import (Intrinsic, ">");
+ pragma Import (Intrinsic, ">=");
+ pragma Import (Intrinsic, "=");
+
+ -- Other System-Dependent Declarations
+
+ type Bit_Order is (High_Order_First, Low_Order_First);
+ Default_Bit_Order : constant Bit_Order := Low_Order_First;
+
+ -- Priority-related Declarations (RM D.1)
+
+ Max_Priority : constant Positive := 30;
+ Max_Interrupt_Priority : constant Positive := 31;
+
+ subtype Any_Priority is Integer range 0 .. 31;
+ subtype Priority is Any_Priority range 0 .. 30;
+ subtype Interrupt_Priority is Any_Priority range 31 .. 31;
+
+ Default_Priority : constant Priority := 15;
+
+private
+
+ type Address is mod Memory_Size;
+ Null_Address : constant Address := 0;
+
+ --------------------------------------
+ -- System Implementation Parameters --
+ --------------------------------------
+
+ -- These parameters provide information about the target that is used
+ -- by the compiler. They are in the private part of System, where they
+ -- can be accessed using the special circuitry in the Targparm unit
+ -- whose source should be consulted for more detailed descriptions
+ -- of the individual switch values.
+
+ AAMP : constant Boolean := False;
+ Backend_Divide_Checks : constant Boolean := False;
+ Backend_Overflow_Checks : constant Boolean := False;
+ Command_Line_Args : constant Boolean := True;
+ Configurable_Run_Time : constant Boolean := False;
+ Denorm : constant Boolean := True;
+ Duration_32_Bits : constant Boolean := False;
+ Exit_Status_Supported : constant Boolean := True;
+ Fractional_Fixed_Ops : constant Boolean := False;
+ Frontend_Layout : constant Boolean := False;
+ Functions_Return_By_DSP : constant Boolean := False;
+ Machine_Overflows : constant Boolean := False;
+ Machine_Rounds : constant Boolean := True;
+ OpenVMS : constant Boolean := False;
+ Signed_Zeros : constant Boolean := True;
+ Stack_Check_Default : constant Boolean := False;
+ Stack_Check_Probes : constant Boolean := False;
+ Support_64_Bit_Divides : constant Boolean := True;
+ Support_Aggregates : constant Boolean := True;
+ Support_Composite_Assign : constant Boolean := True;
+ Support_Composite_Compare : constant Boolean := True;
+ Support_Long_Shifts : constant Boolean := True;
+ Suppress_Standard_Library : constant Boolean := False;
+ Use_Ada_Main_Program_Name : constant Boolean := False;
+ ZCX_By_Default : constant Boolean := True;
+ GCC_ZCX_Support : constant Boolean := True;
+ Front_End_ZCX_Support : constant Boolean := False;
+
+ -- Obsolete entries, to be removed eventually (bootstrap issues!)
+
+ High_Integrity_Mode : constant Boolean := False;
+ Long_Shifts_Inlined : constant Boolean := True;
+
+end System;
diff --git a/gcc/ada/5zintman.ads b/gcc/ada/5zintman.ads
new file mode 100644
index 00000000000..b0a4c3c5bda
--- /dev/null
+++ b/gcc/ada/5zintman.ads
@@ -0,0 +1,123 @@
+------------------------------------------------------------------------------
+-- --
+-- GNU ADA RUN-TIME LIBRARY (GNARL) COMPONENTS --
+-- --
+-- S Y S T E M . I N T E R R U P T _ M A N A G E M E N T --
+-- --
+-- S p e c --
+-- --
+-- Copyright (C) 1992-2003 Free Software Foundation, Inc. --
+-- --
+-- GNARL 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 2, or (at your option) any later ver- --
+-- sion. GNARL 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. See the GNU General Public License --
+-- for more details. You should have received a copy of the GNU General --
+-- Public License distributed with GNARL; see file COPYING. If not, write --
+-- to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, --
+-- MA 02111-1307, USA. --
+-- --
+-- As a special exception, if other files instantiate generics from this --
+-- unit, or you link this unit with other files to produce an executable, --
+-- this unit does not by itself cause the resulting executable to be --
+-- covered by the GNU General Public License. This exception does not --
+-- however invalidate any other reasons why the executable file might be --
+-- covered by the GNU Public License. --
+-- --
+-- GNARL was developed by the GNARL team at Florida State University. --
+-- Extensive contributions were provided by Ada Core Technologies, Inc. --
+-- --
+------------------------------------------------------------------------------
+
+-- This is the VxWorks version of this package.
+
+-- This package encapsulates and centralizes information about all
+-- uses of interrupts (or signals), including the target-dependent
+-- mapping of interrupts (or signals) to exceptions.
+
+-- Unlike the original design, System.Interrupt_Management can only
+-- be used for tasking systems.
+
+-- PLEASE DO NOT remove the Elaborate_Body pragma from this package.
+-- Elaboration of this package should happen early, as most other
+-- initializations depend on it. Forcing immediate elaboration of
+-- the body also helps to enforce the design assumption that this
+-- is a second-level package, just one level above System.OS_Interface
+-- with no cross-dependencies.
+
+-- PLEASE DO NOT put any subprogram declarations with arguments of
+-- type Interrupt_ID into the visible part of this package. The type
+-- Interrupt_ID is used to derive the type in Ada.Interrupts, and
+-- adding more operations to that type would be illegal according
+-- to the Ada Reference Manual. This is the reason why the signals
+-- sets are implemeneted using visible arrays rather than functions.
+
+with System.OS_Interface;
+-- used for sigset_t
+
+with Interfaces.C;
+-- used for int
+
+package System.Interrupt_Management is
+
+ pragma Elaborate_Body;
+
+ type Interrupt_Mask is limited private;
+
+ type Interrupt_ID is new Interfaces.C.int
+ range 0 .. System.OS_Interface.Max_Interrupt;
+
+ type Interrupt_Set is array (Interrupt_ID) of Boolean;
+
+ subtype Signal_ID is Interrupt_ID
+ range 0 .. Interfaces.C."-" (System.OS_Interface.NSIG, 1);
+
+ type Signal_Set is array (Signal_ID) of Boolean;
+
+ -- The following objects serve as constants, but are initialized
+ -- in the body to aid portability. This permits us to use more
+ -- portable names for interrupts, where distinct names may map to
+ -- the same interrupt ID value.
+ --
+ -- For example, suppose SIGRARE is a signal that is not defined on
+ -- all systems, but is always reserved when it is defined. If we
+ -- have the convention that ID zero is not used for any "real"
+ -- signals, and SIGRARE = 0 when SIGRARE is not one of the locally
+ -- supported signals, we can write
+ -- Reserved (SIGRARE) := true;
+ -- and the initialization code will be portable.
+
+ Abort_Task_Signal : Signal_ID;
+ -- The signal that is used to implement task abortion if
+ -- an interrupt is used for that purpose. This is one of the
+ -- reserved signals.
+
+ Keep_Unmasked : Signal_Set := (others => False);
+ -- Keep_Unmasked (I) is true iff the signal I is one that must
+ -- that must be kept unmasked at all times, except (perhaps) for
+ -- short critical sections. This includes signals that are
+ -- mapped to exceptions, but may also include interrupts
+ -- (e.g. timer) that need to be kept unmasked for other
+ -- reasons. Where signal masking is per-task, the signal should be
+ -- unmasked in ALL TASKS.
+
+ Reserve : Interrupt_Set := (others => False);
+ -- Reserve (I) is true iff the interrupt I is one that cannot be
+ -- permitted to be attached to a user handler. The possible reasons
+ -- are many. For example, it may be mapped to an exception used to
+ -- implement task abortion, or used to implement time delays.
+
+ procedure Initialize_Interrupts;
+ -- On systems where there is no signal inheritance between tasks (e.g
+ -- VxWorks, GNU/LinuxThreads), this procedure is used to initialize
+ -- interrupts handling in each task. Otherwise this function should
+ -- only be called by initialize in this package body.
+
+private
+ type Interrupt_Mask is new System.OS_Interface.sigset_t;
+ -- In some implementation Interrupt_Mask can be represented
+ -- as a linked list.
+
+end System.Interrupt_Management;
diff --git a/gcc/config/mips/irix6-crti.asm b/gcc/config/mips/irix6-crti.asm
new file mode 100644
index 00000000000..5d8ede70390
--- /dev/null
+++ b/gcc/config/mips/irix6-crti.asm
@@ -0,0 +1,33 @@
+ .abicalls
+ .set noreorder
+ .set nomacro
+
+ .section .init,0x1,0x6,4,4
+ jr $31
+ nop
+
+ .globl __gcc_init
+__gcc_init:
+#if _MIPS_SIM == _ABIO32
+ addiu $sp,$sp,-16
+ sw $31,0($sp)
+#else
+ daddiu $sp,$sp,-16
+ sd $31,0($sp)
+ sd $28,8($sp)
+#endif
+
+ .section .fini,0x1,0x6,4,4
+ jr $31
+ nop
+
+ .globl __gcc_fini
+__gcc_fini:
+#if _MIPS_SIM == _ABIO32
+ addiu $sp,$sp,-16
+ sw $31,0($sp)
+#else
+ daddiu $sp,$sp,-16
+ sd $31,0($sp)
+ sd $28,8($sp)
+#endif
diff --git a/gcc/config/mips/irix6-crtn.asm b/gcc/config/mips/irix6-crtn.asm
new file mode 100644
index 00000000000..647e8e13e31
--- /dev/null
+++ b/gcc/config/mips/irix6-crtn.asm
@@ -0,0 +1,27 @@
+ .abicalls
+ .set noreorder
+ .set nomacro
+
+ .section .init,0x1,0x6,4,4
+#if _MIPS_SIM == _ABIO32
+ lw $31,0($sp)
+ jr $31
+ addiu $sp,$sp,16
+#else
+ ld $31,0($sp)
+ ld $28,8($sp)
+ jr $31
+ daddiu $sp,$sp,16
+#endif
+
+ .section .fini,0x1,0x6,4,4
+#if _MIPS_SIM == _ABIO32
+ lw $31,0($sp)
+ jr $31
+ addiu $sp,$sp,16
+#else
+ ld $31,0($sp)
+ ld $28,8($sp)
+ jr $31
+ daddiu $sp,$sp,16
+#endif
diff --git a/gcc/config/mips/t-iris6gld b/gcc/config/mips/t-iris6gld
new file mode 100644
index 00000000000..2926be0cb44
--- /dev/null
+++ b/gcc/config/mips/t-iris6gld
@@ -0,0 +1,9 @@
+$(T)irix6-crti.o: $(srcdir)/config/mips/irix6-crti.asm $(GCC_PASSES)
+ $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(MULTILIB_CFLAGS) $(INCLUDES) \
+ -c -o $@ -x assembler-with-cpp $<
+
+$(T)irix6-crtn.o: $(srcdir)/config/mips/irix6-crtn.asm $(GCC_PASSES)
+ $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(MULTILIB_CFLAGS) $(INCLUDES) \
+ -c -o $@ -x assembler-with-cpp $<
+
+EXTRA_MULTILIB_PARTS=crtbegin.o crtend.o irix6-crti.o irix6-crtn.o
diff --git a/gcc/config/t-slibgcc-darwin b/gcc/config/t-slibgcc-darwin
new file mode 100644
index 00000000000..f27fae4948c
--- /dev/null
+++ b/gcc/config/t-slibgcc-darwin
@@ -0,0 +1,30 @@
+# Build a shared libgcc library with the darwin linker.
+SHLIB_MINOR = 1
+SHLIB_REVISION = 0
+SHLIB_VERSTRING = -compatibility_version $(SHLIB_MINOR) -current_version $(SHLIB_MINOR).$(SHLIB_REVISION)
+SHLIB_EXT = .dylib
+SHLIB_SOLINK = @shlib_base_name@.dylib
+SHLIB_SONAME = @shlib_so_name@.$(SHLIB_MINOR).$(SHLIB_REVISION).dylib
+SHLIB_NAME = @shlib_dir@@shlib_so_name@.$(SHLIB_MINOR).$(SHLIB_REVISION).dylib
+SHLIB_MAP = @shlib_map_file@
+SHLIB_OBJS = @shlib_objs@
+SHLIB_SLIBDIR_QUAL = @shlib_slibdir_qual@
+
+SHLIB_LINK = $(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) -dynamiclib -nodefaultlibs \
+ -Wl,-install_name,$(slibdir)$(SHLIB_SLIBDIR_QUAL)/$(SHLIB_SONAME) \
+ -Wl,-flat_namespace -o $(SHLIB_NAME) \
+ $(SHLIB_VERSTRING) \
+ @multilib_flags@ $(SHLIB_OBJS) -lc && \
+ rm -f $(SHLIB_SOLINK) && \
+ $(LN_S) $(SHLIB_NAME) $(SHLIB_SOLINK)
+# $(slibdir) double quoted to protect it from expansion while building
+# libgcc.mk. We want this delayed until actual install time.
+SHLIB_INSTALL = \
+ $$(SHELL) $$(srcdir)/mkinstalldirs $$(DESTDIR)$$(slibdir)$(SHLIB_SLIBDIR_QUAL); \
+ $(INSTALL_DATA) $(SHLIB_NAME) \
+ $$(DESTDIR)$$(slibdir)$(SHLIB_SLIBDIR_QUAL)/$(SHLIB_SONAME); \
+ rm -f $$(DESTDIR)$$(slibdir)$(SHLIB_SLIBDIR_QUAL)/$(SHLIB_SOLINK); \
+ $(LN_S) $(SHLIB_SONAME) \
+ $$(DESTDIR)$$(slibdir)$(SHLIB_SLIBDIR_QUAL)/$(SHLIB_SOLINK)
+SHLIB_MKMAP = $(srcdir)/mkmap-symver.awk
+SHLIB_MAPFILES = $(srcdir)/libgcc-darwin.ver
diff --git a/gcc/libgcc-darwin.ver b/gcc/libgcc-darwin.ver
new file mode 100644
index 00000000000..5aba34efbdc
--- /dev/null
+++ b/gcc/libgcc-darwin.ver
@@ -0,0 +1,213 @@
+GCC_3.0 {
+ # libgcc1 integer symbols
+ ___absvsi2
+ ___addvsi3
+ ___ashlsi3
+ ___ashrsi3
+ ___divsi3
+ ___lshrsi3
+ ___modsi3
+ ___mulsi3
+ ___mulvsi3
+ ___negvsi2
+ ___subvsi3
+ ___udivsi3
+ ___umodsi3
+
+ # libgcc1 floating point symbols
+ ___addsf3
+ ___adddf3
+ ___addxf3
+ ___addtf3
+ ___divsf3
+ ___divdf3
+ ___divxf3
+ ___divtf3
+ ___eqsf2
+ ___eqdf2
+ ___eqxf2
+ ___eqtf2
+ ___extenddfxf2
+ ___extenddftf2
+ ___extendsfdf2
+ ___extendsfxf2
+ ___extendsftf2
+ ___fixsfsi
+ ___fixdfsi
+ ___fixxfsi
+ ___fixtfsi
+ ___floatsisf
+ ___floatsidf
+ ___floatsixf
+ ___floatsitf
+ ___gesf2
+ ___gedf2
+ ___gexf2
+ ___getf2
+ ___gtsf2
+ ___gtdf2
+ ___gtxf2
+ ___gttf2
+ ___lesf2
+ ___ledf2
+ ___lexf2
+ ___letf2
+ ___ltsf2
+ ___ltdf2
+ ___ltxf2
+ ___lttf2
+ ___mulsf3
+ ___muldf3
+ ___mulxf3
+ ___multf3
+ ___negsf2
+ ___negdf2
+ ___negxf2
+ ___negtf2
+ ___nesf2
+ ___nedf2
+ ___nexf2
+ ___netf2
+ ___subsf3
+ ___subdf3
+ ___subxf3
+ ___subtf3
+ ___truncdfsf2
+ ___truncxfsf2
+ ___trunctfsf2
+ ___truncxfdf2
+ ___trunctfdf2
+
+ # libgcc2 DImode arithmetic (for 32-bit targets).
+ ___absvdi2
+ ___addvdi3
+ ___ashldi3
+ ___ashrdi3
+ ___cmpdi2
+ ___divdi3
+ ___ffsdi2
+ ___fixdfdi
+ ___fixsfdi
+ ___fixtfdi
+ ___fixxfdi
+ ___fixunsdfdi
+ ___fixunsdfsi
+ ___fixunssfsi
+ ___fixunssfdi
+ ___fixunstfdi
+ ___fixunstfsi
+ ___fixunsxfdi
+ ___fixunsxfsi
+ ___floatdidf
+ ___floatdisf
+ ___floatdixf
+ ___floatditf
+ ___lshrdi3
+ ___moddi3
+ ___muldi3
+ ___mulvdi3
+ ___negdi2
+ ___negvdi2
+ ___subvdi3
+ ___ucmpdi2
+ ___udivdi3
+ ___udivmoddi4
+ ___umoddi3
+
+ # libgcc2 TImode arithmetic (for 64-bit targets).
+ ___ashlti3
+ ___ashrti3
+ ___cmpti2
+ ___divti3
+ ___ffsti2
+ ___fixdfti
+ ___fixsfti
+ ___fixtfti
+ ___fixxfti
+ ___lshrti3
+ ___modti3
+ ___multi3
+ ___negti2
+ ___ucmpti2
+ ___udivmodti4
+ ___udivti3
+ ___umodti3
+ ___fixunsdfti
+ ___fixunssfti
+ ___fixunstfti
+ ___fixunsxfti
+ ___floattidf
+ ___floattisf
+ ___floattixf
+ ___floattitf
+
+ # Used to deal with trampoline initialization on some platforms
+ ___clear_cache
+
+ # EH symbols
+ __Unwind_DeleteException
+ __Unwind_Find_FDE
+ __Unwind_ForcedUnwind
+ __Unwind_GetGR
+ __Unwind_GetIP
+ __Unwind_GetLanguageSpecificData
+ __Unwind_GetRegionStart
+ __Unwind_GetTextRelBase
+ __Unwind_GetDataRelBase
+ __Unwind_RaiseException
+ __Unwind_Resume
+ __Unwind_SetGR
+ __Unwind_SetIP
+ ___deregister_frame
+ ___deregister_frame_info
+ ___deregister_frame_info_bases
+ ___register_frame
+ ___register_frame_info
+ ___register_frame_info_bases
+ ___register_frame_info_table
+ ___register_frame_info_table_bases
+ ___register_frame_table
+
+ # SjLj EH symbols
+ __Unwind_SjLj_Register
+ __Unwind_SjLj_Unregister
+ __Unwind_SjLj_RaiseException
+ __Unwind_SjLj_ForcedUnwind
+ __Unwind_SjLj_Resume
+}
+
+%inherit GCC_3.3 GCC_3.0
+GCC_3.3 {
+ __Unwind_FindEnclosingFunction
+ __Unwind_GetCFA
+ __Unwind_Backtrace
+ __Unwind_Resume_or_Rethrow
+ __Unwind_SjLj_Resume_or_Rethrow
+}
+
+%inherit GCC_3.3.1 GCC_3.3
+GCC_3.3.1 {
+ __gcc_personality_sj0
+ __gcc_personality_v0
+}
+
+%inherit GCC_3.3.2 GCC_3.3.1
+GCC_3.3.2 {
+}
+
+%inherit GCC_3.4 GCC_3.3
+GCC_3.4 {
+ # bit scanning and counting built-ins
+ ___clzsi2
+ ___clzdi2
+ ___clzti2
+ ___ctzsi2
+ ___ctzdi2
+ ___ctzti2
+ ___popcountsi2
+ ___popcountdi2
+ ___popcountti2
+ ___paritysi2
+ ___paritydi2
+ ___parityti2
+}
diff --git a/gcc/testsuite/g++.dg/ext/cond1.C b/gcc/testsuite/g++.dg/ext/cond1.C
new file mode 100644
index 00000000000..ec342121edf
--- /dev/null
+++ b/gcc/testsuite/g++.dg/ext/cond1.C
@@ -0,0 +1,4 @@
+// PR c++/12515
+// { dg-do compile }
+// { dg-options "" }
+template<int> void foo() { 0 ?: 0; }
diff --git a/gcc/testsuite/g++.dg/init/cleanup1.C b/gcc/testsuite/g++.dg/init/cleanup1.C
new file mode 100644
index 00000000000..517af15c673
--- /dev/null
+++ b/gcc/testsuite/g++.dg/init/cleanup1.C
@@ -0,0 +1,16 @@
+// PR c++/13033
+
+// We failed to treat the for increment expression as a full-expression,
+// which broke gimplification.
+
+struct QDomNode {
+ virtual ~QDomNode();
+ QDomNode nextSibling() const;
+ bool isNull() const;
+};
+
+void processNode(QDomNode n)
+{
+ for (; !n.isNull(); n = n.nextSibling())
+ ;
+}
diff --git a/gcc/testsuite/g++.dg/init/cleanup2.C b/gcc/testsuite/g++.dg/init/cleanup2.C
new file mode 100644
index 00000000000..e62364be15b
--- /dev/null
+++ b/gcc/testsuite/g++.dg/init/cleanup2.C
@@ -0,0 +1,19 @@
+// PR c++/12526
+
+// We decided that the call to strcmp has no side-effects because strcmp is
+// pure, even though the first argument has side-effects. As a result, we
+// stripped the CLEANUP_POINT_EXPR. Hilarity ensued.
+
+extern "C" int strcmp (const char *, const char *);
+
+struct A {
+ A(int);
+ const char *str();
+ ~A();
+};
+
+void printQueryI()
+{
+ if(!strcmp(A(1).str(), "foo"))
+ { }
+}
diff --git a/gcc/testsuite/g++.dg/init/placement1.C b/gcc/testsuite/g++.dg/init/placement1.C
new file mode 100644
index 00000000000..382fae8ed43
--- /dev/null
+++ b/gcc/testsuite/g++.dg/init/placement1.C
@@ -0,0 +1,10 @@
+// PR c++/11266
+// We were expanding the same TARGET_EXPR twice, for placement new and
+// delete.
+
+void* operator new (__SIZE_TYPE__, void*) throw();
+void operator delete (void*, void*) throw();
+
+struct A { A(); };
+
+void foo() { new(new A)A; }
diff --git a/gcc/testsuite/g++.dg/init/placement2.C b/gcc/testsuite/g++.dg/init/placement2.C
new file mode 100644
index 00000000000..7a9d6d082ba
--- /dev/null
+++ b/gcc/testsuite/g++.dg/init/placement2.C
@@ -0,0 +1,22 @@
+// Bug: We were calling f() twice, for both the placement new and placement
+// delete calls.
+
+// { dg-do run }
+
+void* operator new (__SIZE_TYPE__ sz, void*) { return operator new (sz); }
+void operator delete (void* p, void*) { operator delete (p); }
+
+struct A { A() { throw 1; } };
+
+int c;
+void *f() { ++c; return 0; }
+
+int main()
+{
+ try
+ {
+ new (f()) A;
+ }
+ catch (...) {}
+ return c != 1;
+}
diff --git a/gcc/testsuite/g++.dg/lookup/using9.C b/gcc/testsuite/g++.dg/lookup/using9.C
new file mode 100644
index 00000000000..c62267519b0
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lookup/using9.C
@@ -0,0 +1,30 @@
+// { dg-do compile }
+// Origin: C++ Standard Draft (7.3.3/12)
+// PR c++/2294: using declarations should not conflict, but only cause
+// an ambiguous overload set to be created.
+
+namespace B {
+ void f(int); // { dg-error "note" }
+ void f(double); // { dg-error "note" }
+}
+
+namespace C {
+ void f(int); // { dg-error "note" }
+ void f(double); // { dg-error "note" }
+ void f(char); // { dg-error "note" }
+}
+
+void h()
+{
+ using B::f;
+ using C::f;
+ f('h');
+ f(1); // { dg-error "ambiguous" }
+ void f(int); // { dg-error "previous using declaration" }
+}
+
+void m()
+{
+ void f(int);
+ using B::f; // { dg-error "already declared" }
+}
diff --git a/gcc/testsuite/g++.dg/template/error3.C b/gcc/testsuite/g++.dg/template/error3.C
new file mode 100644
index 00000000000..d3ee5990850
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/error3.C
@@ -0,0 +1,5 @@
+// PR 12762
+
+template <typename> struct A { A() {}};
+typedef A<int> Ac;
+Ac<double> a; // { dg-error "template" }
diff --git a/gcc/testsuite/g++.dg/template/memfriend1.C b/gcc/testsuite/g++.dg/template/memfriend1.C
new file mode 100644
index 00000000000..f4541279c8b
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/memfriend1.C
@@ -0,0 +1,54 @@
+// { dg-do compile }
+
+// Copyright (C) 2003 Free Software Foundation
+// Contributed by Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
+
+// Member function of class template as friend
+
+template<class T> struct A
+{
+ void f();
+};
+
+class C {
+ int i;
+ template<class T> friend void A<T>::f();
+};
+
+template<class T> struct A<T*>
+{
+ void f();
+};
+
+template<> struct A<char>
+{
+ void f();
+};
+
+template<class T> void A<T>::f()
+{
+ C c;
+ c.i = 0;
+}
+
+template<class T> void A<T*>::f()
+{
+ C c;
+ c.i = 0;
+}
+
+void A<char>::f()
+{
+ C c;
+ c.i = 0;
+}
+
+int main()
+{
+ A<int> a1;
+ a1.f();
+ A<int *> a2;
+ a2.f();
+ A<char> a3;
+ a3.f();
+}
diff --git a/gcc/testsuite/g++.dg/template/memfriend2.C b/gcc/testsuite/g++.dg/template/memfriend2.C
new file mode 100644
index 00000000000..364ad7d7864
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/memfriend2.C
@@ -0,0 +1,61 @@
+// { dg-do compile }
+
+// Copyright (C) 2003 Free Software Foundation
+// Contributed by Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
+
+// Member function template of class template as friend
+
+template <class T> struct A
+{
+ template <class U> void f();
+};
+
+class C {
+ int i;
+ template <class T> template <class U> friend void A<T>::f();
+};
+
+template <class T> struct A<T*>
+{
+ template <class U> void f();
+};
+
+template <> struct A<char>
+{
+ template <class U> void f();
+};
+
+template <class T> template <class U> void A<T>::f()
+{
+ C c;
+ c.i = 0;
+}
+
+template <class T> template <class U> void A<T*>::f()
+{
+ C c;
+ c.i = 0;
+}
+
+template <class U> void A<char>::f()
+{
+ C c;
+ c.i = 0;
+}
+
+template <> void A<char>::f<int>()
+{
+ C c;
+ c.i = 0;
+}
+
+int main()
+{
+ A<int> a1;
+ a1.f<char>();
+ A<int *> a2;
+ a2.f<char>();
+ A<char> a3;
+ a3.f<char>();
+ a3.f<int>();
+}
diff --git a/gcc/testsuite/g++.dg/template/memfriend3.C b/gcc/testsuite/g++.dg/template/memfriend3.C
new file mode 100644
index 00000000000..3ea8c84cf25
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/memfriend3.C
@@ -0,0 +1,55 @@
+// { dg-do compile }
+
+// Copyright (C) 2003 Free Software Foundation
+// Contributed by Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
+
+// Member function of class template as friend
+
+template<class T> struct A
+{
+ void f(T);
+};
+
+class C {
+ int i;
+ template<class T> friend void A<T>::f(T);
+};
+
+template<class T> struct A<T*>
+{
+ void f(T*);
+};
+
+template<> struct A<char>
+{
+ void f(char);
+};
+
+template<class T> void A<T>::f(T)
+{
+ C c;
+ c.i = 0;
+}
+
+template<class T> void A<T*>::f(T*)
+{
+ C c;
+ c.i = 0;
+}
+
+void A<char>::f(char)
+{
+ C c;
+ c.i = 0;
+}
+
+int main()
+{
+ A<int> a1;
+ a1.f(0);
+ A<int *> a2;
+ int *p = 0;
+ a2.f(p);
+ A<char> a3;
+ a3.f('a');
+}
diff --git a/gcc/testsuite/g++.dg/template/memfriend4.C b/gcc/testsuite/g++.dg/template/memfriend4.C
new file mode 100644
index 00000000000..5c006fe84f3
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/memfriend4.C
@@ -0,0 +1,63 @@
+// { dg-do compile }
+
+// Copyright (C) 2003 Free Software Foundation
+// Contributed by Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
+
+// Member function of class template as friend
+
+template<class T> struct A
+{
+ template <T t> void f();
+};
+
+class C {
+ int i;
+ template<class T> template <T t> friend void A<T>::f();
+};
+
+template<class T> struct A<T*>
+{
+ template <T* t> void f();
+};
+
+template<> struct A<char>
+{
+ template <char t> void f();
+};
+
+template<class T> template <T t> void A<T>::f()
+{
+ C c;
+ c.i = 0;
+}
+
+template<class T> template <T* t> void A<T*>::f()
+{
+ C c;
+ c.i = 0;
+}
+
+template <char t> void A<char>::f()
+{
+ C c;
+ c.i = 0;
+}
+
+template <> void A<char>::f<'b'>()
+{
+ C c;
+ c.i = 0;
+}
+
+int d2 = 0;
+
+int main()
+{
+ A<int> a1;
+ a1.f<0>();
+ A<int *> a2;
+ a2.f<&d2>();
+ A<char> a3;
+ a3.f<'a'>();
+ a3.f<'b'>();
+}
diff --git a/gcc/testsuite/g++.dg/template/memfriend5.C b/gcc/testsuite/g++.dg/template/memfriend5.C
new file mode 100644
index 00000000000..38c2fb93fad
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/memfriend5.C
@@ -0,0 +1,31 @@
+// { dg-do compile }
+
+// Copyright (C) 2003 Free Software Foundation
+// Contributed by Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
+
+// Member template function of member class template as friend
+
+template <class T> struct A {
+ template <class U> struct B {
+ template <class V> void f(V);
+ };
+};
+
+class X {
+ int i;
+ template <class T> template <class U> template <class V>
+ friend void A<T>::B<U>::f(V);
+};
+
+template <class T> template <class U> template <class V>
+ void A<T>::B<U>::f(V)
+{
+ X x;
+ x.i = 0;
+}
+
+int main()
+{
+ A<char>::B<char> a1;
+ a1.f(0);
+}
diff --git a/gcc/testsuite/g++.dg/template/memfriend6.C b/gcc/testsuite/g++.dg/template/memfriend6.C
new file mode 100644
index 00000000000..21d799605ec
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/memfriend6.C
@@ -0,0 +1,23 @@
+// { dg-do compile }
+
+// Copyright (C) 2003 Free Software Foundation
+// Contributed by Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
+
+// Member function of class template as friend
+// Erroneous case: mismatch during declaration
+
+template <class T> struct A {
+ template <class U> void f(U); // { dg-error "candidate" }
+ void g(); // { dg-error "candidate" }
+ void h(); // { dg-error "candidate" }
+ void i(int); // { dg-error "candidate" }
+};
+
+class C {
+ int ii;
+ template <class U> friend void A<U>::f(U); // { dg-error "not match" }
+ template <class U> template <class V>
+ friend void A<U>::g(); // { dg-error "not match" }
+ template <class U> friend int A<U>::h(); // { dg-error "not match" }
+ template <class U> friend void A<U>::i(char); // { dg-error "not match" }
+};
diff --git a/gcc/testsuite/g++.dg/template/memfriend7.C b/gcc/testsuite/g++.dg/template/memfriend7.C
new file mode 100644
index 00000000000..aed029500af
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/memfriend7.C
@@ -0,0 +1,133 @@
+// { dg-do compile }
+
+// Copyright (C) 2003 Free Software Foundation
+// Contributed by Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
+
+// Member function of class template as friend
+// Erroneous case: mismatch during specialization
+
+template <class T> struct A {
+ template <class U> void f(U);
+ void g();
+ void h();
+ void i(int);
+ template <T t> void j();
+};
+
+class C {
+ int ii; // { dg-error "private" }
+ template <class U> template <class V>
+ friend void A<U>::f(V);
+ template <class U> friend void A<U>::g();
+ template <class U> friend void A<U>::h();
+ template <class U> friend void A<U>::i(int);
+ template <class U> template <U t>
+ friend void A<U>::j();
+};
+
+template <class T> struct A<T*> {
+ void f(int);
+ template <class U> void g();
+ int h();
+ void i(char);
+ template <int> void j();
+};
+
+template <class T> void A<T*>::f(int)
+{
+ C c;
+ c.ii = 0; // { dg-error "context" }
+}
+
+template <class T> template <class U> void A<T*>::g()
+{
+ C c;
+ c.ii = 0; // { dg-error "context" }
+}
+
+template <class T> int A<T*>::h()
+{
+ C c;
+ c.ii = 0; // { dg-error "context" }
+}
+
+template <class T> void A<T*>::i(char)
+{
+ C c;
+ c.ii = 0; // { dg-error "context" }
+}
+
+template <class T> template <int> void A<T*>::j()
+{
+ C c;
+ c.ii = 0; // { dg-error "context" }
+}
+
+template <> struct A<char> {
+ void f(int);
+ template <class U> void g();
+ int h();
+ void i(char);
+ template <int> void j();
+};
+
+void A<char>::f(int)
+{
+ C c;
+ c.ii = 0; // { dg-error "context" }
+}
+
+template <class U> void A<char>::g()
+{
+ C c;
+ c.ii = 0; // { dg-error "context" }
+}
+
+template <> void A<char>::g<int>()
+{
+ C c;
+ c.ii = 0; // { dg-error "context" }
+}
+
+int A<char>::h()
+{
+ C c;
+ c.ii = 0; // { dg-error "context" }
+}
+
+void A<char>::i(char)
+{
+ C c;
+ c.ii = 0; // { dg-error "context" }
+}
+
+template <int> void A<char>::j()
+{
+ C c;
+ c.ii = 0; // { dg-error "context" }
+}
+
+template <> void A<char>::j<0>()
+{
+ C c;
+ c.ii = 0; // { dg-error "context" }
+}
+
+int main()
+{
+ A<int *> a1;
+ a1.f(0); // { dg-error "instantiated" }
+ a1.g<char>(); // { dg-error "instantiated" }
+ a1.g<int>(); // { dg-error "instantiated" }
+ a1.h(); // { dg-error "instantiated" }
+ a1.i('a'); // { dg-error "instantiated" }
+ a1.j<1>(); // { dg-error "instantiated" }
+ A<char> a2;
+ a2.f(0);
+ a2.g<char>(); // { dg-error "instantiated" }
+ a2.g<int>();
+ a2.h();
+ a2.i('a');
+ a2.j<1>(); // { dg-error "instantiated" }
+ a2.j<0>();
+}
diff --git a/gcc/testsuite/g++.dg/template/memfriend8.C b/gcc/testsuite/g++.dg/template/memfriend8.C
new file mode 100644
index 00000000000..886096b9d54
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/memfriend8.C
@@ -0,0 +1,25 @@
+// { dg-do compile }
+
+// Origin: Martin Sebor <sebor@roguewave.com>
+
+// PR c++/5369: Member function of class template as friend
+
+template <class T>
+struct S
+{
+ int foo () {
+ return S<int>::bar ();
+ }
+
+private:
+
+ template <class U>
+ friend int S<U>::foo ();
+
+ static int bar () { return 0; }
+};
+
+int main ()
+{
+ S<char>().foo ();
+}
diff --git a/gcc/testsuite/g++.dg/template/static5.C b/gcc/testsuite/g++.dg/template/static5.C
new file mode 100644
index 00000000000..05eaf8fbd55
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/static5.C
@@ -0,0 +1,17 @@
+// { dg-do compile }
+
+// Origin: Mirek Fidler <cxl@ntllib.org>
+// Wolfgang Bangerth <bangerth@ticam.utexas.edu>
+
+// PR c++/12932: ICE address of static function as template argument
+
+struct Test {
+ static void fun();
+};
+
+template <void (*fun)()>
+void foo () { (*fun)(); }
+
+
+template
+void foo<Test::fun> ();
diff --git a/gcc/testsuite/g++.dg/template/template-id-2.C b/gcc/testsuite/g++.dg/template/template-id-2.C
new file mode 100644
index 00000000000..1bc378c14e6
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/template-id-2.C
@@ -0,0 +1,22 @@
+// { dg-do compile }
+
+// Origin: Richard Guenther <rguenth@tat.physik.uni-tuebingen.de>
+
+// PR c++/12924
+
+template<typename> struct A {};
+
+template<> struct A<void>
+{
+ template<typename T> void foo()
+ {
+ A<T> a;
+ a.template foo<int>(); // { dg-error "no member" }
+ }
+};
+
+void bar()
+{
+ A<void> a;
+ a.foo<int>(); // { dg-error "instantiated" }
+}
diff --git a/gcc/testsuite/gcc.dg/cpp/assert4.c b/gcc/testsuite/gcc.dg/cpp/assert4.c
new file mode 100644
index 00000000000..557d1c0ec28
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/cpp/assert4.c
@@ -0,0 +1,372 @@
+/* Copyright (C) 2003 Free Software Foundation, Inc.
+ Test builtin preprocessor assertions.
+ By Kaveh Ghazi <ghazi@caip.rutgers.edu>. */
+
+/* { dg-do preprocess } */
+
+/* Check for #system assertions. */
+
+#if defined __gnu_linux__
+# if !#system(linux) || !#system(unix) || !#system(posix)
+# error
+# endif
+#elif #system(linux)
+# error
+#endif
+
+#if defined __gnu_hurd__
+# if !#system(gnu) || !#system(unix) || !#system(posix)
+# error
+# endif
+#elif #system(gnu)
+# error
+#endif
+
+#if defined __FreeBSD__
+# if !#system(FreeBSD) || !#system(unix) || !#system(bsd)
+# error
+# endif
+#elif #system(FreeBSD)
+# error
+#endif
+
+#if defined __NetBSD__
+# if !#system(NetBSD) || !#system(unix) || !#system(bsd)
+# error
+# endif
+#elif #system(NetBSD)
+# error
+#endif
+
+#if defined __OpenBSD__
+# if !#system(OpenBSD) || !#system(unix) || !#system(bsd)
+# error
+# endif
+#elif #system(OpenBSD)
+# error
+#endif
+
+#if defined __svr4__ || defined __SYSTYPE_SVR4__
+# if !#system(svr4) || !#system(unix)
+# error
+# endif
+#elif #system(svr4)
+# error
+#endif
+
+#if defined __hpux__
+# if !#system(hpux) || !#system(unix)
+# error
+# endif
+#elif #system(hpux)
+# error
+#endif
+
+#if defined _AIX
+# if !#system(aix) || !#system(unix)
+# error
+# endif
+#elif #system(aix)
+# error
+#endif
+
+#if defined __lynx__
+# if !#system(lynx) || !#system(unix)
+# error
+# endif
+#elif #system(lynx)
+# error
+#endif
+
+#if defined __rtems__
+# if !#system(rtems)
+# error
+# endif
+#elif #system(rtems)
+# error
+#endif
+
+
+/* Check for #cpu and #machine assertions. */
+
+#if defined __arc__
+# if !#cpu(arc) || !#machine(arc)
+# error
+# endif
+#elif #cpu(arc) || #machine(arc)
+# error
+#endif
+
+#if defined __alpha__
+# if !#cpu(alpha) || !#machine(alpha) \
+ || (defined __alpha_cix__ && !#cpu(cix)) \
+ || (!defined __alpha_cix__ && #cpu(cix)) \
+ || (defined __alpha_fix__ && !#cpu(fix)) \
+ || (!defined __alpha_fix__ && #cpu(fix)) \
+ || (defined __alpha_bwx__ && !#cpu(bwx)) \
+ || (!defined __alpha_bwx__ && #cpu(bwx)) \
+ || (defined __alpha_max__ && !#cpu(max)) \
+ || (!defined __alpha_max__ && #cpu(max)) \
+ || (defined __alpha_ev6__ && !#cpu(ev6)) \
+ || (!defined __alpha_ev6__ && #cpu(ev6)) \
+ || (defined __alpha_ev5__ && !#cpu(ev5)) \
+ || (!defined __alpha_ev5__ && #cpu(ev5)) \
+ || (defined __alpha_ev4__ && !#cpu(ev4)) \
+ || (!defined __alpha_ev4__ && #cpu(ev4))
+# error
+# endif
+#elif #cpu(alpha) || #machine(alpha) || #cpu(cix) || #cpu(fix) || #cpu(bwx) \
+ || #cpu(max) || #cpu(ev6) || #cpu(ev5) || #cpu(ev4)
+# error
+#endif
+
+#if defined __arm__
+# if !#cpu(arm) || !#machine(arm)
+# error
+# endif
+#elif #cpu(arm) || #machine(arm)
+# error
+#endif
+
+#if defined __d30v__
+# if !#cpu(d30v) || !#machine(d30v)
+# error
+# endif
+#elif #cpu(d30v) || #machine(d30v)
+# error
+#endif
+
+#if defined __fr30__
+# if !#cpu(fr30) || !#machine(fr30)
+# error
+# endif
+#elif #cpu(fr30) || #machine(fr30)
+# error
+#endif
+
+#if defined __frv__
+# if !#cpu(frv) || !#machine(frv)
+# error
+# endif
+#elif #cpu(frv) || #machine(frv)
+# error
+#endif
+
+#if defined __h8300__
+# if !#cpu(h8300) || !#machine(h8300) \
+ || (defined __H8300__ && (!#cpu(h8300) || !#machine(h8300))) \
+ || (defined __H8300H__ && (!#cpu(h8300h) || !#machine(h8300h))) \
+ || (!defined __H8300H__ && (#cpu(h8300h) || #machine(h8300h))) \
+ || (defined __H8300S__ && (!#cpu(h8300s) || !#machine(h8300s))) \
+ || (!defined __H8300S__ && (#cpu(h8300s) || #machine(h8300s)))
+# error
+# endif
+#elif #cpu(h8300) || #machine(h8300) || #cpu(h8300h) || #machine(h8300h) || \
+ #cpu(h8300s) || #machine(h8300s)
+# error
+#endif
+
+#if defined __hppa__
+# if !#cpu(hppa) || !#machine(hppa)
+# error
+# endif
+#elif #cpu(hppa) || #machine(hppa)
+# error
+#endif
+
+#if defined __i370__
+# if !#cpu(i370) || !#machine(i370)
+# error
+# endif
+#elif #cpu(i370) || #machine(i370)
+# error
+#endif
+
+#if defined __x86_64__
+# if !#cpu(x86_64) || !#machine(x86_64)
+# error
+# endif
+#elif #cpu(x86_64) || #machine(x86_64)
+# error
+#endif
+
+#if defined __i386__
+# if !#cpu(i386) || !#machine(i386)
+# error
+# endif
+#elif #cpu(i386) || #machine(i386)
+# error
+#endif
+
+#if defined __i860__
+# if !#cpu(i860) || !#machine(i860)
+# error
+# endif
+#elif #cpu(i860) || #machine(i860)
+# error
+#endif
+
+#if defined __i960__
+# if !#cpu(i960) || !#machine(i960)
+# error
+# endif
+#elif #cpu(i960) || #machine(i960)
+# error
+#endif
+
+#if defined __ia64__
+# if !#cpu(ia64) || !#machine(ia64)
+# error
+# endif
+#elif #cpu(ia64) || #machine(ia64)
+# error
+#endif
+
+#if defined __iq2000__
+# if !#cpu(iq2000) || !#machine(iq2000)
+# error
+# endif
+#elif #cpu(iq2000) || #machine(iq2000)
+# error
+#endif
+
+#if defined __M32R__
+# if !#cpu(m32r) || !#machine(m32r)
+# error
+# endif
+#elif #cpu(m32r) || #machine(m32r)
+# error
+#endif
+
+#if defined __m68k__
+# if !#cpu(m68k) || !#machine(m68k)
+# error
+# endif
+#elif #cpu(m68k) || #machine(m68k)
+# error
+#endif
+
+#if defined __mcore__
+# if !#cpu(mcore) || !#machine(mcore)
+# error
+# endif
+#elif #cpu(mcore) || #machine(mcore)
+# error
+#endif
+
+#if defined __mips__
+# if !#cpu(mips) || (defined __sgi__ && !#machine(sgi)) \
+ || (!defined __sgi__ && !#machine(mips))
+# error
+# endif
+#elif #cpu(mips) || #machine(sgi) || #machine(mips)
+# error
+#endif
+
+#if defined __mmix__
+# if !#cpu(mmix) || !#machine(mmix)
+# error
+# endif
+#elif #cpu(mmix) || #machine(mcore)
+# error
+#endif
+
+#if defined __mn10300__
+# if !#cpu(mn10300) || !#machine(mn10300)
+# error
+# endif
+#elif #cpu(mn10300) || #machine(mn10300)
+# error
+#endif
+
+#if defined __ns32k__
+# if !#cpu(ns32k) || !#machine(ns32k)
+# error
+# endif
+#elif #cpu(ns32k) || #machine(ns32k)
+# error
+#endif
+
+#if defined __pdp11__
+# if !#cpu(pdp11) || !#machine(pdp11)
+# error
+# endif
+#elif #cpu(pdp11) || #machine(pdp11)
+# error
+#endif
+
+#if defined __powerpc__
+# if !#cpu(powerpc) || !#machine(powerpc)
+# error
+# endif
+#elif #cpu(powerpc) || #machine(powerpc)
+# error
+#endif
+
+#if defined __rs6000__
+# if !#cpu(rs6000) || !#machine(rs6000)
+# error
+# endif
+#elif #cpu(rs6000) || #machine(rs6000)
+# error
+#endif
+
+#if defined __s390__
+# if !#cpu(s390) || !#machine(s390)
+# error
+# endif
+#elif #cpu(s390) || #machine(s390)
+# error
+#endif
+
+#if defined __sh__
+# if !#cpu(sh) || !#machine(sh)
+# error
+# endif
+#elif #cpu(sh) || #machine(sh)
+# error
+#endif
+
+#if defined __sparc__
+# if (defined __arch64__ \
+ && (!#cpu(sparc64) || !#machine(sparc64) || #cpu(sparc) || #machine(sparc)))
+ || (!defined __arch64__ \
+ && (#cpu(sparc64) || #machine(sparc64) || !#cpu(sparc) || !#machine(sparc)))
+# error
+# endif
+#elif #cpu(sparc64) || #machine(sparc64) || #cpu(sparc) || #machine(sparc)
+# error
+#endif
+
+#if defined __xstormy16__
+# if !#cpu(xstormy16) || !#machine(xstormy16)
+# error
+# endif
+#elif #cpu(xstormy16) || #machine(xstormy16)
+# error
+#endif
+
+#if defined __v850__
+# if !#cpu(v850) || !#machine(v850)
+# error
+# endif
+#elif #cpu(v850) || #machine(v850)
+# error
+#endif
+
+#if defined __vax__
+# if !#cpu(vax) || !#machine(vax)
+# error
+# endif
+#elif #cpu(vax) || #machine(vax)
+# error
+#endif
+
+#if defined __XTENSA__
+# if !#cpu(xtensa) || !#machine(xtensa)
+# error
+# endif
+#elif #cpu(xtensa) || #machine(xtensa)
+# error
+#endif
+
diff --git a/gcc/testsuite/gcc.dg/cpp/trad/xwin1.c b/gcc/testsuite/gcc.dg/cpp/trad/xwin1.c
new file mode 100644
index 00000000000..21220d1db68
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/cpp/trad/xwin1.c
@@ -0,0 +1,13 @@
+/* XWindows (as of 4.3) does some pretty strange things with cpp.
+ This tests one of them; the leading comments are supposed to be
+ eaten by the preprocessor; but the 'directives' after them are
+ supposed to be retained as text, not processed, so that imake's cpp
+ can be run on the output!
+ { dg-do preprocess }
+*/
+
+/**/#if 0
+passed
+/**/#endif
+
+/* { dg-final { scan-file xwin1.i "(^|\n)#if 0" } } */
diff --git a/gcc/testsuite/gcc.dg/nested-func-1.c b/gcc/testsuite/gcc.dg/nested-func-1.c
new file mode 100644
index 00000000000..cb26e895e5c
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/nested-func-1.c
@@ -0,0 +1,35 @@
+/* Test for proper errors for break and continue in nested functions. */
+/* Origin: Joseph Myers <jsm@polyomino.org.uk> */
+/* { dg-do compile } */
+/* { dg-options "" } */
+
+void
+foo (int a)
+{
+ switch (a) {
+ void bar1 (void) { break; } /* { dg-error "break statement" "break switch 1" } */
+ }
+ switch (a) {
+ case 0:
+ (void) 0;
+ void bar2 (void) { break; } /* { dg-error "break statement" "break switch 2" } */
+ }
+ while (1) {
+ void bar3 (void) { break; } /* { dg-error "break statement" "break while" } */
+ }
+ do {
+ void bar4 (void) { break; } /* { dg-error "break statement" "break do" } */
+ } while (1);
+ for (;;) {
+ void bar5 (void) { break; } /* { dg-error "break statement" "break for" } */
+ }
+ while (1) {
+ void bar6 (void) { continue; } /* { dg-error "continue statement" "continue while" } */
+ }
+ do {
+ void bar7 (void) { continue; } /* { dg-error "continue statement" "continue do" } */
+ } while (1);
+ for (;;) {
+ void bar8 (void) { continue; } /* { dg-error "continue statement" "continue for" } */
+ }
+}
diff --git a/libjava/gnu/java/awt/peer/gtk/GdkClasspathFontPeerMetrics.java b/libjava/gnu/java/awt/peer/gtk/GdkClasspathFontPeerMetrics.java
new file mode 100644
index 00000000000..2f019e4dbc4
--- /dev/null
+++ b/libjava/gnu/java/awt/peer/gtk/GdkClasspathFontPeerMetrics.java
@@ -0,0 +1,116 @@
+/* GdkClasspathFontPeerMetrics.java
+ Copyright (C) 1999, 2002 Free Software Foundation, Inc.
+
+ This file is part of GNU Classpath.
+
+ GNU Classpath 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, or (at your option)
+ any later version.
+
+ GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
+ Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA.
+
+ Linking this library statically or dynamically with other modules is
+ making a combined work based on this library. Thus, the terms and
+ conditions of the GNU General Public License cover the whole
+ combination.
+
+ As a special exception, the copyright holders of this library give you
+ permission to link this library with independent modules to produce an
+ executable, regardless of the license terms of these independent
+ modules, and to copy and distribute the resulting executable under
+ terms of your choice, provided that you also meet, for each linked
+ independent module, the terms and conditions of the license of that
+ module. An independent module is a module which is not derived from
+ or based on this library. If you modify this library, you may extend
+ this exception to your version of the library, but you are not
+ obligated to do so. If you do not wish to do so, delete this
+ exception statement from your version. */
+
+
+package gnu.java.awt.peer.gtk;
+
+import java.awt.*;
+import java.awt.font.*;
+import java.awt.geom.*;
+
+public class GdkClasspathFontPeerMetrics extends FontMetrics
+{
+ private final int native_state = GtkGenericPeer.getUniqueInteger();
+
+ private static final int ASCENT = 0, MAX_ASCENT = 1,
+ DESCENT = 2, MAX_DESCENT = 3,
+ MAX_ADVANCE = 4;
+
+ private int[] metrics;
+ private native int[] initState (Object font);
+
+ public GdkClasspathFontPeerMetrics (Font font)
+ {
+ super (font);
+ metrics = initState (font.getPeer());
+ }
+
+ public int stringWidth (String str)
+ {
+ GlyphVector gv = font.createGlyphVector
+ (new FontRenderContext
+ (new AffineTransform (), false, false), str);
+ Rectangle2D r = gv.getVisualBounds ();
+ return (int) r.getWidth ();
+ }
+
+ public int charWidth (char ch)
+ {
+ return stringWidth (new String (new char[] { ch }));
+ }
+
+ public int charsWidth (char data[], int off, int len)
+ {
+ return stringWidth (new String (data, off, len));
+ }
+
+ /*
+ Sun's Motif implementation always returns 0 or 1 here (???), but
+ going by the X11 man pages, it seems as though we should return
+ font.ascent + font.descent.
+ */
+ public int getLeading ()
+ {
+ return 1;
+// return metrics[ASCENT] + metrics[DESCENT];
+ }
+
+ public int getAscent ()
+ {
+ return metrics[ASCENT];
+ }
+
+ public int getMaxAscent ()
+ {
+ return metrics[MAX_ASCENT];
+ }
+
+ public int getDescent ()
+ {
+ return metrics[DESCENT];
+ }
+
+ public int getMaxDescent ()
+ {
+ return metrics[MAX_DESCENT];
+ }
+
+ public int getMaxAdvance ()
+ {
+ return metrics[MAX_ADVANCE];
+ }
+}
diff --git a/libjava/java/awt/geom/doc-files/FlatteningPathIterator-1.html b/libjava/java/awt/geom/doc-files/FlatteningPathIterator-1.html
new file mode 100644
index 00000000000..5a52d693edd
--- /dev/null
+++ b/libjava/java/awt/geom/doc-files/FlatteningPathIterator-1.html
@@ -0,0 +1,481 @@
+<?xml version="1.0" encoding="US-ASCII"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+ <title>The GNU Implementation of java.awt.geom.FlatteningPathIterator</title>
+ <meta name="author" content="Sascha Brawer" />
+ <style type="text/css"><!--
+ td { white-space: nowrap; }
+ li { margin: 2mm 0; }
+ --></style>
+</head>
+<body>
+
+<h1>The GNU Implementation of FlatteningPathIterator</h1>
+
+<p><i><a href="http://www.dandelis.ch/people/brawer/">Sascha
+Brawer</a>, November 2003</i></p>
+
+<p>This document describes the GNU implementation of the class
+<code>java.awt.geom.FlatteningPathIterator</code>. It does
+<em>not</em> describe how a programmer should use this class; please
+refer to the generated API documentation for this purpose. Instead, it
+is intended for maintenance programmers who want to understand the
+implementation, for example because they want to extend the class or
+fix a bug.</p>
+
+
+<h2>Data Structures</h2>
+
+<p>The algorithm uses a stack. Its allocation is delayed to the time
+when the source path iterator actually returns the first curved
+segment (either <code>SEG_QUADTO</code> or <code>SEG_CUBICTO</code>).
+If the input path does not contain any curved segments, the value of
+the <code>stack</code> variable stays <code>null</code>. In this quite
+common case, the memory consumption is minimal.</p>
+
+<dl><dt><code>stack</code></dt><dd>The variable <code>stack</code> is
+a <code>double</code> array that holds the start, control and end
+points of individual sub-segments.</dd>
+
+<dt><code>recLevel</code></dt><dd>The variable <code>recLevel</code>
+holds how many recursive sub-divisions were needed to calculate a
+segment. The original curve has recursion level 0. For each
+sub-division, the corresponding recursion level is increased by
+one.</dd>
+
+<dt><code>stackSize</code></dt><dd>Finally, the variable
+<code>stackSize</code> indicates how many sub-segments are stored on
+the stack.</dd></dl>
+
+<h2>Algorithm</h2>
+
+<p>The implementation separately processes each segment that the
+base iterator returns.</p>
+
+<p>In the case of <code>SEG_CLOSE</code>,
+<code>SEG_MOVETO</code> and <code>SEG_LINETO</code> segments, the
+implementation simply hands the segment to the consumer, without actually
+doing anything.</p>
+
+<p>Any <code>SEG_QUADTO</code> and <code>SEG_CUBICTO</code> segments
+need to be flattened. Flattening is performed with a fixed-sized
+stack, holding the coordinates of subdivided segments. When the base
+iterator returns a <code>SEG_QUADTO</code> and
+<code>SEG_CUBICTO</code> segments, it is recursively flattened as
+follows:</p>
+
+<ol><li>Intialization: Allocate memory for the stack (unless a
+sufficiently large stack has been allocated previously). Push the
+original quadratic or cubic curve onto the stack. Mark that segment as
+having a <code>recLevel</code> of zero.</li>
+
+<li>If the stack is empty, flattening the segment is complete,
+and the next segment is fetched from the base iterator.</li>
+
+<li>If the stack is not empty, pop a curve segment from the
+stack.
+
+ <ul><li>If its <code>recLevel</code> exceeds the recursion limit,
+ hand the current segment to the consumer.</li>
+
+ <li>Calculate the squared flatness of the segment. If it smaller
+ than <code>flatnessSq</code>, hand the current segment to the
+ consumer.</li>
+
+ <li>Otherwise, split the segment in two halves. Push the right
+ half onto the stack. Then, push the left half onto the stack.
+ Continue with step two.</li></ul></li>
+</ol>
+
+<p>The implementation is slightly complicated by the fact that
+consumers <em>pull</em> the flattened segments from the
+<code>FlatteningPathIterator</code>. This means that we actually
+cannot &#x201c;hand the curent segment over to the consumer.&#x201d;
+But the algorithm is easier to understand if one assumes a
+<em>push</em> paradigm.</p>
+
+
+<h2>Example</h2>
+
+<p>The following example shows how a
+<code>FlatteningPathIterator</code> processes a
+<code>SEG_QUADTO</code> segment. It is (arbitrarily) assumed that the
+recursion limit was set to 2.</p>
+
+<blockquote>
+<table border="1" cellspacing="0" cellpadding="8">
+ <tr align="center" valign="baseline">
+ <th></th><th>A</th><th>B</th><th>C</th>
+ <th>D</th><th>E</th><th>F</th><th>G</th><th>H</th>
+ </tr>
+ <tr align="center" valign="baseline">
+ <th><code>stack[0]</code></th>
+ <td>&#x2014;</td>
+ <td>&#x2014;</td>
+ <td><i>S<sub>ll</sub>.x</i></td>
+ <td>&#x2014;</td>
+ <td>&#x2014;</td>
+ <td>&#x2014;</td>
+ <td>&#x2014;</td>
+ <td>&#x2014;</td>
+ </tr>
+ <tr align="center" valign="baseline">
+ <th><code>stack[1]</code></th>
+ <td>&#x2014;</td>
+ <td>&#x2014;</td>
+ <td><i>S<sub>ll</sub>.y</i></td>
+ <td>&#x2014;</td>
+ <td>&#x2014;</td>
+ <td>&#x2014;</td>
+ <td>&#x2014;</td>
+ <td>&#x2014;</td>
+ </tr>
+ <tr align="center" valign="baseline">
+ <th><code>stack[2]</code></th>
+ <td>&#x2014;</td>
+ <td>&#x2014;</td>
+ <td><i>C<sub>ll</sub>.x</i></td>
+ <td>&#x2014;</td>
+ <td>&#x2014;</td>
+ <td>&#x2014;</td>
+ <td>&#x2014;</td>
+ <td>&#x2014;</td>
+ </tr>
+ <tr align="center" valign="baseline">
+ <th><code>stack[3]</code></th>
+ <td>&#x2014;</td>
+ <td>&#x2014;</td>
+ <td><i>C<sub>ll</sub>.y</i></td>
+ <td>&#x2014;</td>
+ <td>&#x2014;</td>
+ <td>&#x2014;</td>
+ <td>&#x2014;</td>
+ <td>&#x2014;</td>
+ </tr>
+ <tr align="center" valign="baseline">
+ <th><code>stack[4]</code></th>
+ <td>&#x2014;</td>
+ <td><i>S<sub>l</sub>.x</i></td>
+ <td><i>E<sub>ll</sub>.x</i>
+ = <i>S<sub>lr</sub>.x</i></td>
+ <td><i>S<sub>lr</sub>.x</i></td>
+ <td>&#x2014;</td>
+ <td><i>S<sub>rl</sub>.x</i></td>
+ <td>&#x2014;</td>
+ <td>&#x2014;</td>
+ </tr>
+ <tr align="center" valign="baseline">
+ <th><code>stack[5]</code></th>
+ <td>&#x2014;</td>
+ <td><i>S<sub>l</sub>.y</i></td>
+ <td><i>E<sub>ll</sub>.x</i>
+ = <i>S<sub>lr</sub>.y</i></td>
+ <td><i>S<sub>lr</sub>.y</i></td>
+ <td>&#x2014;</td>
+ <td><i>S<sub>rl</sub>.y</i></td>
+ <td>&#x2014;</td>
+ <td>&#x2014;</td>
+ </tr>
+ <tr align="center" valign="baseline">
+ <th><code>stack[6]</code></th>
+ <td>&#x2014;</td>
+ <td><i>C<sub>l</sub>.x</i></td>
+ <td><i>C<sub>lr</sub>.x</i></td>
+ <td><i>C<sub>lr</sub>.x</i></td>
+ <td>&#x2014;</td>
+ <td><i>C<sub>rl</sub>.x</i></td>
+ <td>&#x2014;</td>
+ <td>&#x2014;</td>
+ </tr>
+ <tr align="center" valign="baseline">
+ <th><code>stack[7]</code></th>
+ <td>&#x2014;</td>
+ <td><i>C<sub>l</sub>.y</i></td>
+ <td><i>C<sub>lr</sub>.y</i></td>
+ <td><i>C<sub>lr</sub>.y</i></td>
+ <td>&#x2014;</td>
+ <td><i>C<sub>rl</sub>.y</i></td>
+ <td>&#x2014;</td>
+ <td>&#x2014;</td>
+ </tr>
+ <tr align="center" valign="baseline">
+ <th><code>stack[8]</code></th>
+ <td><i>S.x</i></td>
+ <td><i>E<sub>l</sub>.x</i>
+ = <i>S<sub>r</sub>.x</i></td>
+ <td><i>E<sub>lr</sub>.x</i>
+ = <i>S<sub>r</sub>.x</i></td>
+ <td><i>E<sub>lr</sub>.x</i>
+ = <i>S<sub>r</sub>.x</i></td>
+ <td><i>S<sub>r</sub>.x</i></td>
+ <td><i>E<sub>rl</sub>.x</i>
+ = <i>S<sub>rr</sub>.x</i></td>
+ <td><i>S<sub>rr</sub>.x</i></td>
+ <td>&#x2014;</td>
+ </tr>
+ <tr align="center" valign="baseline">
+ <th><code>stack[9]</code></th>
+ <td><i>S.y</i></td>
+ <td><i>E<sub>l</sub>.y</i>
+ = <i>S<sub>r</sub>.y</i></td>
+ <td><i>E<sub>lr</sub>.y</i>
+ = <i>S<sub>r</sub>.y</i></td>
+ <td><i>E<sub>lr</sub>.y</i>
+ = <i>S<sub>r</sub>.y</i></td>
+ <td><i>S<sub>r</sub>.y</i></td>
+ <td><i>E<sub>rl</sub>.y</i>
+ = <i>S<sub>rr</sub>.y</i></td>
+ <td><i>S<sub>rr</sub>.y</i></td>
+ <td>&#x2014;</td>
+ </tr>
+ <tr align="center" valign="baseline">
+ <th><code>stack[10]</code></th>
+ <td><i>C.x</i></td>
+ <td><i>C<sub>r</sub>.x</i></td>
+ <td><i>C<sub>r</sub>.x</i></td>
+ <td><i>C<sub>r</sub>.x</i></td>
+ <td><i>C<sub>r</sub>.x</i></td>
+ <td><i>C<sub>rr</sub>.x</i></td>
+ <td><i>C<sub>rr</sub>.x</i></td>
+ <td>&#x2014;</td>
+ </tr>
+ <tr align="center" valign="baseline">
+ <th><code>stack[11]</code></th>
+ <td><i>C.y</i></td>
+ <td><i>C<sub>r</sub>.y</i></td>
+ <td><i>C<sub>r</sub>.y</i></td>
+ <td><i>C<sub>r</sub>.y</i></td>
+ <td><i>C<sub>r</sub>.y</i></td>
+ <td><i>C<sub>rr</sub>.y</i></td>
+ <td><i>C<sub>rr</sub>.y</i></td>
+ <td>&#x2014;</td>
+ </tr>
+ <tr align="center" valign="baseline">
+ <th><code>stack[12]</code></th>
+ <td><i>E.x</i></td>
+ <td><i>E<sub>r</sub>.x</i></td>
+ <td><i>E<sub>r</sub>.x</i></td>
+ <td><i>E<sub>r</sub>.x</i></td>
+ <td><i>E<sub>r</sub>.x</i></td>
+ <td><i>E<sub>rr</sub>.x</i></td>
+ <td><i>E<sub>rr</sub>.x</i></td>
+ <td>&#x2014;</td>
+ </tr>
+ <tr align="center" valign="baseline">
+ <th><code>stack[13]</code></th>
+ <td><i>E.y</i></td>
+ <td><i>E<sub>r</sub>.y</i></td>
+ <td><i>E<sub>r</sub>.y</i></td>
+ <td><i>E<sub>r</sub>.y</i></td>
+ <td><i>E<sub>r</sub>.y</i></td>
+ <td><i>E<sub>rr</sub>.y</i></td>
+ <td><i>E<sub>rr</sub>.x</i></td>
+ <td>&#x2014;</td>
+ </tr>
+ <tr align="center" valign="baseline">
+ <th><code>stackSize</code></th>
+ <td>1</td>
+ <td>2</td>
+ <td>3</td>
+ <td>2</td>
+ <td>1</td>
+ <td>2</td>
+ <td>1</td>
+ <td>0</td>
+ </tr>
+ <tr align="center" valign="baseline">
+ <th><code>recLevel[2]</code></th>
+ <td>&#x2014;</td>
+ <td>&#x2014;</td>
+ <td>2</td>
+ <td>&#x2014;</td>
+ <td>&#x2014;</td>
+ <td>&#x2014;</td>
+ <td>&#x2014;</td>
+ <td>&#x2014;</td>
+ </tr>
+ <tr align="center" valign="baseline">
+ <th><code>recLevel[1]</code></th>
+ <td>&#x2014;</td>
+ <td>1</td>
+ <td>2</td>
+ <td>2</td>
+ <td>&#x2014;</td>
+ <td>2</td>
+ <td>&#x2014;</td>
+ <td>&#x2014;</td>
+ </tr>
+ <tr align="center" valign="baseline">
+ <th><code>recLevel[0]</code></th>
+ <td>0</td>
+ <td>1</td>
+ <td>1</td>
+ <td>1</td>
+ <td>1</td>
+ <td>2</td>
+ <td>2</td>
+ <td>&#x2014;</td>
+ </tr>
+ </table>
+</blockquote>
+
+<ol>
+
+<li>The data structures are initialized as follows.
+
+<ul><li>The segment&#x2019;s end point <i>E</i>, control point
+<i>C</i>, and start point <i>S</i> are pushed onto the stack.</li>
+
+ <li>Currently, the curve in the stack would be approximated by one
+ single straight line segment (<i>S</i> &#x2013; <i>E</i>).
+ Therefore, <code>stackSize</code> is set to 1.</li>
+
+ <li>This single straight line segment is approximating the original
+ curve, which can be seen as the result of zero recursive
+ splits. Therefore, <code>recLevel[0]</code> is set to
+ zero.</li></ul>
+
+Column A shows the state after the initialization step.</li>
+
+<li>The algorithm proceeds by taking the topmost curve segment
+(<i>S</i> &#x2013; <i>C</i> &#x2013; <i>E</i>) from the stack.
+
+ <ul><li>The recursion level of this segment (stored in
+ <code>recLevel[0]</code>) is zero, which is smaller than
+ the limit 2.</li>
+
+ <li>The method <code>java.awt.geom.QuadCurve2D.getFlatnessSq</code>
+ is called to calculate the squared flatness.</li>
+
+ <li>For the sake of argument, we assume that the squared flatness is
+ exceeding the threshold stored in <code>flatnessSq</code>. Thus, the
+ curve segment <i>S</i> &#x2013; <i>C</i> &#x2013; <i>E</i> gets
+ subdivided into a left and a right half, namely
+ <i>S<sub>l</sub></i> &#x2013; <i>C<sub>l</sub></i> &#x2013;
+ <i>E<sub>l</sub></i> and <i>S<sub>r</sub></i> &#x2013;
+ <i>C<sub>r</sub></i> &#x2013; <i>E<sub>r</sub></i>. Both halves are
+ pushed onto the stack, so the left half is now on top.
+
+ <br />&nbsp;<br />The left half starts at the same point
+ as the original curve, so <i>S<sub>l</sub></i> has the same
+ coordinates as <i>S</i>. Similarly, the end point of the right
+ half and of the original curve are identical
+ (<i>E<sub>r</sub></i> = <i>E</i>). More interestingly, the left
+ half ends where the right half starts. Because
+ <i>E<sub>l</sub></i> = <i>S<sub>r</sub></i>, their coordinates need
+ to be stored only once, which amounts to saving 16 bytes (two
+ <code>double</code> values) for each iteration.</li></ul>
+
+Column B shows the state after the first iteration.</li>
+
+<li>Again, the topmost curve segment (<i>S<sub>l</sub></i>
+&#x2013; <i>C<sub>l</sub></i> &#x2013; <i>E<sub>l</sub></i>) is
+taken from the stack.
+
+ <ul><li>The recursion level of this segment (stored in
+ <code>recLevel[1]</code>) is 1, which is smaller than
+ the limit 2.</li>
+
+ <li>The method <code>java.awt.geom.QuadCurve2D.getFlatnessSq</code>
+ is called to calculate the squared flatness.</li>
+
+ <li>Assuming that the segment is still not considered
+ flat enough, it gets subdivided into a left
+ (<i>S<sub>ll</sub></i> &#x2013; <i>C<sub>ll</sub></i> &#x2013;
+ <i>E<sub>ll</sub></i>) and a right (<i>S<sub>lr</sub></i>
+ &#x2013; <i>C<sub>lr</sub></i> &#x2013; <i>E<sub>lr</sub></i>)
+ half.</li></ul>
+
+Column C shows the state after the second iteration.</li>
+
+<li>The topmost curve segment (<i>S<sub>ll</sub></i> &#x2013;
+<i>C<sub>ll</sub></i> &#x2013; <i>E<sub>ll</sub></i>) is popped from
+the stack.
+
+ <ul><li>The recursion level of this segment (stored in
+ <code>recLevel[2]</code>) is 2, which is <em>not</em> smaller than
+ the limit 2. Therefore, a <code>SEG_LINETO</code> (from
+ <i>S<sub>ll</sub></i> to <i>E<sub>ll</sub></i>) is passed to the
+ consumer.</li></ul>
+
+ The new state is shown in column D.</li>
+
+
+<li>The topmost curve segment (<i>S<sub>lr</sub></i> &#x2013;
+<i>C<sub>lr</sub></i> &#x2013; <i>E<sub>lr</sub></i>) is popped from
+the stack.
+
+ <ul><li>The recursion level of this segment (stored in
+ <code>recLevel[1]</code>) is 2, which is <em>not</em> smaller than
+ the limit 2. Therefore, a <code>SEG_LINETO</code> (from
+ <i>S<sub>lr</sub></i> to <i>E<sub>lr</sub></i>) is passed to the
+ consumer.</li></ul>
+
+ The new state is shown in column E.</li>
+
+<li>The algorithm proceeds by taking the topmost curve segment
+(<i>S<sub>r</sub></i> &#x2013; <i>C<sub>r</sub></i> &#x2013;
+<i>E<sub>r</sub></i>) from the stack.
+
+ <ul><li>The recursion level of this segment (stored in
+ <code>recLevel[0]</code>) is 1, which is smaller than
+ the limit 2.</li>
+
+ <li>The method <code>java.awt.geom.QuadCurve2D.getFlatnessSq</code>
+ is called to calculate the squared flatness.</li>
+
+ <li>For the sake of argument, we again assume that the squared
+ flatness is exceeding the threshold stored in
+ <code>flatnessSq</code>. Thus, the curve segment
+ (<i>S<sub>r</sub></i> &#x2013; <i>C<sub>r</sub></i> &#x2013;
+ <i>E<sub>r</sub></i>) is subdivided into a left and a right half,
+ namely
+ <i>S<sub>rl</sub></i> &#x2013; <i>C<sub>rl</sub></i> &#x2013;
+ <i>E<sub>rl</sub></i> and <i>S<sub>rr</sub></i> &#x2013;
+ <i>C<sub>rr</sub></i> &#x2013; <i>E<sub>rr</sub></i>. Both halves
+ are pushed onto the stack.</li></ul>
+
+ The new state is shown in column F.</li>
+
+<li>The topmost curve segment (<i>S<sub>rl</sub></i> &#x2013;
+<i>C<sub>rl</sub></i> &#x2013; <i>E<sub>rl</sub></i>) is popped from
+the stack.
+
+ <ul><li>The recursion level of this segment (stored in
+ <code>recLevel[2]</code>) is 2, which is <em>not</em> smaller than
+ the limit 2. Therefore, a <code>SEG_LINETO</code> (from
+ <i>S<sub>rl</sub></i> to <i>E<sub>rl</sub></i>) is passed to the
+ consumer.</li></ul>
+
+ The new state is shown in column G.</li>
+
+<li>The topmost curve segment (<i>S<sub>rr</sub></i> &#x2013;
+<i>C<sub>rr</sub></i> &#x2013; <i>E<sub>rr</sub></i>) is popped from
+the stack.
+
+ <ul><li>The recursion level of this segment (stored in
+ <code>recLevel[2]</code>) is 2, which is <em>not</em> smaller than
+ the limit 2. Therefore, a <code>SEG_LINETO</code> (from
+ <i>S<sub>rr</sub></i> to <i>E<sub>rr</sub></i>) is passed to the
+ consumer.</li></ul>
+
+ The new state is shown in column H.</li>
+
+<li>The stack is now empty. The FlatteningPathIterator will fetch the
+next segment from the base iterator, and process it.</li>
+
+</ol>
+
+<p>In order to split the most recently pushed segment, the
+<code>subdivideQuadratic()</code> method passes <code>stack</code>
+directly to
+<code>QuadCurve2D.subdivide(double[],int,double[],int,double[],int)</code>.
+Because the stack grows towards the beginning of the array, no data
+needs to be copied around: <code>subdivide</code> will directly store
+the result into the stack, which will have the contents shown to the
+right.</p>
+
+</body>
+</html>
diff --git a/libjava/java/util/logging/logging.properties b/libjava/java/util/logging/logging.properties
new file mode 100644
index 00000000000..3104af3acab
--- /dev/null
+++ b/libjava/java/util/logging/logging.properties
@@ -0,0 +1,8 @@
+# Default logging properties.
+# See javadoc in java.util.logging.LogManager to information on
+# overriding these settings. Most of the defaults are compiled in, so
+# this file is fairly minimal.
+
+# Send log records to System.err, default to INFO per documentation.
+handlers = java.util.logging.ConsoleHandler
+.level = INFO
diff --git a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkClasspathFontPeerMetrics.c b/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkClasspathFontPeerMetrics.c
new file mode 100644
index 00000000000..0f0b424467c
--- /dev/null
+++ b/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkClasspathFontPeerMetrics.c
@@ -0,0 +1,93 @@
+/* gnu_java_awt_peer_gtk_GdkClasspathFontPeerMetrics.c
+ Copyright (C) 1999, 2003 Free Software Foundation, Inc.
+
+ This file is part of GNU Classpath.
+
+ GNU Classpath 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, or (at your option)
+ any later version.
+
+ GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
+ Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA.
+
+ Linking this library statically or dynamically with other modules is
+ making a combined work based on this library. Thus, the terms and
+ conditions of the GNU General Public License cover the whole
+ combination.
+
+ As a special exception, the copyright holders of this library give you
+ permission to link this library with independent modules to produce an
+ executable, regardless of the license terms of these independent
+ modules, and to copy and distribute the resulting executable under
+ terms of your choice, provided that you also meet, for each linked
+ independent module, the terms and conditions of the license of that
+ module. An independent module is a module which is not derived from
+ or based on this library. If you modify this library, you may extend
+ this exception to your version of the library, but you are not
+ obligated to do so. If you do not wish to do so, delete this
+ exception statement from your version. */
+
+#include <math.h>
+
+#include "gtkpeer.h"
+#include "gdkfont.h"
+#include "gnu_java_awt_peer_gtk_GdkClasspathFontPeerMetrics.h"
+
+#define ASCENT 0
+#define MAX_ASCENT 1
+#define DESCENT 2
+#define MAX_DESCENT 3
+#define MAX_ADVANCE 4
+#define NUM_METRICS 5
+
+JNIEXPORT jintArray JNICALL Java_gnu_java_awt_peer_gtk_GdkClasspathFontPeerMetrics_initState
+ (JNIEnv *env, jobject self, jobject font)
+{
+ jintArray array;
+ jint *metrics;
+ struct peerfont *pf = NULL;
+
+ pf = NSA_GET_FONT_PTR(env, font);
+ g_assert (pf != NULL);
+
+ array = (*env)->NewIntArray (env, NUM_METRICS);
+ metrics = (*env)->GetIntArrayElements (env, array, NULL);
+
+ gdk_threads_enter ();
+
+#define DOUBLE_TO_26_6(d) ((FT_F26Dot6)((d) * 63.0))
+#define DOUBLE_FROM_26_6(t) (((double)((t) >> 6)) \
+ + ((double)((t) & 0x3F) / 63.0))
+
+ double pointsize = pango_font_description_get_size (pf->desc);
+ pointsize /= (double) PANGO_SCALE;
+
+ FT_Face face = pango_ft2_font_get_face (pf->font);
+ FT_Set_Char_Size( face,
+ DOUBLE_TO_26_6 (pointsize),
+ DOUBLE_TO_26_6 (pointsize),
+ 0, 0);
+
+ metrics[ASCENT] = ceil (DOUBLE_FROM_26_6(face->size->metrics.ascender));
+ metrics[MAX_ASCENT] = metrics[ASCENT];
+ metrics[DESCENT] = floor (DOUBLE_FROM_26_6(face->size->metrics.descender));
+ if (metrics[DESCENT] < 0)
+ metrics[DESCENT] = - metrics[DESCENT];
+ metrics[MAX_DESCENT] = metrics[DESCENT];
+ metrics[MAX_ADVANCE] = ceil (DOUBLE_FROM_26_6(face->size->metrics.max_advance));
+
+ gdk_threads_leave ();
+
+ (*env)->ReleaseIntArrayElements (env, array, metrics, 0);
+
+ return array;
+}
+
diff --git a/libjava/testsuite/libjava.compile/PR12857.java b/libjava/testsuite/libjava.compile/PR12857.java
new file mode 100644
index 00000000000..9ed234ff277
--- /dev/null
+++ b/libjava/testsuite/libjava.compile/PR12857.java
@@ -0,0 +1,4 @@
+// Based on original test case from Yves Martin.
+interface PR12857 {
+ static final String CONST = PR12857.class.getName();
+}
diff --git a/libstdc++-v3/include/debug/formatter.h b/libstdc++-v3/include/debug/formatter.h
new file mode 100644
index 00000000000..1a627a98dda
--- /dev/null
+++ b/libstdc++-v3/include/debug/formatter.h
@@ -0,0 +1,389 @@
+// Debug-mode error formatting implementation -*- C++ -*-
+
+// Copyright (C) 2003
+// 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 2, 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 COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+#ifndef _GLIBCXX_DEBUG_FORMATTER_H
+#define _GLIBCXX_DEBUG_FORMATTER_H 1
+
+#include <typeinfo>
+#include <debug/debug.h>
+
+namespace __gnu_debug
+{
+ using namespace std;
+
+ /** Determine if the two types are the same. */
+ template<typename _Type1, typename _Type2>
+ struct __is_same
+ {
+ static const bool value = false;
+ };
+
+ template<typename _Type>
+ struct __is_same<_Type, _Type>
+ {
+ static const bool value = true;
+ };
+
+ template<bool> struct __truth { };
+
+ class _Safe_sequence_base;
+
+ template<typename _Iterator, typename _Sequence>
+ class _Safe_iterator;
+
+ template<typename _Sequence>
+ class _Safe_sequence;
+
+ enum _Debug_msg_id
+ {
+ // General checks
+ __msg_valid_range,
+ __msg_insert_singular,
+ __msg_insert_different,
+ __msg_erase_bad,
+ __msg_erase_different,
+ __msg_subscript_oob,
+ __msg_empty,
+ __msg_unpartitioned,
+ __msg_unpartitioned_pred,
+ __msg_unsorted,
+ __msg_unsorted_pred,
+ __msg_not_heap,
+ __msg_not_heap_pred,
+ // std::bitset checks
+ __msg_bad_bitset_write,
+ __msg_bad_bitset_read,
+ __msg_bad_bitset_flip,
+ // std::list checks
+ __msg_self_splice,
+ __msg_splice_alloc,
+ __msg_splice_bad,
+ __msg_splice_other,
+ __msg_splice_overlap,
+ // iterator checks
+ __msg_init_singular,
+ __msg_init_copy_singular,
+ __msg_init_const_singular,
+ __msg_copy_singular,
+ __msg_bad_deref,
+ __msg_bad_inc,
+ __msg_bad_dec,
+ __msg_iter_subscript_oob,
+ __msg_advance_oob,
+ __msg_retreat_oob,
+ __msg_iter_compare_bad,
+ __msg_compare_different,
+ __msg_iter_order_bad,
+ __msg_order_different,
+ __msg_distance_bad,
+ __msg_distance_different,
+ // istream_iterator
+ __msg_deref_istream,
+ __msg_inc_istream,
+ // ostream_iterator
+ __msg_output_ostream,
+ // istreambuf_iterator
+ __msg_deref_istreambuf,
+ __msg_inc_istreambuf
+ };
+
+ class _Error_formatter
+ {
+ /// Whether an iterator is constant, mutable, or unknown
+ enum _Constness
+ {
+ __unknown_constness,
+ __const_iterator,
+ __mutable_iterator,
+ __last_constness
+ };
+
+ // The state of the iterator (fine-grained), if we know it.
+ enum _Iterator_state
+ {
+ __unknown_state,
+ __singular, // singular, may still be attached to a sequence
+ __begin, // dereferenceable, and at the beginning
+ __middle, // dereferenceable, not at the beginning
+ __end, // past-the-end, may be at beginning if sequence empty
+ __last_state
+ };
+
+ // Tags denoting the type of parameter for construction
+ struct _Is_iterator { };
+ struct _Is_sequence { };
+
+ // A parameter that may be referenced by an error message
+ struct _Parameter
+ {
+ enum
+ {
+ __unused_param,
+ __iterator,
+ __sequence,
+ __integer,
+ __string
+ } _M_kind;
+
+ union
+ {
+ // When _M_kind == __iterator
+ struct
+ {
+ const char* _M_name;
+ const void* _M_address;
+ const type_info* _M_type;
+ _Constness _M_constness;
+ _Iterator_state _M_state;
+ const void* _M_sequence;
+ const type_info* _M_seq_type;
+ } _M_iterator;
+
+ // When _M_kind == __sequence
+ struct
+ {
+ const char* _M_name;
+ const void* _M_address;
+ const type_info* _M_type;
+ } _M_sequence;
+
+ // When _M_kind == __integer
+ struct
+ {
+ const char* _M_name;
+ long _M_value;
+ } _M_integer;
+
+ // When _M_kind == __string
+ struct
+ {
+ const char* _M_name;
+ const char* _M_value;
+ } _M_string;
+ } _M_variant;
+
+ _Parameter() : _M_kind(__unused_param) { }
+
+ _Parameter(long __value, const char* __name) : _M_kind(__integer)
+ {
+ _M_variant._M_integer._M_name = __name;
+ _M_variant._M_integer._M_value = __value;
+ }
+
+ _Parameter(const char* __value, const char* __name) : _M_kind(__string)
+ {
+ _M_variant._M_string._M_name = __name;
+ _M_variant._M_string._M_value = __value;
+ }
+
+ template<typename _Iterator, typename _Sequence>
+ _Parameter(const _Safe_iterator<_Iterator, _Sequence>& __it,
+ const char* __name, _Is_iterator)
+ : _M_kind(__iterator)
+ {
+ _M_variant._M_iterator._M_name = __name;
+ _M_variant._M_iterator._M_address = &__it;
+ _M_variant._M_iterator._M_type = &typeid(__it);
+ _M_variant._M_iterator._M_constness =
+ __is_same<_Safe_iterator<_Iterator, _Sequence>,
+ typename _Sequence::iterator>::
+ value? __mutable_iterator : __const_iterator;
+ _M_variant._M_iterator._M_sequence = __it._M_get_sequence();
+ _M_variant._M_iterator._M_seq_type = &typeid(_Sequence);
+
+ if (__it._M_singular())
+ _M_variant._M_iterator._M_state = __singular;
+ else
+ {
+ bool __is_begin = __it._M_is_begin();
+ bool __is_end = __it._M_is_end();
+ if (__is_end)
+ _M_variant._M_iterator._M_state = __end;
+ else if (__is_begin)
+ _M_variant._M_iterator._M_state = __begin;
+ else
+ _M_variant._M_iterator._M_state = __middle;
+ }
+ }
+
+ template<typename _Type>
+ _Parameter(const _Type*& __it, const char* __name, _Is_iterator)
+ : _M_kind(__iterator)
+ {
+ _M_variant._M_iterator._M_name = __name;
+ _M_variant._M_iterator._M_address = &__it;
+ _M_variant._M_iterator._M_type = &typeid(__it);
+ _M_variant._M_iterator._M_constness = __mutable_iterator;
+ _M_variant._M_iterator._M_state = __it? __unknown_state : __singular;
+ _M_variant._M_iterator._M_sequence = 0;
+ _M_variant._M_iterator._M_seq_type = 0;
+ }
+
+ template<typename _Type>
+ _Parameter(_Type*& __it, const char* __name, _Is_iterator)
+ : _M_kind(__iterator)
+ {
+ _M_variant._M_iterator._M_name = __name;
+ _M_variant._M_iterator._M_address = &__it;
+ _M_variant._M_iterator._M_type = &typeid(__it);
+ _M_variant._M_iterator._M_constness = __const_iterator;
+ _M_variant._M_iterator._M_state = __it? __unknown_state : __singular;
+ _M_variant._M_iterator._M_sequence = 0;
+ _M_variant._M_iterator._M_seq_type = 0;
+ }
+
+ template<typename _Iterator>
+ _Parameter(const _Iterator& __it, const char* __name, _Is_iterator)
+ : _M_kind(__iterator)
+ {
+ _M_variant._M_iterator._M_name = __name;
+ _M_variant._M_iterator._M_address = &__it;
+ _M_variant._M_iterator._M_type = &typeid(__it);
+ _M_variant._M_iterator._M_constness = __unknown_constness;
+ _M_variant._M_iterator._M_state =
+ __gnu_debug::__check_singular(__it)? __singular : __unknown_state;
+ _M_variant._M_iterator._M_sequence = 0;
+ _M_variant._M_iterator._M_seq_type = 0;
+ }
+
+ template<typename _Sequence>
+ _Parameter(const _Safe_sequence<_Sequence>& __seq,
+ const char* __name, _Is_sequence)
+ : _M_kind(__sequence)
+ {
+ _M_variant._M_sequence._M_name = __name;
+ _M_variant._M_sequence._M_address =
+ static_cast<const _Sequence*>(&__seq);
+ _M_variant._M_sequence._M_type = &typeid(_Sequence);
+ }
+
+ template<typename _Sequence>
+ _Parameter(const _Sequence& __seq, const char* __name, _Is_sequence)
+ : _M_kind(__sequence)
+ {
+ _M_variant._M_sequence._M_name = __name;
+ _M_variant._M_sequence._M_address = &__seq;
+ _M_variant._M_sequence._M_type = &typeid(_Sequence);
+ }
+
+ void
+ _M_print_field(const _Error_formatter* __formatter,
+ const char* __name) const;
+
+ void
+ _M_print_description(const _Error_formatter* __formatter) const;
+ };
+
+ friend struct _Parameter;
+
+ public:
+ template<typename _Iterator>
+ const _Error_formatter&
+ _M_iterator(const _Iterator& __it, const char* __name = 0) const
+ {
+ if (_M_num_parameters < __max_parameters)
+ _M_parameters[_M_num_parameters++] = _Parameter(__it, __name,
+ _Is_iterator());
+ return *this;
+ }
+
+ const _Error_formatter&
+ _M_integer(long __value, const char* __name = 0) const
+ {
+ if (_M_num_parameters < __max_parameters)
+ _M_parameters[_M_num_parameters++] = _Parameter(__value, __name);
+ return *this;
+ }
+
+ const _Error_formatter&
+ _M_string(const char* __value, const char* __name = 0) const
+ {
+ if (_M_num_parameters < __max_parameters)
+ _M_parameters[_M_num_parameters++] = _Parameter(__value, __name);
+ return *this;
+ }
+
+ template<typename _Sequence>
+ const _Error_formatter&
+ _M_sequence(const _Sequence& __seq, const char* __name = 0) const
+ {
+ if (_M_num_parameters < __max_parameters)
+ _M_parameters[_M_num_parameters++] = _Parameter(__seq, __name,
+ _Is_sequence());
+ return *this;
+ }
+
+ const _Error_formatter&
+ _M_message(const char* __text) const
+ { _M_text = __text; return *this; }
+
+ const _Error_formatter&
+ _M_message(_Debug_msg_id __id) const;
+
+ void
+ _M_error() const;
+
+ private:
+ _Error_formatter(const char* __file, size_t __line)
+ : _M_file(__file), _M_line(__line), _M_num_parameters(0), _M_text(0),
+ _M_max_length(78), _M_column(1), _M_first_line(true), _M_wordwrap(false)
+ { }
+
+ template<typename _Tp>
+ void
+ _M_format_word(char*, int, const char*, _Tp) const;
+
+ void
+ _M_print_word(const char* __word) const;
+
+ void
+ _M_print_string(const char* __string) const;
+
+ enum { __max_parameters = 9 };
+
+ const char* _M_file;
+ size_t _M_line;
+ mutable _Parameter _M_parameters[__max_parameters];
+ mutable size_t _M_num_parameters;
+ mutable const char* _M_text;
+ mutable size_t _M_max_length;
+ enum { _M_indent = 4 } ;
+ mutable size_t _M_column;
+ mutable bool _M_first_line;
+ mutable bool _M_wordwrap;
+
+ public:
+ static _Error_formatter
+ _M_at(const char* __file, size_t __line)
+ { return _Error_formatter(__file, __line); }
+ };
+} // namespace __gnu_debug
+
+#endif
diff --git a/libstdc++-v3/src/debug.cc b/libstdc++-v3/src/debug.cc
new file mode 100644
index 00000000000..a78bdec2df3
--- /dev/null
+++ b/libstdc++-v3/src/debug.cc
@@ -0,0 +1,660 @@
+// Debugging mode support code -*- C++ -*-
+
+// Copyright (C) 2003
+// 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 2, 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 COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+#include <debug/debug.h>
+#include <debug/safe_sequence.h>
+#include <debug/safe_iterator.h>
+#include <algorithm>
+#include <cstdlib>
+#include <cassert>
+#include <cstring>
+#include <cstdio>
+#include <cctype>
+
+using namespace std;
+
+namespace __gnu_debug
+{
+ const char* _S_debug_messages[] =
+ {
+ "function requires a valid iterator range [%1.name;, %2.name;)",
+ "attempt to insert into container with a singular iterator",
+ "attempt to insert into container with an iterator"
+ " from a different container",
+ "attempt to erase from container with a %2.state; iterator",
+ "attempt to erase from container with an iterator"
+ " from a different container",
+ "attempt to subscript container with out-of-bounds index %2;,"
+ " but container only holds %3; elements",
+ "attempt to access an element in an empty container",
+ "elements in iterator range [%1.name;, %2.name;)"
+ " are not partitioned by the value %3;",
+ "elements in iterator range [%1.name;, %2.name;)"
+ " are not partitioned by the predicate %3; and value %4;",
+ "elements in iterator range [%1.name;, %2.name;) are not sorted",
+ "elements in iterator range [%1.name;, %2.name;)"
+ " are not sorted according to the predicate %3;",
+ "elements in iterator range [%1.name;, %2.name;) do not form a heap",
+ "elements in iterator range [%1.name;, %2.name;)"
+ " do not form a heap with respect to the predicate %3;",
+ "attempt to write through a singular bitset reference",
+ "attempt to read from a singular bitset reference",
+ "attempt to flip a singular bitset reference",
+ "attempt to splice a list into itself",
+ "attempt to splice lists with inequal allocators",
+ "attempt to splice elements referenced by a %1.state; iterator",
+ "attempt to splice an iterator from a different container",
+ "splice destination %1.name;"
+ " occurs within source range [%2.name;, %3.name;)",
+ "attempt to initialize an iterator that will immediately become singular",
+ "attempt to copy-construct an iterator from a singular iterator",
+ "attempt to construct a constant iterator"
+ " from a singular mutable iterator",
+ "attempt to copy from a singular iterator",
+ "attempt to dereference a %1.state; iterator",
+ "attempt to increment a %1.state; iterator",
+ "attempt to decrement a %1.state; iterator",
+ "attempt to subscript a %1.state; iterator %2; step from"
+ " its current position, which falls outside its dereferenceable range",
+ "attempt to advance a %1.state; iterator %2; steps,"
+ " which falls outside its valid range",
+ "attempt to retreat a %1.state; iterator %2; steps,"
+ " which falls outside its valid range",
+ "attempt to compare a %1.state; iterator to a %2.state; iterator",
+ "attempt to compare iterators from different sequences",
+ "attempt to order a %1.state; iterator to a %2.state; iterator",
+ "attempt to order iterators from different sequences",
+ "attempt to compute the difference between a %1.state;"
+ " iterator to a %2.state; iterator",
+ "attempt to compute the different between two iterators"
+ " from different sequences",
+ "attempt to dereference an end-of-stream istream_iterator",
+ "attempt to increment an end-of-stream istream_iterator",
+ "attempt to output via an ostream_iterator with no associated stream",
+ "attempt to dereference an end-of-stream istreambuf_iterator"
+ " (this is a GNU extension)",
+ "attempt to increment an end-of-stream istreambuf_iterator"
+ };
+
+ void
+ _Safe_sequence_base::
+ _M_detach_all()
+ {
+ for (_Safe_iterator_base* iter = _M_iterators; iter; )
+ {
+ _Safe_iterator_base* old = iter;
+ iter = iter->_M_next;
+ old->_M_attach(0, false);
+ }
+
+ for (_Safe_iterator_base* iter = _M_const_iterators; iter; )
+ {
+ _Safe_iterator_base* old = iter;
+ iter = iter->_M_next;
+ old->_M_attach(0, true);
+ }
+ }
+
+ void
+ _Safe_sequence_base::
+ _M_detach_singular()
+ {
+ for (_Safe_iterator_base* iter = _M_iterators; iter; )
+ {
+ _Safe_iterator_base* old = iter;
+ iter = iter->_M_next;
+ if (old->_M_singular())
+ old->_M_attach(0, false);
+ }
+
+ for (_Safe_iterator_base* iter = _M_const_iterators; iter; )
+ {
+ _Safe_iterator_base* old = iter;
+ iter = iter->_M_next;
+ if (old->_M_singular())
+ old->_M_attach(0, true);
+ }
+ }
+
+ void
+ _Safe_sequence_base::
+ _M_revalidate_singular()
+ {
+ _Safe_iterator_base* iter;
+ for (iter = _M_iterators; iter; iter = iter->_M_next)
+ {
+ iter->_M_version = _M_version;
+ iter = iter->_M_next;
+ }
+
+ for (iter = _M_const_iterators; iter; iter = iter->_M_next)
+ {
+ iter->_M_version = _M_version;
+ iter = iter->_M_next;
+ }
+ }
+
+ void
+ _Safe_sequence_base::
+ _M_swap(_Safe_sequence_base& __x)
+ {
+ swap(_M_iterators, __x._M_iterators);
+ swap(_M_const_iterators, __x._M_const_iterators);
+ swap(_M_version, __x._M_version);
+ _Safe_iterator_base* iter;
+ for (iter = _M_iterators; iter; iter = iter->_M_next)
+ iter->_M_sequence = this;
+ for (iter = __x._M_iterators; iter; iter = iter->_M_next)
+ iter->_M_sequence = &__x;
+ for (iter = _M_const_iterators; iter; iter = iter->_M_next)
+ iter->_M_sequence = this;
+ for (iter = __x._M_const_iterators; iter; iter = iter->_M_next)
+ iter->_M_sequence = &__x;
+ }
+
+ void
+ _Safe_iterator_base::
+ _M_attach(_Safe_sequence_base* __seq, bool __constant)
+ {
+ _M_detach();
+
+ // Attach to the new sequence (if there is one)
+ if (__seq)
+ {
+ _M_sequence = __seq;
+ _M_version = _M_sequence->_M_version;
+ _M_prior = 0;
+ if (__constant)
+ {
+ _M_next = _M_sequence->_M_const_iterators;
+ if (_M_next)
+ _M_next->_M_prior = this;
+ _M_sequence->_M_const_iterators = this;
+ }
+ else
+ {
+ _M_next = _M_sequence->_M_iterators;
+ if (_M_next)
+ _M_next->_M_prior = this;
+ _M_sequence->_M_iterators = this;
+ }
+ }
+ }
+
+ void
+ _Safe_iterator_base::
+ _M_detach()
+ {
+ if (_M_sequence)
+ {
+ // Remove us from this sequence's list
+ if (_M_prior)
+ _M_prior->_M_next = _M_next;
+ if (_M_next)
+ _M_next->_M_prior = _M_prior;
+
+ if (_M_sequence->_M_const_iterators == this)
+ _M_sequence->_M_const_iterators = _M_next;
+ if (_M_sequence->_M_iterators == this)
+ _M_sequence->_M_iterators = _M_next;
+ }
+
+ _M_sequence = 0;
+ _M_version = 0;
+ _M_prior = 0;
+ _M_next = 0;
+ }
+
+ bool
+ _Safe_iterator_base::
+ _M_singular() const
+ { return !_M_sequence || _M_version != _M_sequence->_M_version; }
+
+ bool
+ _Safe_iterator_base::
+ _M_can_compare(const _Safe_iterator_base& __x) const
+ {
+ return (!_M_singular() && !__x._M_singular()
+ && _M_sequence == __x._M_sequence);
+ }
+
+ void
+ _Error_formatter::_Parameter::
+ _M_print_field(const _Error_formatter* __formatter, const char* __name) const
+ {
+ assert(this->_M_kind != _Parameter::__unused_param);
+ const int bufsize = 64;
+ char buf[bufsize];
+
+ if (_M_kind == __iterator)
+ {
+ if (strcmp(__name, "name") == 0)
+ {
+ assert(_M_variant._M_iterator._M_name);
+ __formatter->_M_print_word(_M_variant._M_iterator._M_name);
+ }
+ else if (strcmp(__name, "address") == 0)
+ {
+ __formatter->_M_format_word(buf, bufsize, "%p",
+ _M_variant._M_iterator._M_address);
+ __formatter->_M_print_word(buf);
+ }
+ else if (strcmp(__name, "type") == 0)
+ {
+ assert(_M_variant._M_iterator._M_type);
+ // TBD: demangle!
+ __formatter->_M_print_word(_M_variant._M_iterator._M_type->name());
+ }
+ else if (strcmp(__name, "constness") == 0)
+ {
+ static const char* __constness_names[__last_constness] =
+ {
+ "<unknown>",
+ "constant",
+ "mutable"
+ };
+ __formatter->_M_print_word(__constness_names[_M_variant._M_iterator._M_constness]);
+ }
+ else if (strcmp(__name, "state") == 0)
+ {
+ static const char* __state_names[__last_state] =
+ {
+ "<unknown>",
+ "singular",
+ "dereferenceable (start-of-sequence)",
+ "dereferenceable",
+ "past-the-end"
+ };
+ __formatter->_M_print_word(__state_names[_M_variant._M_iterator._M_state]);
+ }
+ else if (strcmp(__name, "sequence") == 0)
+ {
+ assert(_M_variant._M_iterator._M_sequence);
+ __formatter->_M_format_word(buf, bufsize, "%p",
+ _M_variant._M_iterator._M_sequence);
+ __formatter->_M_print_word(buf);
+ }
+ else if (strcmp(__name, "seq_type") == 0)
+ {
+ // TBD: demangle!
+ assert(_M_variant._M_iterator._M_seq_type);
+ __formatter->_M_print_word(_M_variant._M_iterator._M_seq_type->name());
+ }
+ else
+ assert(false);
+ }
+ else if (_M_kind == __sequence)
+ {
+ if (strcmp(__name, "name") == 0)
+ {
+ assert(_M_variant._M_sequence._M_name);
+ __formatter->_M_print_word(_M_variant._M_sequence._M_name);
+ }
+ else if (strcmp(__name, "address") == 0)
+ {
+ assert(_M_variant._M_sequence._M_address);
+ __formatter->_M_format_word(buf, bufsize, "%p",
+ _M_variant._M_sequence._M_address);
+ __formatter->_M_print_word(buf);
+ }
+ else if (strcmp(__name, "type") == 0)
+ {
+ // TBD: demangle!
+ assert(_M_variant._M_sequence._M_type);
+ __formatter->_M_print_word(_M_variant._M_sequence._M_type->name());
+ }
+ else
+ assert(false);
+ }
+ else if (_M_kind == __integer)
+ {
+ if (strcmp(__name, "name") == 0)
+ {
+ assert(_M_variant._M_integer._M_name);
+ __formatter->_M_print_word(_M_variant._M_integer._M_name);
+ }
+ else
+ assert(false);
+ }
+ else if (_M_kind == __string)
+ {
+ if (strcmp(__name, "name") == 0)
+ {
+ assert(_M_variant._M_string._M_name);
+ __formatter->_M_print_word(_M_variant._M_string._M_name);
+ }
+ else
+ assert(false);
+ }
+ else
+ {
+ assert(false);
+ }
+ }
+
+ void
+ _Error_formatter::_Parameter::
+ _M_print_description(const _Error_formatter* __formatter) const
+ {
+ const int bufsize = 128;
+ char buf[bufsize];
+
+ if (_M_kind == __iterator)
+ {
+ __formatter->_M_print_word("iterator ");
+ if (_M_variant._M_iterator._M_name)
+ {
+ __formatter->_M_format_word(buf, bufsize, "\"%s\" ",
+ _M_variant._M_iterator._M_name);
+ __formatter->_M_print_word(buf);
+ }
+
+ __formatter->_M_format_word(buf, bufsize, "@ 0x%p {\n",
+ _M_variant._M_iterator._M_address);
+ __formatter->_M_print_word(buf);
+ if (_M_variant._M_iterator._M_type)
+ {
+ __formatter->_M_print_word("type = ");
+ _M_print_field(__formatter, "type");
+
+ if (_M_variant._M_iterator._M_constness != __unknown_constness)
+ {
+ __formatter->_M_print_word(" (");
+ _M_print_field(__formatter, "constness");
+ __formatter->_M_print_word(" iterator)");
+ }
+ __formatter->_M_print_word(";\n");
+ }
+
+ if (_M_variant._M_iterator._M_state != __unknown_state)
+ {
+ __formatter->_M_print_word(" state = ");
+ _M_print_field(__formatter, "state");
+ __formatter->_M_print_word(";\n");
+ }
+
+ if (_M_variant._M_iterator._M_sequence)
+ {
+ __formatter->_M_print_word(" references sequence ");
+ if (_M_variant._M_iterator._M_seq_type)
+ {
+ __formatter->_M_print_word("with type `");
+ _M_print_field(__formatter, "seq_type");
+ __formatter->_M_print_word("' ");
+ }
+
+ __formatter->_M_format_word(buf, bufsize, "@ 0x%p\n",
+ _M_variant._M_sequence._M_address);
+ __formatter->_M_print_word(buf);
+ }
+ __formatter->_M_print_word("}\n");
+ }
+ else if (_M_kind == __sequence)
+ {
+ __formatter->_M_print_word("sequence ");
+ if (_M_variant._M_sequence._M_name)
+ {
+ __formatter->_M_format_word(buf, bufsize, "\"%s\" ",
+ _M_variant._M_sequence._M_name);
+ __formatter->_M_print_word(buf);
+ }
+
+ __formatter->_M_format_word(buf, bufsize, "@ 0x%p {\n",
+ _M_variant._M_sequence._M_address);
+ __formatter->_M_print_word(buf);
+
+ if (_M_variant._M_sequence._M_type)
+ {
+ __formatter->_M_print_word(" type = ");
+ _M_print_field(__formatter, "type");
+ __formatter->_M_print_word(";\n");
+ }
+ __formatter->_M_print_word("}\n");
+ }
+ }
+
+ const _Error_formatter&
+ _Error_formatter::_M_message(_Debug_msg_id __id) const
+ { return this->_M_message(_S_debug_messages[__id]); }
+
+ void
+ _Error_formatter::_M_error() const
+ {
+ const int bufsize = 128;
+ char buf[bufsize];
+
+ // Emit file & line number information
+ _M_column = 1;
+ _M_wordwrap = false;
+ if (_M_file)
+ {
+ _M_format_word(buf, bufsize, "%s:", _M_file);
+ _M_print_word(buf);
+ _M_column += strlen(buf);
+ }
+
+ if (_M_line > 0)
+ {
+ _M_format_word(buf, bufsize, "%u:", _M_line);
+ _M_print_word(buf);
+ _M_column += strlen(buf);
+ }
+
+ _M_wordwrap = true;
+ _M_print_word("error: ");
+
+ // Print the error message
+ assert(_M_text);
+ _M_print_string(_M_text);
+ _M_print_word(".\n");
+
+ // Emit descriptions of the objects involved in the operation
+ _M_wordwrap = false;
+ bool has_noninteger_parameters = false;
+ for (unsigned int i = 0; i < _M_num_parameters; ++i)
+ {
+ if (_M_parameters[i]._M_kind == _Parameter::__iterator
+ || _M_parameters[i]._M_kind == _Parameter::__sequence)
+ {
+ if (!has_noninteger_parameters)
+ {
+ _M_first_line = true;
+ _M_print_word("\nObjects involved in the operation:\n");
+ has_noninteger_parameters = true;
+ }
+ _M_parameters[i]._M_print_description(this);
+ }
+ }
+
+ abort();
+ }
+
+ template<typename _Tp>
+ void
+ _Error_formatter::_M_format_word(char* __buf,
+ int __n __attribute__((__unused__)),
+ const char* __fmt, _Tp __s) const
+ {
+#ifdef _GLIBCXX_USE_C99
+ std::snprintf(__buf, __n, __fmt, __s);
+#else
+ std::sprintf(__buf, __fmt, __s);
+#endif
+ }
+
+
+ void
+ _Error_formatter::_M_print_word(const char* __word) const
+ {
+ if (!_M_wordwrap)
+ {
+ fprintf(stderr, "%s", __word);
+ return;
+ }
+
+ size_t __length = strlen(__word);
+ if (__length == 0)
+ return;
+
+ if ((_M_column + __length < _M_max_length)
+ || (__length >= _M_max_length && _M_column == 1))
+ {
+ // If this isn't the first line, indent
+ if (_M_column == 1 && !_M_first_line)
+ {
+ char spacing[_M_indent + 1];
+ for (int i = 0; i < _M_indent; ++i)
+ spacing[i] = ' ';
+ spacing[_M_indent] = '\0';
+ fprintf(stderr, "%s", spacing);
+ _M_column += _M_indent;
+ }
+
+ fprintf(stderr, "%s", __word);
+ _M_column += __length;
+
+ if (__word[__length - 1] == '\n')
+ {
+ _M_first_line = false;
+ _M_column = 1;
+ }
+ }
+ else
+ {
+ _M_column = 1;
+ _M_print_word("\n");
+ _M_print_word(__word);
+ }
+ }
+
+ void
+ _Error_formatter::
+ _M_print_string(const char* __string) const
+ {
+ const char* __start = __string;
+ const char* __end = __start;
+ const int bufsize = 128;
+ char buf[bufsize];
+
+ while (*__start)
+ {
+ if (*__start != '%')
+ {
+ // [__start, __end) denotes the next word
+ __end = __start;
+ while (isalnum(*__end)) ++__end;
+ if (__start == __end) ++__end;
+ if (isspace(*__end)) ++__end;
+
+ assert(__end - __start + 1< bufsize);
+ _M_format_word(buf, __end - __start + 1, "%s", __start);
+ _M_print_word(buf);
+ __start = __end;
+
+ // Skip extra whitespace
+ while (*__start == ' ')
+ ++__start;
+
+ continue;
+ }
+
+ ++__start;
+ assert(*__start);
+ if (*__start == '%')
+ {
+ _M_print_word("%");
+ ++__start;
+ continue;
+ }
+
+ // Get the parameter number
+ assert(*__start >= '1' && *__start <= '9');
+ size_t param = *__start - '0';
+ --param;
+ assert(param < _M_num_parameters);
+
+ // '.' separates the parameter number from the field
+ // name, if there is one.
+ ++__start;
+ if (*__start != '.')
+ {
+ assert(*__start == ';');
+ ++__start;
+ buf[0] = '\0';
+ if (_M_parameters[param]._M_kind == _Parameter::__integer)
+ {
+ _M_format_word(buf, bufsize, "%ld",
+ _M_parameters[param]._M_variant._M_integer._M_value);
+ _M_print_word(buf);
+ }
+ else if (_M_parameters[param]._M_kind == _Parameter::__string)
+ _M_print_string(_M_parameters[param]._M_variant._M_string._M_value);
+ continue;
+ }
+
+ // Extract the field name we want
+ enum { max_field_len = 16 };
+ char field[max_field_len];
+ int field_idx = 0;
+ ++__start;
+ while (*__start != ';')
+ {
+ assert(*__start);
+ assert(field_idx < max_field_len-1);
+ field[field_idx++] = *__start++;
+ }
+ ++__start;
+ field[field_idx] = 0;
+
+ _M_parameters[param]._M_print_field(this, field);
+ }
+ }
+
+ // Instantiations.
+ template
+ void
+ _Error_formatter::_M_format_word(char* __buf, int __n, const char* __fmt,
+ const void* __s) const;
+
+ template
+ void
+ _Error_formatter::_M_format_word(char* __buf, int __n, const char* __fmt,
+ long __s) const;
+
+ template
+ void
+ _Error_formatter::_M_format_word(char* __buf, int __n, const char* __fmt,
+ std::size_t __s) const;
+
+ template
+ void
+ _Error_formatter::_M_format_word(char* __buf, int __n, const char* __fmt,
+ const char* __s) const;
+} // namespace __gnu_debug
diff --git a/libstdc++-v3/testsuite/22_locale/num_put/put/char/8.cc b/libstdc++-v3/testsuite/22_locale/num_put/put/char/8.cc
new file mode 100644
index 00000000000..4ec8de1d958
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/num_put/put/char/8.cc
@@ -0,0 +1,68 @@
+// Copyright (C) 2003 Free Software Foundation
+//
+// 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 2, 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 COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.2.2.1 num_put members
+
+#include <locale>
+#include <sstream>
+#include <testsuite_hooks.h>
+
+struct Ctype: std::ctype<char>
+{
+ char
+ do_widen(char c) const
+ { return 'A' + c % 26; }
+
+ const char*
+ do_widen(const char* lo, const char* hi, char* to) const
+ {
+ for (; lo != hi; *to++ = Ctype::do_widen(*lo++));
+ return hi;
+ }
+};
+
+// See http://gcc.gnu.org/ml/libstdc++/2003-11/msg00154.html
+void test01()
+{
+ using namespace std;
+ bool test __attribute__((unused)) = true;
+
+ ostringstream oss;
+ oss.imbue(locale(locale::classic(), new Ctype));
+ const num_put<char>& np = use_facet<num_put<char> >(oss.getloc());
+
+ const string empty;
+ string result;
+ long inum = 123;
+ double fnum = 123.456;
+
+ np.put(oss.rdbuf(), oss, '+', inum);
+ result = oss.str();
+ VERIFY( result == "XYZ" );
+
+ oss.clear();
+ oss.str(empty);
+ np.put(oss.rdbuf(), oss, '+', fnum);
+ result = oss.str();
+ VERIFY( result == "XYZ.ABC" );
+}
+
+int main()
+{
+ test01();
+}
diff --git a/libstdc++-v3/testsuite/22_locale/num_put/put/wchar_t/8.cc b/libstdc++-v3/testsuite/22_locale/num_put/put/wchar_t/8.cc
new file mode 100644
index 00000000000..b1915d4d9f6
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/num_put/put/wchar_t/8.cc
@@ -0,0 +1,68 @@
+// Copyright (C) 2003 Free Software Foundation
+//
+// 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 2, 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 COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 22.2.2.2.1 num_put members
+
+#include <locale>
+#include <sstream>
+#include <testsuite_hooks.h>
+
+struct Ctype: std::ctype<wchar_t>
+{
+ wchar_t
+ do_widen(char c) const
+ { return L'A' + c % 26; }
+
+ const char*
+ do_widen(const char* lo, const char* hi, wchar_t* to) const
+ {
+ for (; lo != hi; *to++ = Ctype::do_widen(*lo++));
+ return hi;
+ }
+};
+
+// See http://gcc.gnu.org/ml/libstdc++/2003-11/msg00154.html
+void test01()
+{
+ using namespace std;
+ bool test __attribute__((unused)) = true;
+
+ wostringstream oss;
+ oss.imbue(locale(locale::classic(), new Ctype));
+ const num_put<wchar_t>& np = use_facet<num_put<wchar_t> >(oss.getloc());
+
+ const wstring empty;
+ wstring result;
+ long inum = 123;
+ double fnum = 123.456;
+
+ np.put(oss.rdbuf(), oss, '+', inum);
+ result = oss.str();
+ VERIFY( result == L"XYZ" );
+
+ oss.clear();
+ oss.str(empty);
+ np.put(oss.rdbuf(), oss, '+', fnum);
+ result = oss.str();
+ VERIFY( result == L"XYZ.ABC" );
+}
+
+int main()
+{
+ test01();
+}
diff --git a/libstdc++-v3/testsuite/24_iterators/istreambuf_iterator/1.cc b/libstdc++-v3/testsuite/24_iterators/istreambuf_iterator/1.cc
new file mode 100644
index 00000000000..8c836e50e15
--- /dev/null
+++ b/libstdc++-v3/testsuite/24_iterators/istreambuf_iterator/1.cc
@@ -0,0 +1,52 @@
+// { dg-do compile }
+// 1999-06-28 bkoz
+
+// Copyright (C) 1999, 2001, 2003 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 2, 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 COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 24.5.3 template class istreambuf_iterator
+
+#include <sstream>
+#include <iterator>
+#include <testsuite_hooks.h>
+
+void test01()
+{
+ using namespace std;
+
+ // Check for required base class.
+ typedef istreambuf_iterator<char> test_iterator;
+ typedef char_traits<char>::off_type off_type;
+ typedef iterator<input_iterator_tag, char, off_type, char*, char&> base_iterator;
+
+ istringstream isstream("this tag");
+ test_iterator r_it(isstream);
+ base_iterator* base __attribute__((unused)) = &r_it;
+
+ // Check for required typedefs
+ typedef test_iterator::value_type value_type;
+ typedef test_iterator::difference_type difference_type;
+ typedef test_iterator::pointer pointer;
+ typedef test_iterator::reference reference;
+ typedef test_iterator::iterator_category iteratory_category;
+
+ typedef test_iterator::char_type char_type;
+ typedef test_iterator::traits_type traits_type;
+ typedef test_iterator::istream_type istream_type;
+ typedef test_iterator::streambuf_type streambuf_type;
+}
diff --git a/libstdc++-v3/testsuite/24_iterators/istreambuf_iterator/2.cc b/libstdc++-v3/testsuite/24_iterators/istreambuf_iterator/2.cc
new file mode 100644
index 00000000000..61c88ea65ab
--- /dev/null
+++ b/libstdc++-v3/testsuite/24_iterators/istreambuf_iterator/2.cc
@@ -0,0 +1,117 @@
+// 1999-06-28 bkoz
+
+// Copyright (C) 1999, 2001, 2003 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 2, 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 COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 24.5.3 template class istreambuf_iterator
+
+#include <sstream>
+#include <iterator>
+#include <testsuite_hooks.h>
+
+bool test02(void)
+{
+
+ typedef std::istreambuf_iterator<char> cistreambuf_iter;
+ typedef cistreambuf_iter::streambuf_type cstreambuf_type;
+ bool test __attribute__((unused)) = true;
+ const char slit01[] = "playa hermosa, liberia, guanacaste";
+ std::string str01(slit01);
+ std::istringstream istrs00(str01);
+ std::istringstream istrs01(str01);
+
+ // ctor sanity checks
+ cistreambuf_iter istrb_it01(istrs00);
+ cistreambuf_iter istrb_it02;
+ std::string tmp(istrb_it01, istrb_it02);
+ VERIFY( tmp == str01 );
+
+ cistreambuf_iter istrb_it03(0);
+ cistreambuf_iter istrb_it04;
+ VERIFY( istrb_it03 == istrb_it04 );
+
+ cistreambuf_iter istrb_it05(istrs01);
+ cistreambuf_iter istrb_it06(istrs01.rdbuf());
+ VERIFY( istrb_it05 == istrb_it06 );
+
+ // bool equal(istreambuf_iter& b)
+ cistreambuf_iter istrb_it07(0);
+ cistreambuf_iter istrb_it08;
+ VERIFY( istrb_it07.equal(istrb_it08) );
+ cistreambuf_iter istrb_it09(0);
+ cistreambuf_iter istrb_it10;
+ VERIFY( istrb_it10.equal(istrb_it09) );
+
+ cistreambuf_iter istrb_it11(istrs01);
+ cistreambuf_iter istrb_it12(istrs01.rdbuf());
+ VERIFY( istrb_it11.equal(istrb_it12) );
+ cistreambuf_iter istrb_it13(istrs01);
+ cistreambuf_iter istrb_it14(istrs01.rdbuf());
+ VERIFY( istrb_it14.equal(istrb_it13) );
+
+ cistreambuf_iter istrb_it15(istrs01);
+ cistreambuf_iter istrb_it16;
+ VERIFY( !(istrb_it15.equal(istrb_it16)) );
+ cistreambuf_iter istrb_it17(istrs01);
+ cistreambuf_iter istrb_it18;
+ VERIFY( !(istrb_it18.equal(istrb_it17)) );
+
+ // bool operator==(const istreambuf_iterator&a, const istreambuf_iterator& b)
+ // bool operator!=(const istreambuf_iterator&a, const istreambuf_iterator& b)
+ cistreambuf_iter istrb_it19(0);
+ cistreambuf_iter istrb_it20;
+ VERIFY( istrb_it19 == istrb_it20 );
+
+ cistreambuf_iter istrb_it21(istrs01);
+ cistreambuf_iter istrb_it22(istrs01.rdbuf());
+ VERIFY( istrb_it22 == istrb_it21 );
+
+ cistreambuf_iter istrb_it23(istrs01);
+ cistreambuf_iter istrb_it24;
+ VERIFY( istrb_it23 != istrb_it24 );
+
+ cistreambuf_iter istrb_it25(0);
+ cistreambuf_iter istrb_it26(istrs01.rdbuf());
+ VERIFY( istrb_it25 != istrb_it26 );
+
+ // charT operator*() const
+ // istreambuf_iterator& operator++();
+ // istreambuf_iterator& operator++(int);
+ cistreambuf_iter istrb_it27(istrs01.rdbuf());
+ char c;
+ for (std::size_t i = 0; i < sizeof(slit01) - 2; ++i)
+ {
+ c = *istrb_it27++;
+ VERIFY( c == slit01[i] );
+ }
+
+ std::istringstream istrs02(str01);
+ cistreambuf_iter istrb_it28(istrs02);
+ for (std::size_t i = 0; i < sizeof(slit01) - 2;)
+ {
+ c = *++istrb_it28;
+ VERIFY( c == slit01[++i] );
+ }
+ return test;
+}
+
+int main()
+{
+ test02();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/24_iterators/istreambuf_iterator/2627.cc b/libstdc++-v3/testsuite/24_iterators/istreambuf_iterator/2627.cc
new file mode 100644
index 00000000000..ad6d0393b6c
--- /dev/null
+++ b/libstdc++-v3/testsuite/24_iterators/istreambuf_iterator/2627.cc
@@ -0,0 +1,67 @@
+// 1999-06-28 bkoz
+
+// Copyright (C) 1999, 2001, 2003 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 2, 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 COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 24.5.3 template class istreambuf_iterator
+
+#include <sstream>
+#include <iterator>
+#include <testsuite_hooks.h>
+
+// libstdc++/2627
+void test03()
+{
+ bool test __attribute__((unused)) = true;
+ const std::string s("free the vieques");
+
+ // 1
+ std::string res_postfix;
+ std::istringstream iss01(s);
+ std::istreambuf_iterator<char> isbufit01(iss01);
+ for (std::size_t j = 0; j < s.size(); ++j, isbufit01++)
+ res_postfix += *isbufit01;
+
+ // 2
+ std::string res_prefix;
+ std::istringstream iss02(s);
+ std::istreambuf_iterator<char> isbufit02(iss02);
+ for (std::size_t j = 0; j < s.size(); ++j, ++isbufit02)
+ res_prefix += *isbufit02;
+
+ // 3 mixed
+ std::string res_mixed;
+ std::istringstream iss03(s);
+ std::istreambuf_iterator<char> isbufit03(iss03);
+ for (std::size_t j = 0; j < (s.size() / 2); ++j)
+ {
+ res_mixed += *isbufit03;
+ ++isbufit03;
+ res_mixed += *isbufit03;
+ isbufit03++;
+ }
+
+ VERIFY ( res_postfix == res_prefix );
+ VERIFY ( res_mixed == res_prefix );
+}
+
+int main()
+{
+ test03();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/24_iterators/ostreambuf_iterator/1.cc b/libstdc++-v3/testsuite/24_iterators/ostreambuf_iterator/1.cc
new file mode 100644
index 00000000000..d654d600158
--- /dev/null
+++ b/libstdc++-v3/testsuite/24_iterators/ostreambuf_iterator/1.cc
@@ -0,0 +1,50 @@
+// { dg-do compile }
+// 2001-04-30 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2003 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 2, 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 COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 24.5.4 template class ostreambuf_iterator
+
+#include <sstream>
+#include <iterator>
+#include <testsuite_hooks.h>
+
+void test01()
+{
+ using namespace std;
+
+ // Check for required base class.
+ typedef ostreambuf_iterator<char> test_iterator;
+ typedef iterator<output_iterator_tag, void, void, void, void> base_iterator;
+ ostringstream osstream("this tag");
+ test_iterator r_it(osstream);
+ base_iterator* base __attribute__((unused)) = &r_it;
+
+ // Check for required typedefs
+ typedef test_iterator::value_type value_type;
+ typedef test_iterator::difference_type difference_type;
+ typedef test_iterator::pointer pointer;
+ typedef test_iterator::reference reference;
+ typedef test_iterator::iterator_category iteratory_category;
+
+ typedef test_iterator::char_type char_type;
+ typedef test_iterator::traits_type traits_type;
+ typedef test_iterator::ostream_type ostream_type;
+ typedef test_iterator::streambuf_type streambuf_type;
+}
diff --git a/libstdc++-v3/testsuite/24_iterators/ostreambuf_iterator/2.cc b/libstdc++-v3/testsuite/24_iterators/ostreambuf_iterator/2.cc
new file mode 100644
index 00000000000..f294174e918
--- /dev/null
+++ b/libstdc++-v3/testsuite/24_iterators/ostreambuf_iterator/2.cc
@@ -0,0 +1,92 @@
+// 2001-04-30 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2003 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 2, 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 COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 24.5.4 template class ostreambuf_iterator
+
+#include <sstream>
+#include <iterator>
+#include <testsuite_hooks.h>
+
+bool test02(void)
+{
+ typedef std::ostreambuf_iterator<char> costreambuf_iter;
+ typedef costreambuf_iter::streambuf_type cstreambuf_type;
+ bool test __attribute__((unused)) = true;
+ const char slit01[] = "playa hermosa, liberia, guanacaste";
+ const char slit02[] = "bodega bay, lost coast, california";
+ std::string str01(slit01);
+ std::string str02(slit02);
+ std::string tmp;
+ std::stringbuf strbuf01;
+ std::stringbuf strbuf02(str01);
+ std::ostringstream ostrs00(str01);
+ std::ostringstream ostrs01(str01);
+
+ // ctor sanity checks
+ costreambuf_iter ostrb_it01(ostrs00);
+ VERIFY( !ostrb_it01.failed() );
+ ostrb_it01++;
+ ++ostrb_it01;
+ VERIFY( !ostrb_it01.failed() );
+ ostrb_it01 = 'a';
+ VERIFY( !ostrb_it01.failed() );
+ *ostrb_it01;
+ VERIFY( !ostrb_it01.failed() );
+
+ costreambuf_iter ostrb_it02(NULL);
+ VERIFY( ostrb_it02.failed() );
+ ostrb_it02++;
+ ++ostrb_it02;
+ VERIFY( ostrb_it02.failed() );
+ *ostrb_it02;
+ VERIFY( ostrb_it02.failed() );
+ ostrb_it02 = 'a';
+ VERIFY( ostrb_it02.failed() );
+
+ // charT operator*() const
+ // ostreambuf_iterator& operator++();
+ // ostreambuf_iterator& operator++(int);
+ costreambuf_iter ostrb_it27(ostrs01);
+ VERIFY( !ostrb_it27.failed() );
+ int j = str02.size();
+ for (int i = 0; i < j; ++i)
+ ostrb_it27 = str02[i];
+ VERIFY( !ostrb_it27.failed() );
+ tmp = ostrs01.str();
+ VERIFY ( tmp != str01 );
+ VERIFY ( tmp == str02 );
+
+ costreambuf_iter ostrb_it28(ostrs00);
+ VERIFY( !ostrb_it28.failed() );
+ j = ostrs00.str().size();
+ for (int i = 0; i < j + 2; ++i)
+ ostrb_it28 = 'b';
+ VERIFY( !ostrb_it28.failed() );
+ tmp = ostrs00.str();
+ VERIFY ( tmp != str01 );
+ VERIFY ( tmp != str02 );
+ return test;
+}
+
+int main()
+{
+ test02();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/basic_filebuf/imbue/wchar_t/12868.cc b/libstdc++-v3/testsuite/27_io/basic_filebuf/imbue/wchar_t/12868.cc
new file mode 100644
index 00000000000..8e4484b1472
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_filebuf/imbue/wchar_t/12868.cc
@@ -0,0 +1,60 @@
+// Copyright (C) 2003 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 2, 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 COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// 27.8.1.4 Overridden virtual functions
+
+#include <ostream>
+#include <fstream>
+#include <locale>
+#include <string>
+#include <testsuite_hooks.h>
+
+// libstdc++/12868
+void test01()
+{
+ using namespace std;
+ bool test __attribute__((unused)) = true;
+
+ locale loc_is(__gnu_test::try_named_locale("is_IS"));
+
+ {
+ wofstream out("tmp_12868");
+ out << L"<? xml version=\"1.0\" encoding=\"UTF-8\" ?>\n";
+ out.imbue(loc_is);
+ VERIFY( out.rdbuf()->getloc() == loc_is );
+ out << L"<greeting>Hall\u00f3 heimur</greeting>\n";
+ }
+
+ {
+ wifstream in("tmp_12868");
+ wstring str;
+ getline(in, str);
+ if (str.find(L"encoding=\"UTF-8\"") != wstring::npos)
+ {
+ in.imbue(loc_is);
+ VERIFY( in.rdbuf()->getloc() == loc_is );
+ }
+ getline(in, str);
+ VERIFY( str == L"<greeting>Hall\u00f3 heimur</greeting>" );
+ }
+}
+
+int main()
+{
+ test01();
+}
diff --git a/libstdc++-v3/testsuite/performance/wchar_t_in.cc b/libstdc++-v3/testsuite/performance/wchar_t_in.cc
new file mode 100644
index 00000000000..43e09e39a78
--- /dev/null
+++ b/libstdc++-v3/testsuite/performance/wchar_t_in.cc
@@ -0,0 +1,84 @@
+// Copyright (C) 2003 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 2, 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 COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+#include <cstdio>
+#include <cstring>
+#include <fstream>
+#include <langinfo.h>
+#include <iconv.h>
+#include <testsuite_performance.h>
+
+// libstdc++/11602 (do_in)
+int main(int argc, char** argv)
+{
+ using namespace std;
+ using namespace __gnu_test;
+
+ time_counter time;
+ resource_counter resource;
+ const int iters = 400000;
+
+ wchar_t wbuf[1024];
+ char cbuf[1024];
+
+ memset(cbuf, 'a', 1024);
+
+ // C (iconv)
+ iconv_t cd = iconv_open("WCHAR_T", nl_langinfo(CODESET));
+ start_counters(time, resource);
+ for (int i = 0; i < iters; ++i)
+ {
+ size_t inbytesleft = 1024;
+ size_t outbytesleft = 1024 * sizeof(wchar_t);
+ char* in = cbuf;
+ char* out = reinterpret_cast<char*>(wbuf);
+ iconv(cd, &in, &inbytesleft, &out, &outbytesleft);
+ }
+ stop_counters(time, resource);
+ iconv_close(cd);
+ report_performance(__FILE__, "C (iconv)", time, resource);
+ clear_counters(time, resource);
+
+ // C++ (codecvt)
+ locale loc;
+ const codecvt<wchar_t, char, mbstate_t>& cvt =
+ use_facet<codecvt<wchar_t, char, mbstate_t> >(loc);
+ mbstate_t state;
+ memset(&state, 0, sizeof(state));
+ start_counters(time, resource);
+ for (int i = 0; i < iters; ++i)
+ {
+ const char* from_next;
+ wchar_t* to_next;
+ cvt.in(state, cbuf, cbuf + 1024, from_next,
+ wbuf, wbuf + 1024, to_next);
+ }
+ stop_counters(time, resource);
+ report_performance(__FILE__, "C++ (codecvt)", time, resource);
+
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/performance/wchar_t_out.cc b/libstdc++-v3/testsuite/performance/wchar_t_out.cc
new file mode 100644
index 00000000000..4e5106817d0
--- /dev/null
+++ b/libstdc++-v3/testsuite/performance/wchar_t_out.cc
@@ -0,0 +1,84 @@
+// Copyright (C) 2003 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 2, 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 COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+#include <cstdio>
+#include <cstring>
+#include <fstream>
+#include <langinfo.h>
+#include <iconv.h>
+#include <testsuite_performance.h>
+
+// libstdc++/11602
+int main(int argc, char** argv)
+{
+ using namespace std;
+ using namespace __gnu_test;
+
+ time_counter time;
+ resource_counter resource;
+ const int iters = 300000;
+
+ wchar_t wbuf[1024];
+ char cbuf[1024];
+
+ wmemset(wbuf, L'a', 1024);
+
+ // C (iconv)
+ iconv_t cd = iconv_open(nl_langinfo(CODESET), "WCHAR_T");
+ start_counters(time, resource);
+ for (int i = 0; i < iters; ++i)
+ {
+ size_t inbytesleft = 1024 * sizeof(wchar_t);
+ size_t outbytesleft = 1024;
+ char* in = reinterpret_cast<char*>(wbuf);
+ char* out = cbuf;
+ iconv(cd, &in, &inbytesleft, &out, &outbytesleft);
+ }
+ stop_counters(time, resource);
+ iconv_close(cd);
+ report_performance(__FILE__, "C (iconv)", time, resource);
+ clear_counters(time, resource);
+
+ // C++ (codecvt)
+ locale loc;
+ const codecvt<wchar_t, char, mbstate_t>& cvt =
+ use_facet<codecvt<wchar_t, char, mbstate_t> >(loc);
+ mbstate_t state;
+ memset(&state, 0, sizeof(state));
+ start_counters(time, resource);
+ for (int i = 0; i < iters; ++i)
+ {
+ const wchar_t* from_next;
+ char* to_next;
+ cvt.out(state, wbuf, wbuf + 1024, from_next,
+ cbuf, cbuf + 1024, to_next);
+ }
+ stop_counters(time, resource);
+ report_performance(__FILE__, "C++ (codecvt)", time, resource);
+
+ return 0;
+}