aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author(no author) <(no author)@138bc75d-0d04-0410-961f-82ee72b054a4>2003-01-25 11:08:38 +0000
committer(no author) <(no author)@138bc75d-0d04-0410-961f-82ee72b054a4>2003-01-25 11:08:38 +0000
commitdd2ee89a9c8bec0cad0bbccb4e98ff0ff9f3af16 (patch)
tree4d8d91715f51f489e34bf6ed1b74338555a3f82e
parent6528f4f4ea9457e6678f0bec085febfdd9d93875 (diff)
This commit was manufactured by cvs2svn to create tagrtlopt-merge-20030125
'rtlopt-merge-20030125'. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/tags/rtlopt-merge-20030125@61765 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--ChangeLog5
-rw-r--r--MAINTAINERS3
-rw-r--r--fastjar/ChangeLog34
-rw-r--r--gcc/config/i386/scodbx.h84
-rw-r--r--gcc/config/i386/xm-dgux.h4
-rw-r--r--gcc/config/i386/xm-sun.h21
-rw-r--r--gcc/config/i386/xm-sysv3.h3
-rw-r--r--gcc/testsuite/g++.old-deja/g++.robertl/eb42.C19
-rw-r--r--libiberty/ChangeLog28
-rw-r--r--libiberty/Makefile.in20
-rwxr-xr-xlibiberty/configure37
-rw-r--r--libiberty/configure.in12
-rw-r--r--libiberty/functions.texi33
-rw-r--r--libiberty/pex-common.h42
-rw-r--r--libiberty/pex-djgpp.c103
-rw-r--r--libiberty/pex-mpw.c161
-rw-r--r--libiberty/pex-msdos.c147
-rw-r--r--libiberty/pex-os2.c72
-rw-r--r--libiberty/pex-unix.c166
-rw-r--r--libiberty/pex-win32.c243
-rw-r--r--libiberty/pexecute.c792
-rw-r--r--libiberty/pexecute.txh63
-rw-r--r--libjava/ChangeLog26
-rw-r--r--libjava/defineclass.cc21
-rw-r--r--libjava/include/java-interp.h3
-rw-r--r--libjava/interpret.cc47
-rw-r--r--libjava/java/io/natFileWin32.cc6
-rw-r--r--libjava/java/lang/ClassLoader.java5
-rw-r--r--libjava/resolve.cc8
-rw-r--r--libjava/testsuite/ChangeLog17
-rw-r--r--libjava/testsuite/libjava.jni/calls.c2
-rw-r--r--libjava/testsuite/libjava.jni/field.c2
-rw-r--r--libjava/testsuite/libjava.jni/final_method.c2
-rw-r--r--libjava/testsuite/libjava.jni/findclass.c2
-rw-r--r--libjava/testsuite/libjava.jni/invoke.c2
-rw-r--r--libjava/testsuite/libjava.jni/martin.c3
-rw-r--r--libjava/testsuite/libjava.jni/noclass.c2
-rw-r--r--libjava/testsuite/libjava.jni/overload.c4
-rw-r--r--libjava/testsuite/libjava.jni/register.c2
-rw-r--r--libjava/testsuite/libjava.jni/simple_int.c2
-rw-r--r--libjava/testsuite/libjava.jni/throwit.c2
-rw-r--r--libjava/testsuite/libjava.jni/virtual.c2
-rw-r--r--libstdc++-v3/ChangeLog13
-rw-r--r--libstdc++-v3/config/linker-map.gnu4
-rw-r--r--libstdc++-v3/include/Makefile.am3
-rw-r--r--libstdc++-v3/include/Makefile.in3
-rw-r--r--libstdc++-v3/include/bits/c++config2
-rw-r--r--libstdc++-v3/include/bits/valarray_before.h701
-rw-r--r--libstdc++-v3/include/bits/valarray_meta.h (renamed from libstdc++-v3/include/bits/valarray_after.h)658
-rw-r--r--libstdc++-v3/include/std/std_valarray.h6
50 files changed, 1562 insertions, 2080 deletions
diff --git a/ChangeLog b/ChangeLog
index 91b32b17a98..c61c350caaa 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,8 +1,3 @@
-2003-01-25 Gerald Pfeifer <pfeifer@dbai.tuwien.ac.at>
-
- * MAINTAINERS: Remove incorrect entry for Paul Eggert. Fix
- entry of HJ Lu.
-
2003-01-23 Nathanael Nerode <neroden@gcc.gnu.org>
* configure.in: Revert previous change.
diff --git a/MAINTAINERS b/MAINTAINERS
index 9309c397beb..014e8d0fbb8 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -175,6 +175,7 @@ Andrew Cagney cagney@redhat.com
Chandra Chavva cchavva@redhat.com
William Cohen wcohen@redhat.com
Chris Demetriou cgd@broadcom.com
+*Paul Eggert eggert@twinsun.com
Steve Ellcey sje@cup.hp.com
Ben Elliston bje@redhat.com
Marc Espie espie@cvs.openbsd.org
@@ -207,7 +208,7 @@ Kriang Lerdsuwanakij lerdsuwa@users.sourceforge.net
Don Lindsay dlindsay@redhat.com
Dave Love d.love@dl.ac.uk
Martin v. Löwis loewis@informatik.hu-berlin.de
-HJ Lu hjl@lucon.org
+*HJ Lu hjl@lucon.org
Andrew Macleod amacleod@redhat.com
Vladimir Makarov vmakarov@redhat.com
Michael Matz matz@suse.de
diff --git a/fastjar/ChangeLog b/fastjar/ChangeLog
index a924b717823..d6482fa313c 100644
--- a/fastjar/ChangeLog
+++ b/fastjar/ChangeLog
@@ -4,6 +4,40 @@
with a '\0' to guard against the case where the formatted
time string is more than the size allowed by the buffer.
+Patch:
+-------------------------- 8< --------------------------
+--- ChangeLog Mon Jan 20 23:27:56 2003
++++ ChangeLog Mon Jan 20 23:31:42 2003
+@@ -1572,5 +1572,5 @@
+ time_t tdate;
+ struct tm *s_tm;
+- char ascii_date[30];
++ char ascii_date[31];
+ zipentry ze;
+
+@@ -1663,4 +1663,5 @@
+ s_tm = localtime(&tdate);
+ strftime(ascii_date, 30, "%a %b %d %H:%M:%S %Z %Y", s_tm);
++ ascii_date[30] = '\0';
+ }
+
+@@ -1782,4 +1783,5 @@
+ s_tm = localtime(&tdate);
+ strftime(ascii_date, 30, "%a %b %d %H:%M:%S %Z %Y", s_tm);
++ ascii_date[30] = '\0';
+ }
+
+-------------------------- 8< --------------------------
+
+Sincerely Yours,
+Ranjit.
+
+--
+Ranjit Mathew Email: rmathew AT hotmail DOT com
+Bangalore,
+INDIA. Web: http://ranjitmathew.tripod.com/
+
+
2003-01-14 Tom Tromey <tromey@redhat.com>
* config.h.in: Rebuilt.
diff --git a/gcc/config/i386/scodbx.h b/gcc/config/i386/scodbx.h
deleted file mode 100644
index 7da93053256..00000000000
--- a/gcc/config/i386/scodbx.h
+++ /dev/null
@@ -1,84 +0,0 @@
-/* Definitions for Intel 386 running SCO Unix System V,
- using dbx-in-coff encapsulation.
- Copyright (C) 1992, 1995, 1996, 1999 Free Software Foundation, Inc.
-
-This file is part of GNU CC.
-
-GNU CC 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 CC 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 CC; see the file COPYING. If not, write to
-the Free Software Foundation, 59 Temple Place - Suite 330,
-Boston, MA 02111-1307, USA. */
-
-#include "i386/svr3dbx.h"
-
-/* Overridden defines for SCO systems from sco.h. */
-
-/* By default, target has a 80387, uses IEEE compatible arithmetic,
- and returns float values in the 387, ie,
- (TARGET_80387 | TARGET_FLOAT_RETURNS_IN_80387)
-
- SCO's software emulation of a 387 fails to handle the `fucomp'
- opcode. fucomp is only used when generating IEEE compliant code.
- So don't make TARGET_IEEE_FP default for SCO. */
-
-#undef TARGET_SUBTARGET_DEFAULT
-#define TARGET_SUBTARGET_DEFAULT (MASK_80387 | MASK_FLOAT_RETURNS)
-
-/* Use crt1.o as a startup file and crtn.o as a closing file. */
-
-#undef STARTFILE_SPEC
-#define STARTFILE_SPEC \
- "%{!r:%{!z:svr3.ifile%s}%{z:svr3z.ifile%s}}\
- %{pg:gcrt1.o%s}%{!pg:%{p:mcrt1.o%s}%{!p:crt1.o%s}}"
-
-/* Library spec, including SCO international language support. */
-
-#undef LIB_SPEC
-#define LIB_SPEC \
- "%{p:-L/usr/lib/libp}%{pg:-L/usr/lib/libp} %{scointl:libintl.a%s} -lc"
-
-/* Specify predefined symbols in preprocessor. */
-
-#undef CPP_PREDEFINES
-#define CPP_PREDEFINES "-Dunix -DM_UNIX -DM_I386 -DM_COFF -DM_WORDSWAP -Asystem=svr3"
-
-#undef CPP_SPEC
-#define CPP_SPEC "%(cpp_cpu) %{scointl:-DM_INTERNAT}"
-
-/* This spec is used for telling cpp whether char is signed or not. */
-
-#undef SIGNED_CHAR_SPEC
-#if DEFAULT_SIGNED_CHAR
-#define SIGNED_CHAR_SPEC \
- "%{funsigned-char:-D__CHAR_UNSIGNED__ -D_CHAR_UNSIGNED}"
-#else
-#define SIGNED_CHAR_SPEC \
- "%{!fsigned-char:-D__CHAR_UNSIGNED__ -D_CHAR_UNSIGNED}"
-#endif
-
-/* caller has to pop the extra argument passed to functions that return
- structures. */
-
-#undef RETURN_POPS_ARGS
-#define RETURN_POPS_ARGS(FUNDECL,FUNTYPE,SIZE) \
- ((FUNDECL) && TREE_CODE (FUNDECL) == IDENTIFIER_NODE ? 0 \
- : (TARGET_RTD \
- && (TYPE_ARG_TYPES (FUNTYPE) == 0 \
- || (TREE_VALUE (tree_last (TYPE_ARG_TYPES (FUNTYPE))) \
- == void_type_node))) ? (SIZE) \
- : 0)
-/* On other 386 systems, the last line looks like this:
- : (aggregate_value_p (TREE_TYPE (FUNTYPE))) ? GET_MODE_SIZE (Pmode) : 0) */
-
-/* Handle #pragma pack. */
-#define HANDLE_SYSV_PRAGMA
diff --git a/gcc/config/i386/xm-dgux.h b/gcc/config/i386/xm-dgux.h
deleted file mode 100644
index 881c5c7be9d..00000000000
--- a/gcc/config/i386/xm-dgux.h
+++ /dev/null
@@ -1,4 +0,0 @@
-/* Configuration for GCC for Intel i386 running DG/ux */
-
-/* looks just like sysv4 for now */
-#include "xm-svr4.h"
diff --git a/gcc/config/i386/xm-sun.h b/gcc/config/i386/xm-sun.h
deleted file mode 100644
index 6c0f0a25630..00000000000
--- a/gcc/config/i386/xm-sun.h
+++ /dev/null
@@ -1,21 +0,0 @@
-/* Configuration for GNU C-compiler for Intel 80386 running SunOS 4.0.
- Copyright (C) 1988, 1997 Free Software Foundation, Inc.
-
-This file is part of GNU CC.
-
-GNU CC 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 CC 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 CC; see the file COPYING. If not, write to
-the Free Software Foundation, 59 Temple Place - Suite 330,
-Boston, MA 02111-1307, USA. */
-
-#define USG
diff --git a/gcc/config/i386/xm-sysv3.h b/gcc/config/i386/xm-sysv3.h
deleted file mode 100644
index 9a655443ff5..00000000000
--- a/gcc/config/i386/xm-sysv3.h
+++ /dev/null
@@ -1,3 +0,0 @@
-/* Configuration for GCC for Intel i386 running System V Release 3. */
-
-#include "xm-svr3.h"
diff --git a/gcc/testsuite/g++.old-deja/g++.robertl/eb42.C b/gcc/testsuite/g++.old-deja/g++.robertl/eb42.C
deleted file mode 100644
index c27aa8d2df7..00000000000
--- a/gcc/testsuite/g++.old-deja/g++.robertl/eb42.C
+++ /dev/null
@@ -1,19 +0,0 @@
-//Build don't link:
-#include <vector>
-#include <algorithm>
-
-template <class T> class Expr
-{
-public :
-Expr(){};
-Expr(const T&){};
-};
-
-template <class T >
-inline bool compare(const Expr<T> a, const Expr<T> b){ return true; };
-
-int main()
-{
- std::vector<int> a(3);
- std::sort( a.begin(), a.end(), compare ); // ERROR - no matching function
-}
diff --git a/libiberty/ChangeLog b/libiberty/ChangeLog
index 1c5a620fb2f..e8f0ce2d397 100644
--- a/libiberty/ChangeLog
+++ b/libiberty/ChangeLog
@@ -1,31 +1,3 @@
-2003-01-24 Christopher Faylor <cgf@redhat.com>
-
- * configure.in: Remove special pex-cygwin consideration.
- * configure: Regenerate.
- * pex-cygwin.c: Remove.
- * Makefile.in: Remove pex-cygwin.[co] lines.
-
-2003-01-24 Zack Weinberg <zack@codesourcery.com>
-
- * Makefile.in (CFILES): Add pex-*.c.
- (REQUIRED_OFILES): Change pexecute.o to @pexecute@
- (CONFIGURED_OFILES): Add pex-*.o.
- (TEXIFILES): Add pexecute.txh.
- (pexecute.o): Delete rule.
- (pex-cygwin.o, pex-djgpp.o, pex-mpw.o, pex-msdos.o, pex-os2.o,
- pex-unix.o, pex-win32.o): New rules.
- * configure.in: Change AC_INIT argument to xmalloc.c.
- Compute appropriate pexecute implementation and substitute it
- as @pexecute@.
-
- * pexecute.c: Split up into...
- * pex-cygwin.c, pex-djgpp.c, pex-mpw.c, pex-msdos.c, pex-os2.c,
- pex-unix.c, pex-win32.c, pex-common.h, pexecute.txh: ... these
- new files.
-
- * functions.texi: Regenerate.
- * configure: Regenerate.
-
2003-01-20 Josef Zlomek <zlomekj@suse.cz>
* hashtab.c (htab_expand): Fix allocation of new entries.
diff --git a/libiberty/Makefile.in b/libiberty/Makefile.in
index c5162f47bc9..1af4c32277e 100644
--- a/libiberty/Makefile.in
+++ b/libiberty/Makefile.in
@@ -140,10 +140,7 @@ CFILES = alloca.c argv.c asprintf.c atexit.c \
make-temp-file.c md5.c memchr.c memcmp.c memcpy.c memmove.c \
memset.c mkstemps.c \
objalloc.c obstack.c \
- partition.c \
- pex-djgpp.c pex-mpw.c pex-msdos.c pex-os2.c \
- pex-unix.c pex-win32.c \
- putenv.c \
+ partition.c pexecute.c putenv.c \
random.c regex.c rename.c rindex.c \
safe-ctype.c setenv.c sigsetmask.c sort.c spaces.c \
splay-tree.c strcasecmp.c strchr.c strdup.c strerror.c \
@@ -167,7 +164,7 @@ REQUIRED_OFILES = regex.o cplus-dem.o cp-demangle.o md5.o \
make-relative-prefix.o \
make-temp-file.o \
objalloc.o obstack.o \
- partition.o @pexecute@ \
+ partition.o pexecute.o \
safe-ctype.o sort.o spaces.o splay-tree.o strerror.o \
strsignal.o \
ternary.o \
@@ -184,9 +181,7 @@ CONFIGURED_OFILES = asprintf.o atexit.o \
getcwd.o getpagesize.o \
index.o insque.o \
memchr.o memcmp.o memcpy.o memmove.o memset.o mkstemps.o \
- pex-djgpp.o pex-mpw.o pex-msdos.o pex-os2.o \
- pex-unix.o pex-win32.o \
- putenv.o \
+ putenv.o \
random.o rename.o rindex.o \
setenv.o sigsetmask.o strcasecmp.o strchr.o strdup.o \
strncasecmp.o strncmp.o strrchr.o strstr.o strtod.o strtol.o \
@@ -245,7 +240,7 @@ TEXISRC = \
# Additional files that have texi snippets that need to be collected
# and sorted. Some are here because the sources are imported from
# elsewhere. Others represent headers in ../include.
-TEXIFILES = fnmatch.txh pexecute.txh
+TEXIFILES = fnmatch.txh
libiberty.info : $(srcdir)/libiberty.texi $(TEXISRC)
$(MAKEINFO) -I$(srcdir) $(srcdir)/libiberty.texi
@@ -455,13 +450,8 @@ objalloc.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/objalloc.h
obstack.o: config.h $(INCDIR)/obstack.h
partition.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h \
$(INCDIR)/partition.h
-pex-djgpp.o: config.h pex-common.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h
-pex-mpw.o: config.h pex-common.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h
-pex-msdos.o: config.h pex-common.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h \
+pexecute.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h \
$(INCDIR)/safe-ctype.h
-pex-os2.o: config.h pex-common.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h
-pex-unix.o: config.h pex-common.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h
-pex-win32.o: config.h pex-common.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h
putenv.o: config.h $(INCDIR)/ansidecl.h
random.o: $(INCDIR)/ansidecl.h
regex.o: config.h $(INCDIR)/xregex.h $(INCDIR)/xregex2.h
diff --git a/libiberty/configure b/libiberty/configure
index b988bfe6c14..cac9f5637a9 100755
--- a/libiberty/configure
+++ b/libiberty/configure
@@ -465,7 +465,7 @@ echo > confdefs.h
# A filename unique to this package, relative to the directory that
# configure is in, which we can look for to find out if srcdir is correct.
-ac_unique_file=xmalloc.c
+ac_unique_file=pexecute.c
# Find the source files, if location was not specified.
if test -z "$srcdir"; then
@@ -2993,31 +2993,21 @@ done
fi
-# Figure out which version of pexecute to use.
-case "${host}" in
- *-*-mingw* | *-*-winnt*) pexecute=pex-win32.o ;;
- *-*-msdosdjgpp*) pexecute=pex-djgpp.o ;;
- *-*-msdos*) pexecute=pex-msdos.o ;;
- *-*-os2-emx*) pexecute=pex-os2.o ;;
- *) pexecute=pex-unix.o ;;
-esac
-
-
for ac_hdr in stdlib.h unistd.h sys/stat.h sys/types.h
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:3011: checking for $ac_hdr" >&5
+echo "configure:3001: checking for $ac_hdr" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 3016 "configure"
+#line 3006 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:3021: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:3011: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
@@ -3046,12 +3036,12 @@ done
for ac_func in getpagesize
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:3050: checking for $ac_func" >&5
+echo "configure:3040: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 3055 "configure"
+#line 3045 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -3074,7 +3064,7 @@ $ac_func();
; return 0; }
EOF
-if { (eval echo configure:3078: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3068: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@@ -3099,7 +3089,7 @@ fi
done
echo $ac_n "checking for working mmap""... $ac_c" 1>&6
-echo "configure:3103: checking for working mmap" >&5
+echo "configure:3093: checking for working mmap" >&5
if eval "test \"`echo '$''{'ac_cv_func_mmap_fixed_mapped'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -3107,7 +3097,7 @@ else
ac_cv_func_mmap_fixed_mapped=no
else
cat > conftest.$ac_ext <<EOF
-#line 3111 "configure"
+#line 3101 "configure"
#include "confdefs.h"
/* Thanks to Mike Haertel and Jim Avera for this test.
@@ -3260,7 +3250,7 @@ main()
}
EOF
-if { (eval echo configure:3264: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:3254: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
ac_cv_func_mmap_fixed_mapped=yes
else
@@ -3284,7 +3274,7 @@ fi
echo $ac_n "checking for working strncmp""... $ac_c" 1>&6
-echo "configure:3288: checking for working strncmp" >&5
+echo "configure:3278: checking for working strncmp" >&5
if eval "test \"`echo '$''{'ac_cv_func_strncmp_works'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -3292,7 +3282,7 @@ else
ac_cv_func_strncmp_works=no
else
cat > conftest.$ac_ext <<EOF
-#line 3296 "configure"
+#line 3286 "configure"
#include "confdefs.h"
/* Test by Jim Wilson and Kaveh Ghazi.
@@ -3356,7 +3346,7 @@ main ()
}
EOF
-if { (eval echo configure:3360: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:3350: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
ac_cv_func_strncmp_works=yes
else
@@ -3551,7 +3541,6 @@ s%@CPP@%$CPP%g
s%@CHECK@%$CHECK%g
s%@target_header_dir@%$target_header_dir%g
s%@LIBOBJS@%$LIBOBJS%g
-s%@pexecute@%$pexecute%g
s%@INSTALL_DEST@%$INSTALL_DEST%g
CEOF
diff --git a/libiberty/configure.in b/libiberty/configure.in
index c5f510e80cc..a8dc66fa83c 100644
--- a/libiberty/configure.in
+++ b/libiberty/configure.in
@@ -1,7 +1,7 @@
dnl Process this file with autoconf to produce a configure script
AC_PREREQ(2.13)
-AC_INIT(xmalloc.c)
+AC_INIT(pexecute.c)
# This works around the fact that libtool configuration may change LD
# for this particular configuration, but some shells, instead of
@@ -425,16 +425,6 @@ if test -z "${setobjs}"; then
AC_CHECK_FUNCS($checkfuncs)
fi
-# Figure out which version of pexecute to use.
-case "${host}" in
- *-*-mingw* | *-*-winnt*) pexecute=pex-win32.o ;;
- *-*-msdosdjgpp*) pexecute=pex-djgpp.o ;;
- *-*-msdos*) pexecute=pex-msdos.o ;;
- *-*-os2-emx*) pexecute=pex-os2.o ;;
- *) pexecute=pex-unix.o ;;
-esac
-AC_SUBST(pexecute)
-
libiberty_AC_FUNC_STRNCMP
# Install a library built with a cross compiler in $(tooldir) rather
diff --git a/libiberty/functions.texi b/libiberty/functions.texi
index 18b2480a781..7d9c181d219 100644
--- a/libiberty/functions.texi
+++ b/libiberty/functions.texi
@@ -483,7 +483,7 @@ reading and writing.
@end deftypefn
-@c pexecute.txh:1
+@c pexecute.c:67
@deftypefn Extension int pexecute (const char *@var{program}, char * const *@var{argv}, const char *@var{this_pname}, const char *@var{temp_base}, char **@var{errmsg_fmt}, char **@var{errmsg_arg}, int flags)
Executes a program.
@@ -498,15 +498,14 @@ use if needed. This is currently only needed for MS-DOS ports that
don't use @code{go32} (do any still exist?). Ports that don't need it
can pass @code{NULL}.
-(@code{@var{flags} & PEXECUTE_SEARCH}) is non-zero if @env{PATH}
-should be searched (??? It's not clear that GCC passes this flag
-correctly). (@code{@var{flags} & PEXECUTE_FIRST}) is nonzero for the
-first process in chain. (@code{@var{flags} & PEXECUTE_FIRST}) is
-nonzero for the last process in chain. The first/last flags could be
-simplified to only mark the last of a chain of processes but that
-requires the caller to always mark the last one (and not give up
-early if some error occurs). It's more robust to require the caller
-to mark both ends of the chain.
+(@code{@var{flags} & PEXECUTE_SEARCH}) is non-zero if @env{PATH} should be searched
+(??? It's not clear that GCC passes this flag correctly). (@code{@var{flags} &
+PEXECUTE_FIRST}) is nonzero for the first process in chain.
+(@code{@var{flags} & PEXECUTE_FIRST}) is nonzero for the last process
+in chain. The first/last flags could be simplified to only mark the
+last of a chain of processes but that requires the caller to always
+mark the last one (and not give up early if some error occurs).
+It's more robust to require the caller to mark both ends of the chain.
The result is the pid on systems like Unix where we
@code{fork}/@code{exec} and on systems like WIN32 and OS/2 where we
@@ -541,23 +540,21 @@ name is unset/removed.
@end deftypefn
-@c pexecute.txh:39
+@c pexecute.c:104
@deftypefn Extension int pwait (int @var{pid}, int *@var{status}, int @var{flags})
Waits for a program started by @code{pexecute} to finish.
@var{pid} is the process id of the task to wait for. @var{status} is
-the `status' argument to wait. @var{flags} is currently unused
-(allows future enhancement without breaking upward compatibility).
-Pass 0 for now.
+the `status' argument to wait. @var{flags} is currently unused (allows
+future enhancement without breaking upward compatibility). Pass 0 for now.
The result is the pid of the child reaped, or -1 for failure
(@code{errno} says why).
-On systems that don't support waiting for a particular child,
-@var{pid} is ignored. On systems like MS-DOS that don't really
-multitask @code{pwait} is just a mechanism to provide a consistent
-interface for the caller.
+On systems that don't support waiting for a particular child, @var{pid} is
+ignored. On systems like MS-DOS that don't really multitask @code{pwait}
+is just a mechanism to provide a consistent interface for the caller.
@end deftypefn
diff --git a/libiberty/pex-common.h b/libiberty/pex-common.h
deleted file mode 100644
index da2f71e1247..00000000000
--- a/libiberty/pex-common.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/* Utilities to execute a program in a subprocess (possibly linked by pipes
- with other subprocesses), and wait for it. Shared logic.
- Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003
- Free Software Foundation, Inc.
-
-This file is part of the libiberty library.
-Libiberty is free software; you can redistribute it and/or
-modify it under the terms of the GNU Library General Public
-License as published by the Free Software Foundation; either
-version 2 of the License, or (at your option) any later version.
-
-Libiberty 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
-Library General Public License for more details.
-
-You should have received a copy of the GNU Library General Public
-License along with libiberty; see the file COPYING.LIB. If not,
-write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-Boston, MA 02111-1307, USA. */
-
-#ifndef PEX_COMMON_H
-#define PEX_COMMON_H
-
-#include "config.h"
-#include "libiberty.h"
-
-#define install_error_msg "installation problem, cannot exec `%s'"
-
-/* stdin file number. */
-#define STDIN_FILE_NO 0
-
-/* stdout file number. */
-#define STDOUT_FILE_NO 1
-
-/* value of `pipe': port index for reading. */
-#define READ_PORT 0
-
-/* value of `pipe': port index for writing. */
-#define WRITE_PORT 1
-
-#endif
diff --git a/libiberty/pex-djgpp.c b/libiberty/pex-djgpp.c
deleted file mode 100644
index 968e7841215..00000000000
--- a/libiberty/pex-djgpp.c
+++ /dev/null
@@ -1,103 +0,0 @@
-/* Utilities to execute a program in a subprocess (possibly linked by pipes
- with other subprocesses), and wait for it. DJGPP specialization.
- Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003
- Free Software Foundation, Inc.
-
-This file is part of the libiberty library.
-Libiberty is free software; you can redistribute it and/or
-modify it under the terms of the GNU Library General Public
-License as published by the Free Software Foundation; either
-version 2 of the License, or (at your option) any later version.
-
-Libiberty 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
-Library General Public License for more details.
-
-You should have received a copy of the GNU Library General Public
-License along with libiberty; see the file COPYING.LIB. If not,
-write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-Boston, MA 02111-1307, USA. */
-
-#include "pex-common.h"
-
-#include <stdio.h>
-#include <errno.h>
-#ifdef NEED_DECLARATION_ERRNO
-extern int errno;
-#endif
-#ifdef HAVE_STDLIB_H
-#include <stdlib.h>
-#endif
-#include <process.h>
-
-/* Use ECHILD if available, otherwise use EINVAL. */
-#ifdef ECHILD
-#define PWAIT_ERROR ECHILD
-#else
-#define PWAIT_ERROR EINVAL
-#endif
-
-/* MSDOS doesn't multitask, but for the sake of a consistent interface
- the code behaves like it does. pexecute runs the program, tucks the
- exit code away, and returns a "pid". pwait must be called to fetch the
- exit code. */
-
-/* For communicating information from pexecute to pwait. */
-static int last_pid = 0;
-static int last_status = 0;
-static int last_reaped = 0;
-
-int
-pexecute (program, argv, this_pname, temp_base, errmsg_fmt, errmsg_arg, flags)
- const char *program;
- char * const *argv;
- const char *this_pname;
- const char *temp_base;
- char **errmsg_fmt, **errmsg_arg;
- int flags;
-{
- int rc;
-
- last_pid++;
- if (last_pid < 0)
- last_pid = 1;
-
- if ((flags & PEXECUTE_ONE) != PEXECUTE_ONE)
- abort ();
-
- /* ??? What are the possible return values from spawnv? */
- rc = (flags & PEXECUTE_SEARCH ? spawnvp : spawnv) (P_WAIT, program, argv);
-
- if (rc == -1)
- {
- *errmsg_fmt = install_error_msg;
- *errmsg_arg = (char *)program;
- return -1;
- }
-
- /* Tuck the status away for pwait, and return a "pid". */
- last_status = rc << 8;
- return last_pid;
-}
-
-int
-pwait (pid, status, flags)
- int pid;
- int *status;
- int flags;
-{
- /* On MSDOS each pexecute must be followed by its associated pwait. */
- if (pid != last_pid
- /* Called twice for the same child? */
- || pid == last_reaped)
- {
- errno = PWAIT_ERROR;
- return -1;
- }
- /* ??? Here's an opportunity to canonicalize the values in STATUS.
- Needed? */
- *status = (last_status >> 8);
- last_reaped = last_pid;
- return last_pid;
-}
diff --git a/libiberty/pex-mpw.c b/libiberty/pex-mpw.c
deleted file mode 100644
index 9a8879c9b27..00000000000
--- a/libiberty/pex-mpw.c
+++ /dev/null
@@ -1,161 +0,0 @@
-/* Utilities to execute a program in a subprocess (possibly linked by pipes
- with other subprocesses), and wait for it. MPW specialization.
- Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003
- Free Software Foundation, Inc.
-
-This file is part of the libiberty library.
-Libiberty is free software; you can redistribute it and/or
-modify it under the terms of the GNU Library General Public
-License as published by the Free Software Foundation; either
-version 2 of the License, or (at your option) any later version.
-
-Libiberty 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
-Library General Public License for more details.
-
-You should have received a copy of the GNU Library General Public
-License along with libiberty; see the file COPYING.LIB. If not,
-write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-Boston, MA 02111-1307, USA. */
-
-#include "pex-common.h"
-
-#include <stdio.h>
-#ifdef HAVE_STRING_H
-#include <string.h>
-#endif
-
-/* MPW pexecute doesn't actually run anything; instead, it writes out
- script commands that, when run, will do the actual executing.
-
- For example, in GCC's case, GCC will write out several script commands:
-
- cpp ...
- cc1 ...
- as ...
- ld ...
-
- and then exit. None of the above programs will have run yet. The task
- that called GCC will then execute the script and cause cpp,etc. to run.
- The caller must invoke pfinish before calling exit. This adds
- the finishing touches to the generated script. */
-
-static int first_time = 1;
-
-extern void mpwify_filename PARAMS ((const char *, char *));
-
-int
-pexecute (program, argv, this_pname, temp_base, errmsg_fmt, errmsg_arg, flags)
- const char *program;
- char * const *argv;
- const char *this_pname;
- const char *temp_base;
- char **errmsg_fmt, **errmsg_arg;
- int flags;
-{
- char tmpprogram[255];
- char *cp, *tmpname;
- int i;
-
- mpwify_filename (program, tmpprogram);
- if (first_time)
- {
- printf ("Set Failed 0\n");
- first_time = 0;
- }
-
- fputs ("If {Failed} == 0\n", stdout);
- /* If being verbose, output a copy of the command. It should be
- accurate enough and escaped enough to be "clickable". */
- if (flags & PEXECUTE_VERBOSE)
- {
- fputs ("\tEcho ", stdout);
- fputc ('\'', stdout);
- fputs (tmpprogram, stdout);
- fputc ('\'', stdout);
- fputc (' ', stdout);
- for (i=1; argv[i]; i++)
- {
- fputc ('\'', stdout);
- /* See if we have an argument that needs fixing. */
- if (strchr(argv[i], '/'))
- {
- tmpname = (char *) xmalloc (256);
- mpwify_filename (argv[i], tmpname);
- argv[i] = tmpname;
- }
- for (cp = argv[i]; *cp; cp++)
- {
- /* Write an Option-d escape char in front of special chars. */
- if (strchr("'+", *cp))
- fputc ('\266', stdout);
- fputc (*cp, stdout);
- }
- fputc ('\'', stdout);
- fputc (' ', stdout);
- }
- fputs ("\n", stdout);
- }
- fputs ("\t", stdout);
- fputs (tmpprogram, stdout);
- fputc (' ', stdout);
-
- for (i=1; argv[i]; i++)
- {
- /* See if we have an argument that needs fixing. */
- if (strchr(argv[i], '/'))
- {
- tmpname = (char *) xmalloc (256);
- mpwify_filename (argv[i], tmpname);
- argv[i] = tmpname;
- }
- if (strchr (argv[i], ' '))
- fputc ('\'', stdout);
- for (cp = argv[i]; *cp; cp++)
- {
- /* Write an Option-d escape char in front of special chars. */
- if (strchr("'+", *cp))
- fputc ('\266', stdout);
- fputc (*cp, stdout);
- }
- if (strchr (argv[i], ' '))
- fputc ('\'', stdout);
- fputc (' ', stdout);
- }
-
- fputs ("\n", stdout);
-
- /* Output commands that arrange to clean up and exit if a failure occurs.
- We have to be careful to collect the status from the program that was
- run, rather than some other script command. Also, we don't exit
- immediately, since necessary cleanups are at the end of the script. */
- fputs ("\tSet TmpStatus {Status}\n", stdout);
- fputs ("\tIf {TmpStatus} != 0\n", stdout);
- fputs ("\t\tSet Failed {TmpStatus}\n", stdout);
- fputs ("\tEnd\n", stdout);
- fputs ("End\n", stdout);
-
- /* We're just composing a script, can't fail here. */
- return 0;
-}
-
-int
-pwait (pid, status, flags)
- int pid;
- int *status;
- int flags;
-{
- *status = 0;
- return 0;
-}
-
-/* Write out commands that will exit with the correct error code
- if something in the script failed. */
-
-void
-pfinish ()
-{
- printf ("\tExit \"{Failed}\"\n");
-}
-
diff --git a/libiberty/pex-msdos.c b/libiberty/pex-msdos.c
deleted file mode 100644
index d61c129b97f..00000000000
--- a/libiberty/pex-msdos.c
+++ /dev/null
@@ -1,147 +0,0 @@
-/* Utilities to execute a program in a subprocess (possibly linked by pipes
- with other subprocesses), and wait for it. Generic MSDOS specialization.
- Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003
- Free Software Foundation, Inc.
-
-This file is part of the libiberty library.
-Libiberty is free software; you can redistribute it and/or
-modify it under the terms of the GNU Library General Public
-License as published by the Free Software Foundation; either
-version 2 of the License, or (at your option) any later version.
-
-Libiberty 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
-Library General Public License for more details.
-
-You should have received a copy of the GNU Library General Public
-License along with libiberty; see the file COPYING.LIB. If not,
-write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-Boston, MA 02111-1307, USA. */
-
-#include "pex-common.h"
-
-#include <stdio.h>
-#include <errno.h>
-#ifdef NEED_DECLARATION_ERRNO
-extern int errno;
-#endif
-#ifdef HAVE_STRING_H
-#include <string.h>
-#endif
-#ifdef HAVE_STDLIB_H
-#include <stdlib.h>
-#endif
-
-#include "safe-ctype.h"
-#include <process.h>
-
-/* MSDOS doesn't multitask, but for the sake of a consistent interface
- the code behaves like it does. pexecute runs the program, tucks the
- exit code away, and returns a "pid". pwait must be called to fetch the
- exit code. */
-
-/* For communicating information from pexecute to pwait. */
-static int last_pid = 0;
-static int last_status = 0;
-static int last_reaped = 0;
-
-int
-pexecute (program, argv, this_pname, temp_base, errmsg_fmt, errmsg_arg, flags)
- const char *program;
- char * const *argv;
- const char *this_pname;
- const char *temp_base;
- char **errmsg_fmt, **errmsg_arg;
- int flags;
-{
- int rc;
- char *scmd, *rf;
- FILE *argfile;
- int i, el = flags & PEXECUTE_SEARCH ? 4 : 0;
-
- last_pid++;
- if (last_pid < 0)
- last_pid = 1;
-
- if ((flags & PEXECUTE_ONE) != PEXECUTE_ONE)
- abort ();
-
- if (temp_base == 0)
- temp_base = choose_temp_base ();
- scmd = (char *) xmalloc (strlen (program) + strlen (temp_base) + 6 + el);
- rf = scmd + strlen(program) + 2 + el;
- sprintf (scmd, "%s%s @%s.gp", program,
- (flags & PEXECUTE_SEARCH ? ".exe" : ""), temp_base);
- argfile = fopen (rf, "w");
- if (argfile == 0)
- {
- int errno_save = errno;
- free (scmd);
- errno = errno_save;
- *errmsg_fmt = "cannot open `%s.gp'";
- *errmsg_arg = temp_base;
- return -1;
- }
-
- for (i=1; argv[i]; i++)
- {
- char *cp;
- for (cp = argv[i]; *cp; cp++)
- {
- if (*cp == '"' || *cp == '\'' || *cp == '\\' || ISSPACE (*cp))
- fputc ('\\', argfile);
- fputc (*cp, argfile);
- }
- fputc ('\n', argfile);
- }
- fclose (argfile);
-
- rc = system (scmd);
-
- {
- int errno_save = errno;
- remove (rf);
- free (scmd);
- errno = errno_save;
- }
-
- if (rc == -1)
- {
- *errmsg_fmt = install_error_msg;
- *errmsg_arg = (char *)program;
- return -1;
- }
-
- /* Tuck the status away for pwait, and return a "pid". */
- last_status = rc << 8;
- return last_pid;
-}
-
-/* Use ECHILD if available, otherwise use EINVAL. */
-#ifdef ECHILD
-#define PWAIT_ERROR ECHILD
-#else
-#define PWAIT_ERROR EINVAL
-#endif
-
-int
-pwait (pid, status, flags)
- int pid;
- int *status;
- int flags;
-{
- /* On MSDOS each pexecute must be followed by its associated pwait. */
- if (pid != last_pid
- /* Called twice for the same child? */
- || pid == last_reaped)
- {
- errno = PWAIT_ERROR;
- return -1;
- }
- /* ??? Here's an opportunity to canonicalize the values in STATUS.
- Needed? */
- *status = last_status;
- last_reaped = last_pid;
- return last_pid;
-}
diff --git a/libiberty/pex-os2.c b/libiberty/pex-os2.c
deleted file mode 100644
index d9eacf1f8f3..00000000000
--- a/libiberty/pex-os2.c
+++ /dev/null
@@ -1,72 +0,0 @@
-/* Utilities to execute a program in a subprocess (possibly linked by pipes
- with other subprocesses), and wait for it. OS/2 specialization.
- Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003
- Free Software Foundation, Inc.
-
-This file is part of the libiberty library.
-Libiberty is free software; you can redistribute it and/or
-modify it under the terms of the GNU Library General Public
-License as published by the Free Software Foundation; either
-version 2 of the License, or (at your option) any later version.
-
-Libiberty 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
-Library General Public License for more details.
-
-You should have received a copy of the GNU Library General Public
-License along with libiberty; see the file COPYING.LIB. If not,
-write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-Boston, MA 02111-1307, USA. */
-
-#include "pex-common.h"
-
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-#ifdef HAVE_STDLIB_H
-#include <stdlib.h>
-#endif
-#ifdef HAVE_SYS_WAIT_H
-#include <sys/wait.h>
-#endif
-
-/* ??? Does OS2 have process.h? */
-extern int spawnv ();
-extern int spawnvp ();
-
-int
-pexecute (program, argv, this_pname, temp_base, errmsg_fmt, errmsg_arg, flags)
- const char *program;
- char * const *argv;
- const char *this_pname;
- const char *temp_base;
- char **errmsg_fmt, **errmsg_arg;
- int flags;
-{
- int pid;
-
- if ((flags & PEXECUTE_ONE) != PEXECUTE_ONE)
- abort ();
- /* ??? Presumably 1 == _P_NOWAIT. */
- pid = (flags & PEXECUTE_SEARCH ? spawnvp : spawnv) (1, program, argv);
- if (pid == -1)
- {
- *errmsg_fmt = install_error_msg;
- *errmsg_arg = program;
- return -1;
- }
- return pid;
-}
-
-int
-pwait (pid, status, flags)
- int pid;
- int *status;
- int flags;
-{
- /* ??? Here's an opportunity to canonicalize the values in STATUS.
- Needed? */
- int pid = wait (status);
- return pid;
-}
diff --git a/libiberty/pex-unix.c b/libiberty/pex-unix.c
deleted file mode 100644
index 14fe71ed09c..00000000000
--- a/libiberty/pex-unix.c
+++ /dev/null
@@ -1,166 +0,0 @@
-/* Utilities to execute a program in a subprocess (possibly linked by pipes
- with other subprocesses), and wait for it. Generic Unix version
- (also used for UWIN and VMS).
- Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003
- Free Software Foundation, Inc.
-
-This file is part of the libiberty library.
-Libiberty is free software; you can redistribute it and/or
-modify it under the terms of the GNU Library General Public
-License as published by the Free Software Foundation; either
-version 2 of the License, or (at your option) any later version.
-
-Libiberty 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
-Library General Public License for more details.
-
-You should have received a copy of the GNU Library General Public
-License along with libiberty; see the file COPYING.LIB. If not,
-write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-Boston, MA 02111-1307, USA. */
-
-#include "pex-common.h"
-
-#include <stdio.h>
-#include <errno.h>
-#ifdef NEED_DECLARATION_ERRNO
-extern int errno;
-#endif
-#ifdef HAVE_STRING_H
-#include <string.h>
-#endif
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-#ifdef HAVE_STDLIB_H
-#include <stdlib.h>
-#endif
-#ifdef HAVE_SYS_WAIT_H
-#include <sys/wait.h>
-#endif
-
-#ifndef HAVE_WAITPID
-#define waitpid(pid, status, flags) wait(status)
-#endif
-
-extern int execv ();
-extern int execvp ();
-
-int
-pexecute (program, argv, this_pname, temp_base, errmsg_fmt, errmsg_arg, flags)
- const char *program;
- char * const *argv;
- const char *this_pname;
- const char *temp_base ATTRIBUTE_UNUSED;
- char **errmsg_fmt, **errmsg_arg;
- int flags;
-{
- int (*func)() = (flags & PEXECUTE_SEARCH ? execvp : execv);
- int pid;
- int pdes[2];
- int input_desc, output_desc;
- int retries, sleep_interval;
- /* Pipe waiting from last process, to be used as input for the next one.
- Value is STDIN_FILE_NO if no pipe is waiting
- (i.e. the next command is the first of a group). */
- static int last_pipe_input;
-
- /* If this is the first process, initialize. */
- if (flags & PEXECUTE_FIRST)
- last_pipe_input = STDIN_FILE_NO;
-
- input_desc = last_pipe_input;
-
- /* If this isn't the last process, make a pipe for its output,
- and record it as waiting to be the input to the next process. */
- if (! (flags & PEXECUTE_LAST))
- {
- if (pipe (pdes) < 0)
- {
- *errmsg_fmt = "pipe";
- *errmsg_arg = NULL;
- return -1;
- }
- output_desc = pdes[WRITE_PORT];
- last_pipe_input = pdes[READ_PORT];
- }
- else
- {
- /* Last process. */
- output_desc = STDOUT_FILE_NO;
- last_pipe_input = STDIN_FILE_NO;
- }
-
- /* Fork a subprocess; wait and retry if it fails. */
- sleep_interval = 1;
- pid = -1;
- for (retries = 0; retries < 4; retries++)
- {
- pid = fork ();
- if (pid >= 0)
- break;
- sleep (sleep_interval);
- sleep_interval *= 2;
- }
-
- switch (pid)
- {
- case -1:
- *errmsg_fmt = "fork";
- *errmsg_arg = NULL;
- return -1;
-
- case 0: /* child */
- /* Move the input and output pipes into place, if necessary. */
- if (input_desc != STDIN_FILE_NO)
- {
- close (STDIN_FILE_NO);
- dup (input_desc);
- close (input_desc);
- }
- if (output_desc != STDOUT_FILE_NO)
- {
- close (STDOUT_FILE_NO);
- dup (output_desc);
- close (output_desc);
- }
-
- /* Close the parent's descs that aren't wanted here. */
- if (last_pipe_input != STDIN_FILE_NO)
- close (last_pipe_input);
-
- /* Exec the program. */
- (*func) (program, argv);
-
- fprintf (stderr, "%s: ", this_pname);
- fprintf (stderr, install_error_msg, program);
- fprintf (stderr, ": %s\n", xstrerror (errno));
- exit (-1);
- /* NOTREACHED */
- return 0;
-
- default:
- /* In the parent, after forking.
- Close the descriptors that we made for this child. */
- if (input_desc != STDIN_FILE_NO)
- close (input_desc);
- if (output_desc != STDOUT_FILE_NO)
- close (output_desc);
-
- /* Return child's process number. */
- return pid;
- }
-}
-
-int
-pwait (pid, status, flags)
- int pid;
- int *status;
- int flags ATTRIBUTE_UNUSED;
-{
- /* ??? Here's an opportunity to canonicalize the values in STATUS.
- Needed? */
- pid = waitpid (pid, status, 0);
- return pid;
-}
diff --git a/libiberty/pex-win32.c b/libiberty/pex-win32.c
deleted file mode 100644
index bd097a4bb05..00000000000
--- a/libiberty/pex-win32.c
+++ /dev/null
@@ -1,243 +0,0 @@
-/* Utilities to execute a program in a subprocess (possibly linked by pipes
- with other subprocesses), and wait for it. Generic Win32 specialization.
- Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003
- Free Software Foundation, Inc.
-
-This file is part of the libiberty library.
-Libiberty is free software; you can redistribute it and/or
-modify it under the terms of the GNU Library General Public
-License as published by the Free Software Foundation; either
-version 2 of the License, or (at your option) any later version.
-
-Libiberty 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
-Library General Public License for more details.
-
-You should have received a copy of the GNU Library General Public
-License along with libiberty; see the file COPYING.LIB. If not,
-write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-Boston, MA 02111-1307, USA. */
-
-#include "pex-common.h"
-
-#ifdef HAVE_STRING_H
-#include <string.h>
-#endif
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-#ifdef HAVE_SYS_WAIT_H
-#include <sys/wait.h>
-#endif
-
-#include <process.h>
-#include <io.h>
-#include <fcntl.h>
-#include <signal.h>
-
-/* mingw32 headers may not define the following. */
-
-#ifndef _P_WAIT
-# define _P_WAIT 0
-# define _P_NOWAIT 1
-# define _P_OVERLAY 2
-# define _P_NOWAITO 3
-# define _P_DETACH 4
-
-# define WAIT_CHILD 0
-# define WAIT_GRANDCHILD 1
-#endif
-
-/* This is a kludge to get around the Microsoft C spawn functions' propensity
- to remove the outermost set of double quotes from all arguments. */
-
-static const char * const *
-fix_argv (argvec)
- char **argvec;
-{
- int i;
-
- for (i = 1; argvec[i] != 0; i++)
- {
- int len, j;
- char *temp, *newtemp;
-
- temp = argvec[i];
- len = strlen (temp);
- for (j = 0; j < len; j++)
- {
- if (temp[j] == '"')
- {
- newtemp = xmalloc (len + 2);
- strncpy (newtemp, temp, j);
- newtemp [j] = '\\';
- strncpy (&newtemp [j+1], &temp [j], len-j);
- newtemp [len+1] = 0;
- temp = newtemp;
- len++;
- j++;
- }
- }
-
- argvec[i] = temp;
- }
-
- for (i = 0; argvec[i] != 0; i++)
- {
- if (strpbrk (argvec[i], " \t"))
- {
- int len, trailing_backslash;
- char *temp;
-
- len = strlen (argvec[i]);
- trailing_backslash = 0;
-
- /* There is an added complication when an arg with embedded white
- space ends in a backslash (such as in the case of -iprefix arg
- passed to cpp). The resulting quoted strings gets misinterpreted
- by the command interpreter -- it thinks that the ending quote
- is escaped by the trailing backslash and things get confused.
- We handle this case by escaping the trailing backslash, provided
- it was not escaped in the first place. */
- if (len > 1
- && argvec[i][len-1] == '\\'
- && argvec[i][len-2] != '\\')
- {
- trailing_backslash = 1;
- ++len; /* to escape the final backslash. */
- }
-
- len += 2; /* and for the enclosing quotes. */
-
- temp = xmalloc (len + 1);
- temp[0] = '"';
- strcpy (temp + 1, argvec[i]);
- if (trailing_backslash)
- temp[len-2] = '\\';
- temp[len-1] = '"';
- temp[len] = '\0';
-
- argvec[i] = temp;
- }
- }
-
- return (const char * const *) argvec;
-}
-
-/* Win32 supports pipes */
-int
-pexecute (program, argv, this_pname, temp_base, errmsg_fmt, errmsg_arg, flags)
- const char *program;
- char * const *argv;
- const char *this_pname;
- const char *temp_base;
- char **errmsg_fmt, **errmsg_arg;
- int flags;
-{
- int pid;
- int pdes[2], org_stdin, org_stdout;
- int input_desc, output_desc;
- int retries, sleep_interval;
-
- /* Pipe waiting from last process, to be used as input for the next one.
- Value is STDIN_FILE_NO if no pipe is waiting
- (i.e. the next command is the first of a group). */
- static int last_pipe_input;
-
- /* If this is the first process, initialize. */
- if (flags & PEXECUTE_FIRST)
- last_pipe_input = STDIN_FILE_NO;
-
- input_desc = last_pipe_input;
-
- /* If this isn't the last process, make a pipe for its output,
- and record it as waiting to be the input to the next process. */
- if (! (flags & PEXECUTE_LAST))
- {
- if (_pipe (pdes, 256, O_BINARY) < 0)
- {
- *errmsg_fmt = "pipe";
- *errmsg_arg = NULL;
- return -1;
- }
- output_desc = pdes[WRITE_PORT];
- last_pipe_input = pdes[READ_PORT];
- }
- else
- {
- /* Last process. */
- output_desc = STDOUT_FILE_NO;
- last_pipe_input = STDIN_FILE_NO;
- }
-
- if (input_desc != STDIN_FILE_NO)
- {
- org_stdin = dup (STDIN_FILE_NO);
- dup2 (input_desc, STDIN_FILE_NO);
- close (input_desc);
- }
-
- if (output_desc != STDOUT_FILE_NO)
- {
- org_stdout = dup (STDOUT_FILE_NO);
- dup2 (output_desc, STDOUT_FILE_NO);
- close (output_desc);
- }
-
- pid = (flags & PEXECUTE_SEARCH ? _spawnvp : _spawnv)
- (_P_NOWAIT, program, fix_argv(argv));
-
- if (input_desc != STDIN_FILE_NO)
- {
- dup2 (org_stdin, STDIN_FILE_NO);
- close (org_stdin);
- }
-
- if (output_desc != STDOUT_FILE_NO)
- {
- dup2 (org_stdout, STDOUT_FILE_NO);
- close (org_stdout);
- }
-
- if (pid == -1)
- {
- *errmsg_fmt = install_error_msg;
- *errmsg_arg = program;
- return -1;
- }
-
- return pid;
-}
-
-/* MS CRTDLL doesn't return enough information in status to decide if the
- child exited due to a signal or not, rather it simply returns an
- integer with the exit code of the child; eg., if the child exited with
- an abort() call and didn't have a handler for SIGABRT, it simply returns
- with status = 3. We fix the status code to conform to the usual WIF*
- macros. Note that WIFSIGNALED will never be true under CRTDLL. */
-
-int
-pwait (pid, status, flags)
- int pid;
- int *status;
- int flags;
-{
- int termstat;
-
- pid = _cwait (&termstat, pid, WAIT_CHILD);
-
- /* ??? Here's an opportunity to canonicalize the values in STATUS.
- Needed? */
-
- /* cwait returns the child process exit code in termstat.
- A value of 3 indicates that the child caught a signal, but not
- which one. Since only SIGABRT, SIGFPE and SIGINT do anything, we
- report SIGABRT. */
- if (termstat == 3)
- *status = SIGABRT;
- else
- *status = (((termstat) & 0xff) << 8);
-
- return pid;
-}
diff --git a/libiberty/pexecute.c b/libiberty/pexecute.c
new file mode 100644
index 00000000000..347c4db1092
--- /dev/null
+++ b/libiberty/pexecute.c
@@ -0,0 +1,792 @@
+/* Utilities to execute a program in a subprocess (possibly linked by pipes
+ with other subprocesses), and wait for it.
+ Copyright (C) 1996-2000 Free Software Foundation, Inc.
+
+This file is part of the libiberty library.
+Libiberty is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+Libiberty 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
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with libiberty; see the file COPYING.LIB. If not,
+write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+Boston, MA 02111-1307, USA. */
+
+/* This file exports two functions: pexecute and pwait. */
+
+/* This file lives in at least two places: libiberty and gcc.
+ Don't change one without the other. */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <stdio.h>
+#include <errno.h>
+#ifdef NEED_DECLARATION_ERRNO
+extern int errno;
+#endif
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#ifdef HAVE_SYS_WAIT_H
+#include <sys/wait.h>
+#endif
+
+#include "libiberty.h"
+#include "safe-ctype.h"
+
+/* stdin file number. */
+#define STDIN_FILE_NO 0
+
+/* stdout file number. */
+#define STDOUT_FILE_NO 1
+
+/* value of `pipe': port index for reading. */
+#define READ_PORT 0
+
+/* value of `pipe': port index for writing. */
+#define WRITE_PORT 1
+
+static char *install_error_msg = "installation problem, cannot exec `%s'";
+
+/* pexecute: execute a program.
+
+@deftypefn Extension int pexecute (const char *@var{program}, char * const *@var{argv}, const char *@var{this_pname}, const char *@var{temp_base}, char **@var{errmsg_fmt}, char **@var{errmsg_arg}, int flags)
+
+Executes a program.
+
+@var{program} and @var{argv} are the arguments to
+@code{execv}/@code{execvp}.
+
+@var{this_pname} is name of the calling program (i.e., @code{argv[0]}).
+
+@var{temp_base} is the path name, sans suffix, of a temporary file to
+use if needed. This is currently only needed for MS-DOS ports that
+don't use @code{go32} (do any still exist?). Ports that don't need it
+can pass @code{NULL}.
+
+(@code{@var{flags} & PEXECUTE_SEARCH}) is non-zero if @env{PATH} should be searched
+(??? It's not clear that GCC passes this flag correctly). (@code{@var{flags} &
+PEXECUTE_FIRST}) is nonzero for the first process in chain.
+(@code{@var{flags} & PEXECUTE_FIRST}) is nonzero for the last process
+in chain. The first/last flags could be simplified to only mark the
+last of a chain of processes but that requires the caller to always
+mark the last one (and not give up early if some error occurs).
+It's more robust to require the caller to mark both ends of the chain.
+
+The result is the pid on systems like Unix where we
+@code{fork}/@code{exec} and on systems like WIN32 and OS/2 where we
+use @code{spawn}. It is up to the caller to wait for the child.
+
+The result is the @code{WEXITSTATUS} on systems like MS-DOS where we
+@code{spawn} and wait for the child here.
+
+Upon failure, @var{errmsg_fmt} and @var{errmsg_arg} are set to the
+text of the error message with an optional argument (if not needed,
+@var{errmsg_arg} is set to @code{NULL}), and @minus{}1 is returned.
+@code{errno} is available to the caller to use.
+
+@end deftypefn
+
+@deftypefn Extension int pwait (int @var{pid}, int *@var{status}, int @var{flags})
+
+Waits for a program started by @code{pexecute} to finish.
+
+@var{pid} is the process id of the task to wait for. @var{status} is
+the `status' argument to wait. @var{flags} is currently unused (allows
+future enhancement without breaking upward compatibility). Pass 0 for now.
+
+The result is the pid of the child reaped, or -1 for failure
+(@code{errno} says why).
+
+On systems that don't support waiting for a particular child, @var{pid} is
+ignored. On systems like MS-DOS that don't really multitask @code{pwait}
+is just a mechanism to provide a consistent interface for the caller.
+
+@end deftypefn
+
+@undocumented pfinish
+
+ pfinish: finish generation of script
+
+ pfinish is necessary for systems like MPW where a script is generated that
+ runs the requested programs. */
+
+#ifdef __MSDOS__
+
+/* MSDOS doesn't multitask, but for the sake of a consistent interface
+ the code behaves like it does. pexecute runs the program, tucks the
+ exit code away, and returns a "pid". pwait must be called to fetch the
+ exit code. */
+
+#include <process.h>
+
+/* For communicating information from pexecute to pwait. */
+static int last_pid = 0;
+static int last_status = 0;
+static int last_reaped = 0;
+
+int
+pexecute (program, argv, this_pname, temp_base, errmsg_fmt, errmsg_arg, flags)
+ const char *program;
+ char * const *argv;
+ const char *this_pname;
+ const char *temp_base;
+ char **errmsg_fmt, **errmsg_arg;
+ int flags;
+{
+ int rc;
+
+ last_pid++;
+ if (last_pid < 0)
+ last_pid = 1;
+
+ if ((flags & PEXECUTE_ONE) != PEXECUTE_ONE)
+ abort ();
+
+#ifdef __DJGPP__
+ /* ??? What are the possible return values from spawnv? */
+ rc = (flags & PEXECUTE_SEARCH ? spawnvp : spawnv) (P_WAIT, program, argv);
+#else
+ char *scmd, *rf;
+ FILE *argfile;
+ int i, el = flags & PEXECUTE_SEARCH ? 4 : 0;
+
+ if (temp_base == 0)
+ temp_base = choose_temp_base ();
+ scmd = (char *) xmalloc (strlen (program) + strlen (temp_base) + 6 + el);
+ rf = scmd + strlen(program) + 2 + el;
+ sprintf (scmd, "%s%s @%s.gp", program,
+ (flags & PEXECUTE_SEARCH ? ".exe" : ""), temp_base);
+ argfile = fopen (rf, "w");
+ if (argfile == 0)
+ {
+ int errno_save = errno;
+ free (scmd);
+ errno = errno_save;
+ *errmsg_fmt = "cannot open `%s.gp'";
+ *errmsg_arg = temp_base;
+ return -1;
+ }
+
+ for (i=1; argv[i]; i++)
+ {
+ char *cp;
+ for (cp = argv[i]; *cp; cp++)
+ {
+ if (*cp == '"' || *cp == '\'' || *cp == '\\' || ISSPACE (*cp))
+ fputc ('\\', argfile);
+ fputc (*cp, argfile);
+ }
+ fputc ('\n', argfile);
+ }
+ fclose (argfile);
+
+ rc = system (scmd);
+
+ {
+ int errno_save = errno;
+ remove (rf);
+ free (scmd);
+ errno = errno_save;
+ }
+#endif
+
+ if (rc == -1)
+ {
+ *errmsg_fmt = install_error_msg;
+ *errmsg_arg = (char *)program;
+ return -1;
+ }
+
+ /* Tuck the status away for pwait, and return a "pid". */
+ last_status = rc << 8;
+ return last_pid;
+}
+
+/* Use ECHILD if available, otherwise use EINVAL. */
+#ifdef ECHILD
+#define PWAIT_ERROR ECHILD
+#else
+#define PWAIT_ERROR EINVAL
+#endif
+
+int
+pwait (pid, status, flags)
+ int pid;
+ int *status;
+ int flags;
+{
+ /* On MSDOS each pexecute must be followed by it's associated pwait. */
+ if (pid != last_pid
+ /* Called twice for the same child? */
+ || pid == last_reaped)
+ {
+ errno = PWAIT_ERROR;
+ return -1;
+ }
+ /* ??? Here's an opportunity to canonicalize the values in STATUS.
+ Needed? */
+#ifdef __DJGPP__
+ *status = (last_status >> 8);
+#else
+ *status = last_status;
+#endif
+ last_reaped = last_pid;
+ return last_pid;
+}
+
+#endif /* MSDOS */
+
+#if defined (_WIN32) && ! defined (_UWIN)
+
+#include <process.h>
+
+#ifdef __CYGWIN__
+
+#define fix_argv(argvec) (argvec)
+
+extern int _spawnv ();
+extern int _spawnvp ();
+
+#else /* ! __CYGWIN__ */
+
+/* This is a kludge to get around the Microsoft C spawn functions' propensity
+ to remove the outermost set of double quotes from all arguments. */
+
+static const char * const *
+fix_argv (argvec)
+ char **argvec;
+{
+ int i;
+
+ for (i = 1; argvec[i] != 0; i++)
+ {
+ int len, j;
+ char *temp, *newtemp;
+
+ temp = argvec[i];
+ len = strlen (temp);
+ for (j = 0; j < len; j++)
+ {
+ if (temp[j] == '"')
+ {
+ newtemp = xmalloc (len + 2);
+ strncpy (newtemp, temp, j);
+ newtemp [j] = '\\';
+ strncpy (&newtemp [j+1], &temp [j], len-j);
+ newtemp [len+1] = 0;
+ temp = newtemp;
+ len++;
+ j++;
+ }
+ }
+
+ argvec[i] = temp;
+ }
+
+ for (i = 0; argvec[i] != 0; i++)
+ {
+ if (strpbrk (argvec[i], " \t"))
+ {
+ int len, trailing_backslash;
+ char *temp;
+
+ len = strlen (argvec[i]);
+ trailing_backslash = 0;
+
+ /* There is an added complication when an arg with embedded white
+ space ends in a backslash (such as in the case of -iprefix arg
+ passed to cpp). The resulting quoted strings gets misinterpreted
+ by the command interpreter -- it thinks that the ending quote
+ is escaped by the trailing backslash and things get confused.
+ We handle this case by escaping the trailing backslash, provided
+ it was not escaped in the first place. */
+ if (len > 1
+ && argvec[i][len-1] == '\\'
+ && argvec[i][len-2] != '\\')
+ {
+ trailing_backslash = 1;
+ ++len; /* to escape the final backslash. */
+ }
+
+ len += 2; /* and for the enclosing quotes. */
+
+ temp = xmalloc (len + 1);
+ temp[0] = '"';
+ strcpy (temp + 1, argvec[i]);
+ if (trailing_backslash)
+ temp[len-2] = '\\';
+ temp[len-1] = '"';
+ temp[len] = '\0';
+
+ argvec[i] = temp;
+ }
+ }
+
+ return (const char * const *) argvec;
+}
+#endif /* __CYGWIN__ */
+
+#include <io.h>
+#include <fcntl.h>
+#include <signal.h>
+
+/* mingw32 headers may not define the following. */
+
+#ifndef _P_WAIT
+# define _P_WAIT 0
+# define _P_NOWAIT 1
+# define _P_OVERLAY 2
+# define _P_NOWAITO 3
+# define _P_DETACH 4
+
+# define WAIT_CHILD 0
+# define WAIT_GRANDCHILD 1
+#endif
+
+/* Win32 supports pipes */
+int
+pexecute (program, argv, this_pname, temp_base, errmsg_fmt, errmsg_arg, flags)
+ const char *program;
+ char * const *argv;
+ const char *this_pname;
+ const char *temp_base;
+ char **errmsg_fmt, **errmsg_arg;
+ int flags;
+{
+ int pid;
+ int pdes[2], org_stdin, org_stdout;
+ int input_desc, output_desc;
+ int retries, sleep_interval;
+
+ /* Pipe waiting from last process, to be used as input for the next one.
+ Value is STDIN_FILE_NO if no pipe is waiting
+ (i.e. the next command is the first of a group). */
+ static int last_pipe_input;
+
+ /* If this is the first process, initialize. */
+ if (flags & PEXECUTE_FIRST)
+ last_pipe_input = STDIN_FILE_NO;
+
+ input_desc = last_pipe_input;
+
+ /* If this isn't the last process, make a pipe for its output,
+ and record it as waiting to be the input to the next process. */
+ if (! (flags & PEXECUTE_LAST))
+ {
+ if (_pipe (pdes, 256, O_BINARY) < 0)
+ {
+ *errmsg_fmt = "pipe";
+ *errmsg_arg = NULL;
+ return -1;
+ }
+ output_desc = pdes[WRITE_PORT];
+ last_pipe_input = pdes[READ_PORT];
+ }
+ else
+ {
+ /* Last process. */
+ output_desc = STDOUT_FILE_NO;
+ last_pipe_input = STDIN_FILE_NO;
+ }
+
+ if (input_desc != STDIN_FILE_NO)
+ {
+ org_stdin = dup (STDIN_FILE_NO);
+ dup2 (input_desc, STDIN_FILE_NO);
+ close (input_desc);
+ }
+
+ if (output_desc != STDOUT_FILE_NO)
+ {
+ org_stdout = dup (STDOUT_FILE_NO);
+ dup2 (output_desc, STDOUT_FILE_NO);
+ close (output_desc);
+ }
+
+ pid = (flags & PEXECUTE_SEARCH ? _spawnvp : _spawnv)
+ (_P_NOWAIT, program, fix_argv(argv));
+
+ if (input_desc != STDIN_FILE_NO)
+ {
+ dup2 (org_stdin, STDIN_FILE_NO);
+ close (org_stdin);
+ }
+
+ if (output_desc != STDOUT_FILE_NO)
+ {
+ dup2 (org_stdout, STDOUT_FILE_NO);
+ close (org_stdout);
+ }
+
+ if (pid == -1)
+ {
+ *errmsg_fmt = install_error_msg;
+ *errmsg_arg = program;
+ return -1;
+ }
+
+ return pid;
+}
+
+/* MS CRTDLL doesn't return enough information in status to decide if the
+ child exited due to a signal or not, rather it simply returns an
+ integer with the exit code of the child; eg., if the child exited with
+ an abort() call and didn't have a handler for SIGABRT, it simply returns
+ with status = 3. We fix the status code to conform to the usual WIF*
+ macros. Note that WIFSIGNALED will never be true under CRTDLL. */
+
+int
+pwait (pid, status, flags)
+ int pid;
+ int *status;
+ int flags;
+{
+#ifdef __CYGWIN__
+ return wait (status);
+#else
+ int termstat;
+
+ pid = _cwait (&termstat, pid, WAIT_CHILD);
+
+ /* ??? Here's an opportunity to canonicalize the values in STATUS.
+ Needed? */
+
+ /* cwait returns the child process exit code in termstat.
+ A value of 3 indicates that the child caught a signal, but not
+ which one. Since only SIGABRT, SIGFPE and SIGINT do anything, we
+ report SIGABRT. */
+ if (termstat == 3)
+ *status = SIGABRT;
+ else
+ *status = (((termstat) & 0xff) << 8);
+
+ return pid;
+#endif /* __CYGWIN__ */
+}
+
+#endif /* _WIN32 && ! _UWIN */
+
+#ifdef OS2
+
+/* ??? Does OS2 have process.h? */
+extern int spawnv ();
+extern int spawnvp ();
+
+int
+pexecute (program, argv, this_pname, temp_base, errmsg_fmt, errmsg_arg, flags)
+ const char *program;
+ char * const *argv;
+ const char *this_pname;
+ const char *temp_base;
+ char **errmsg_fmt, **errmsg_arg;
+ int flags;
+{
+ int pid;
+
+ if ((flags & PEXECUTE_ONE) != PEXECUTE_ONE)
+ abort ();
+ /* ??? Presumably 1 == _P_NOWAIT. */
+ pid = (flags & PEXECUTE_SEARCH ? spawnvp : spawnv) (1, program, argv);
+ if (pid == -1)
+ {
+ *errmsg_fmt = install_error_msg;
+ *errmsg_arg = program;
+ return -1;
+ }
+ return pid;
+}
+
+int
+pwait (pid, status, flags)
+ int pid;
+ int *status;
+ int flags;
+{
+ /* ??? Here's an opportunity to canonicalize the values in STATUS.
+ Needed? */
+ int pid = wait (status);
+ return pid;
+}
+
+#endif /* OS2 */
+
+#ifdef MPW
+
+/* MPW pexecute doesn't actually run anything; instead, it writes out
+ script commands that, when run, will do the actual executing.
+
+ For example, in GCC's case, GCC will write out several script commands:
+
+ cpp ...
+ cc1 ...
+ as ...
+ ld ...
+
+ and then exit. None of the above programs will have run yet. The task
+ that called GCC will then execute the script and cause cpp,etc. to run.
+ The caller must invoke pfinish before calling exit. This adds
+ the finishing touches to the generated script. */
+
+static int first_time = 1;
+
+int
+pexecute (program, argv, this_pname, temp_base, errmsg_fmt, errmsg_arg, flags)
+ const char *program;
+ char * const *argv;
+ const char *this_pname;
+ const char *temp_base;
+ char **errmsg_fmt, **errmsg_arg;
+ int flags;
+{
+ char tmpprogram[255];
+ char *cp, *tmpname;
+ int i;
+
+ mpwify_filename (program, tmpprogram);
+ if (first_time)
+ {
+ printf ("Set Failed 0\n");
+ first_time = 0;
+ }
+
+ fputs ("If {Failed} == 0\n", stdout);
+ /* If being verbose, output a copy of the command. It should be
+ accurate enough and escaped enough to be "clickable". */
+ if (flags & PEXECUTE_VERBOSE)
+ {
+ fputs ("\tEcho ", stdout);
+ fputc ('\'', stdout);
+ fputs (tmpprogram, stdout);
+ fputc ('\'', stdout);
+ fputc (' ', stdout);
+ for (i=1; argv[i]; i++)
+ {
+ fputc ('\'', stdout);
+ /* See if we have an argument that needs fixing. */
+ if (strchr(argv[i], '/'))
+ {
+ tmpname = (char *) xmalloc (256);
+ mpwify_filename (argv[i], tmpname);
+ argv[i] = tmpname;
+ }
+ for (cp = argv[i]; *cp; cp++)
+ {
+ /* Write an Option-d escape char in front of special chars. */
+ if (strchr("'+", *cp))
+ fputc ('\266', stdout);
+ fputc (*cp, stdout);
+ }
+ fputc ('\'', stdout);
+ fputc (' ', stdout);
+ }
+ fputs ("\n", stdout);
+ }
+ fputs ("\t", stdout);
+ fputs (tmpprogram, stdout);
+ fputc (' ', stdout);
+
+ for (i=1; argv[i]; i++)
+ {
+ /* See if we have an argument that needs fixing. */
+ if (strchr(argv[i], '/'))
+ {
+ tmpname = (char *) xmalloc (256);
+ mpwify_filename (argv[i], tmpname);
+ argv[i] = tmpname;
+ }
+ if (strchr (argv[i], ' '))
+ fputc ('\'', stdout);
+ for (cp = argv[i]; *cp; cp++)
+ {
+ /* Write an Option-d escape char in front of special chars. */
+ if (strchr("'+", *cp))
+ fputc ('\266', stdout);
+ fputc (*cp, stdout);
+ }
+ if (strchr (argv[i], ' '))
+ fputc ('\'', stdout);
+ fputc (' ', stdout);
+ }
+
+ fputs ("\n", stdout);
+
+ /* Output commands that arrange to clean up and exit if a failure occurs.
+ We have to be careful to collect the status from the program that was
+ run, rather than some other script command. Also, we don't exit
+ immediately, since necessary cleanups are at the end of the script. */
+ fputs ("\tSet TmpStatus {Status}\n", stdout);
+ fputs ("\tIf {TmpStatus} != 0\n", stdout);
+ fputs ("\t\tSet Failed {TmpStatus}\n", stdout);
+ fputs ("\tEnd\n", stdout);
+ fputs ("End\n", stdout);
+
+ /* We're just composing a script, can't fail here. */
+ return 0;
+}
+
+int
+pwait (pid, status, flags)
+ int pid;
+ int *status;
+ int flags;
+{
+ *status = 0;
+ return 0;
+}
+
+/* Write out commands that will exit with the correct error code
+ if something in the script failed. */
+
+void
+pfinish ()
+{
+ printf ("\tExit \"{Failed}\"\n");
+}
+
+#endif /* MPW */
+
+/* include for Unix-like environments but not for Dos-like environments */
+#if ! defined (__MSDOS__) && ! defined (OS2) && ! defined (MPW) \
+ && ! (defined (_WIN32) && ! defined (_UWIN))
+
+extern int execv ();
+extern int execvp ();
+
+int
+pexecute (program, argv, this_pname, temp_base, errmsg_fmt, errmsg_arg, flags)
+ const char *program;
+ char * const *argv;
+ const char *this_pname;
+ const char *temp_base ATTRIBUTE_UNUSED;
+ char **errmsg_fmt, **errmsg_arg;
+ int flags;
+{
+ int (*func)() = (flags & PEXECUTE_SEARCH ? execvp : execv);
+ int pid;
+ int pdes[2];
+ int input_desc, output_desc;
+ int retries, sleep_interval;
+ /* Pipe waiting from last process, to be used as input for the next one.
+ Value is STDIN_FILE_NO if no pipe is waiting
+ (i.e. the next command is the first of a group). */
+ static int last_pipe_input;
+
+ /* If this is the first process, initialize. */
+ if (flags & PEXECUTE_FIRST)
+ last_pipe_input = STDIN_FILE_NO;
+
+ input_desc = last_pipe_input;
+
+ /* If this isn't the last process, make a pipe for its output,
+ and record it as waiting to be the input to the next process. */
+ if (! (flags & PEXECUTE_LAST))
+ {
+ if (pipe (pdes) < 0)
+ {
+ *errmsg_fmt = "pipe";
+ *errmsg_arg = NULL;
+ return -1;
+ }
+ output_desc = pdes[WRITE_PORT];
+ last_pipe_input = pdes[READ_PORT];
+ }
+ else
+ {
+ /* Last process. */
+ output_desc = STDOUT_FILE_NO;
+ last_pipe_input = STDIN_FILE_NO;
+ }
+
+ /* Fork a subprocess; wait and retry if it fails. */
+ sleep_interval = 1;
+ pid = -1;
+ for (retries = 0; retries < 4; retries++)
+ {
+ pid = fork ();
+ if (pid >= 0)
+ break;
+ sleep (sleep_interval);
+ sleep_interval *= 2;
+ }
+
+ switch (pid)
+ {
+ case -1:
+ *errmsg_fmt = "fork";
+ *errmsg_arg = NULL;
+ return -1;
+
+ case 0: /* child */
+ /* Move the input and output pipes into place, if necessary. */
+ if (input_desc != STDIN_FILE_NO)
+ {
+ close (STDIN_FILE_NO);
+ dup (input_desc);
+ close (input_desc);
+ }
+ if (output_desc != STDOUT_FILE_NO)
+ {
+ close (STDOUT_FILE_NO);
+ dup (output_desc);
+ close (output_desc);
+ }
+
+ /* Close the parent's descs that aren't wanted here. */
+ if (last_pipe_input != STDIN_FILE_NO)
+ close (last_pipe_input);
+
+ /* Exec the program. */
+ (*func) (program, argv);
+
+ fprintf (stderr, "%s: ", this_pname);
+ fprintf (stderr, install_error_msg, program);
+ fprintf (stderr, ": %s\n", xstrerror (errno));
+ exit (-1);
+ /* NOTREACHED */
+ return 0;
+
+ default:
+ /* In the parent, after forking.
+ Close the descriptors that we made for this child. */
+ if (input_desc != STDIN_FILE_NO)
+ close (input_desc);
+ if (output_desc != STDOUT_FILE_NO)
+ close (output_desc);
+
+ /* Return child's process number. */
+ return pid;
+ }
+}
+
+int
+pwait (pid, status, flags)
+ int pid;
+ int *status;
+ int flags ATTRIBUTE_UNUSED;
+{
+ /* ??? Here's an opportunity to canonicalize the values in STATUS.
+ Needed? */
+#ifdef VMS
+ pid = waitpid (-1, status, 0);
+#else
+ pid = wait (status);
+#endif
+ return pid;
+}
+
+#endif /* ! __MSDOS__ && ! OS2 && ! MPW && ! (_WIN32 && ! _UWIN) */
diff --git a/libiberty/pexecute.txh b/libiberty/pexecute.txh
deleted file mode 100644
index 269f031cc72..00000000000
--- a/libiberty/pexecute.txh
+++ /dev/null
@@ -1,63 +0,0 @@
-@deftypefn Extension int pexecute (const char *@var{program}, char * const *@var{argv}, const char *@var{this_pname}, const char *@var{temp_base}, char **@var{errmsg_fmt}, char **@var{errmsg_arg}, int flags)
-
-Executes a program.
-
-@var{program} and @var{argv} are the arguments to
-@code{execv}/@code{execvp}.
-
-@var{this_pname} is name of the calling program (i.e., @code{argv[0]}).
-
-@var{temp_base} is the path name, sans suffix, of a temporary file to
-use if needed. This is currently only needed for MS-DOS ports that
-don't use @code{go32} (do any still exist?). Ports that don't need it
-can pass @code{NULL}.
-
-(@code{@var{flags} & PEXECUTE_SEARCH}) is non-zero if @env{PATH}
-should be searched (??? It's not clear that GCC passes this flag
-correctly). (@code{@var{flags} & PEXECUTE_FIRST}) is nonzero for the
-first process in chain. (@code{@var{flags} & PEXECUTE_FIRST}) is
-nonzero for the last process in chain. The first/last flags could be
-simplified to only mark the last of a chain of processes but that
-requires the caller to always mark the last one (and not give up
-early if some error occurs). It's more robust to require the caller
-to mark both ends of the chain.
-
-The result is the pid on systems like Unix where we
-@code{fork}/@code{exec} and on systems like WIN32 and OS/2 where we
-use @code{spawn}. It is up to the caller to wait for the child.
-
-The result is the @code{WEXITSTATUS} on systems like MS-DOS where we
-@code{spawn} and wait for the child here.
-
-Upon failure, @var{errmsg_fmt} and @var{errmsg_arg} are set to the
-text of the error message with an optional argument (if not needed,
-@var{errmsg_arg} is set to @code{NULL}), and @minus{}1 is returned.
-@code{errno} is available to the caller to use.
-
-@end deftypefn
-
-@deftypefn Extension int pwait (int @var{pid}, int *@var{status}, int @var{flags})
-
-Waits for a program started by @code{pexecute} to finish.
-
-@var{pid} is the process id of the task to wait for. @var{status} is
-the `status' argument to wait. @var{flags} is currently unused
-(allows future enhancement without breaking upward compatibility).
-Pass 0 for now.
-
-The result is the pid of the child reaped, or -1 for failure
-(@code{errno} says why).
-
-On systems that don't support waiting for a particular child,
-@var{pid} is ignored. On systems like MS-DOS that don't really
-multitask @code{pwait} is just a mechanism to provide a consistent
-interface for the caller.
-
-@end deftypefn
-
-@undocumented pfinish
-
-pfinish: finish generation of script
-
-pfinish is necessary for systems like MPW where a script is generated
-that runs the requested programs.
diff --git a/libjava/ChangeLog b/libjava/ChangeLog
index 36cac209702..8d394ca98b7 100644
--- a/libjava/ChangeLog
+++ b/libjava/ChangeLog
@@ -1,29 +1,3 @@
-2003-01-24 Ranjit Mathew <rmathew@hotmail.com>
-
- Fixes PR java/9253:
- * java/io/natFileWin32.cc (performList): Append only "*.*"
- if the canonical file path already has a "\" at the end.
-
-2003-01-24 Tom Tromey <tromey@redhat.com>
-
- * defineclass.cc (handleMethodsEnd): Precompute code for static
- method.
- (handleCodeAttribute): Likewise.
- * resolve.cc (ncode): Use run_class for unsynchronized static
- methods.
- * include/java-interp.h (class _Jv_InterpMethod): Declare
- run_class.
- * interpret.cc (run_synch_class): Initialize class.
- (run) [insn_invokestatic]: Don't initialize class.
- [insn_anewarray]: Likewise.
- [insn_multianewarray]: Likewise.
- (run_class): New function.
-
-2003-01-24 Tom Tromey <tromey@redhat.com>
-
- * java/lang/ClassLoader.java (findLoadedClass): Removed erroneous
- comment.
-
2003-01-22 Andrew Haley <aph@redhat.com>
* x86_64-signal.h: Add simple handler for x86_64 32-bit mode.
diff --git a/libjava/defineclass.cc b/libjava/defineclass.cc
index 001fa0131f0..81de5ad7da2 100644
--- a/libjava/defineclass.cc
+++ b/libjava/defineclass.cc
@@ -1,6 +1,6 @@
// defineclass.cc - defining a class from .class format.
-/* Copyright (C) 1999, 2000, 2001, 2002, 2003 Free Software Foundation
+/* Copyright (C) 1999, 2000, 2001, 2002 Free Software Foundation
This file is part of libgcj.
@@ -1267,15 +1267,6 @@ void _Jv_ClassReader::handleCodeAttribute
code_length);
def->interpreted_methods[method_index] = method;
-
- if ((method->self->accflags & java::lang::reflect::Modifier::STATIC))
- {
- // Precompute the ncode field for a static method. This lets us
- // call a static method of an interpreted class from precompiled
- // code without first resolving the class (that will happen
- // during class initialization instead).
- method->self->ncode = method->ncode ();
- }
}
void _Jv_ClassReader::handleExceptionTableEntry
@@ -1311,16 +1302,6 @@ void _Jv_ClassReader::handleMethodsEnd ()
m->self = method;
m->function = NULL;
def->interpreted_methods[i] = m;
-
- if ((method->accflags & Modifier::STATIC))
- {
- // Precompute the ncode field for a static method.
- // This lets us call a static method of an
- // interpreted class from precompiled code without
- // first resolving the class (that will happen
- // during class initialization instead).
- method->ncode = m->ncode ();
- }
}
}
else if ((method->accflags & Modifier::ABSTRACT) != 0)
diff --git a/libjava/include/java-interp.h b/libjava/include/java-interp.h
index c801274f4cb..a00f4db0a1d 100644
--- a/libjava/include/java-interp.h
+++ b/libjava/include/java-interp.h
@@ -1,6 +1,6 @@
// java-interp.h - Header file for the bytecode interpreter. -*- c++ -*-
-/* Copyright (C) 1999, 2000, 2001, 2002, 2003 Free Software Foundation
+/* Copyright (C) 1999, 2000, 2001, 2002 Free Software Foundation
This file is part of libgcj.
@@ -132,7 +132,6 @@ class _Jv_InterpMethod : public _Jv_MethodBase
static void run_normal (ffi_cif*, void*, ffi_raw*, void*);
static void run_synch_object (ffi_cif*, void*, ffi_raw*, void*);
- static void run_class (ffi_cif*, void*, ffi_raw*, void*);
static void run_synch_class (ffi_cif*, void*, ffi_raw*, void*);
void run (void*, ffi_raw *);
diff --git a/libjava/interpret.cc b/libjava/interpret.cc
index 43d627921fb..15fb413e835 100644
--- a/libjava/interpret.cc
+++ b/libjava/interpret.cc
@@ -1,6 +1,6 @@
// interpret.cc - Code for the interpreter
-/* Copyright (C) 1999, 2000, 2001, 2002, 2003 Free Software Foundation
+/* Copyright (C) 1999, 2000, 2001, 2002 Free Software Foundation
This file is part of libgcj.
@@ -240,21 +240,19 @@ static jint get4(unsigned char* loc) {
} \
while (0)
-void
-_Jv_InterpMethod::run_normal (ffi_cif *,
- void* ret,
- ffi_raw * args,
- void* __this)
+void _Jv_InterpMethod::run_normal (ffi_cif *,
+ void* ret,
+ ffi_raw * args,
+ void* __this)
{
_Jv_InterpMethod *_this = (_Jv_InterpMethod *) __this;
_this->run (ret, args);
}
-void
-_Jv_InterpMethod::run_synch_object (ffi_cif *,
- void* ret,
- ffi_raw * args,
- void* __this)
+void _Jv_InterpMethod::run_synch_object (ffi_cif *,
+ void* ret,
+ ffi_raw * args,
+ void* __this)
{
_Jv_InterpMethod *_this = (_Jv_InterpMethod *) __this;
@@ -264,27 +262,14 @@ _Jv_InterpMethod::run_synch_object (ffi_cif *,
_this->run (ret, args);
}
-void
-_Jv_InterpMethod::run_class (ffi_cif *,
- void* ret,
- ffi_raw * args,
- void* __this)
-{
- _Jv_InterpMethod *_this = (_Jv_InterpMethod *) __this;
- _Jv_InitClass (_this->defining_class);
- _this->run (ret, args);
-}
-
-void
-_Jv_InterpMethod::run_synch_class (ffi_cif *,
- void* ret,
- ffi_raw * args,
- void* __this)
+void _Jv_InterpMethod::run_synch_class (ffi_cif *,
+ void* ret,
+ ffi_raw * args,
+ void* __this)
{
_Jv_InterpMethod *_this = (_Jv_InterpMethod *) __this;
jclass sync = _this->defining_class;
- _Jv_InitClass (sync);
JvSynchronize mutex (sync);
_this->run (ret, args);
@@ -2848,6 +2833,7 @@ _Jv_InterpMethod::run (void *retp, ffi_raw *args)
sp -= rmeth->stack_item_count;
+ _Jv_InitClass (rmeth->klass);
fun = (void (*)()) rmeth->method->ncode;
#ifdef DIRECT_THREADED
@@ -2917,9 +2903,6 @@ _Jv_InterpMethod::run (void *retp, ffi_raw *args)
{
int index = GET2U ();
jclass klass = (_Jv_ResolvePoolEntry (defining_class, index)).clazz;
- // We initialize here because otherwise `size_in_bytes' may
- // not be set correctly, leading us to pass `0' as the size.
- // FIXME: fix in the allocator? There is a PR for this.
_Jv_InitClass (klass);
jobject res = _Jv_AllocObject (klass, klass->size_in_bytes);
PUSHA (res);
@@ -2955,6 +2938,7 @@ _Jv_InterpMethod::run (void *retp, ffi_raw *args)
int index = GET2U ();
jclass klass = (_Jv_ResolvePoolEntry (defining_class, index)).clazz;
int size = POPI();
+ _Jv_InitClass (klass);
jobject result = _Jv_NewObjectArray (size, klass, 0);
PUSHA (result);
@@ -3088,6 +3072,7 @@ _Jv_InterpMethod::run (void *retp, ffi_raw *args)
jclass type
= (_Jv_ResolvePoolEntry (defining_class, kind_index)).clazz;
+ _Jv_InitClass (type);
jint *sizes = (jint*) __builtin_alloca (sizeof (jint)*dim);
for (int i = dim - 1; i >= 0; i--)
diff --git a/libjava/java/io/natFileWin32.cc b/libjava/java/io/natFileWin32.cc
index 5245feb5a1e..9bf0eefb74e 100644
--- a/libjava/java/io/natFileWin32.cc
+++ b/libjava/java/io/natFileWin32.cc
@@ -146,10 +146,8 @@ java::io::File::performList (java::io::FilenameFilter *filter,
return NULL;
char *buf = (char *) __builtin_alloca (JvGetStringUTFLength (canon) + 5);
jsize total = JvGetStringUTFRegion (canon, 0, canon->length(), buf);
- if (buf[total-1] == '\\')
- strcpy (&buf[total], "*.*");
- else
- strcpy (&buf[total], "\\*.*");
+ // FIXME?
+ strcpy(&buf[total], "\\*.*");
WIN32_FIND_DATA data;
HANDLE handle = FindFirstFile (buf, &data);
diff --git a/libjava/java/lang/ClassLoader.java b/libjava/java/lang/ClassLoader.java
index 5d564dce747..8c99897cd1a 100644
--- a/libjava/java/lang/ClassLoader.java
+++ b/libjava/java/lang/ClassLoader.java
@@ -1,6 +1,6 @@
// ClassLoader.java - Define policies for loading Java classes.
-/* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation
+/* Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation
This file is part of libgcj.
@@ -733,7 +733,8 @@ public abstract class ClassLoader
/**
* If a class named <code>name</code> was previously loaded using
* this <code>ClassLoader</code>, then it is returned. Otherwise
- * it returns <code>null</code>.
+ * it returns <code>null</code>. (Unlike the JDK this is native,
+ * since we implement the class table internally.)
* @param name class to find.
* @return the class loaded, or null.
*/
diff --git a/libjava/resolve.cc b/libjava/resolve.cc
index e69341e385f..00785eed8fc 100644
--- a/libjava/resolve.cc
+++ b/libjava/resolve.cc
@@ -1,6 +1,6 @@
// resolve.cc - Code for linking and resolving classes and pool entries.
-/* Copyright (C) 1999, 2000, 2001, 2002, 2003 Free Software Foundation
+/* Copyright (C) 1999, 2000, 2001 , 2002 Free Software Foundation
This file is part of libgcj.
@@ -947,10 +947,7 @@ _Jv_InterpMethod::ncode ()
}
else
{
- if (staticp)
- fun = (ffi_closure_fun)&_Jv_InterpMethod::run_class;
- else
- fun = (ffi_closure_fun)&_Jv_InterpMethod::run_normal;
+ fun = (ffi_closure_fun)&_Jv_InterpMethod::run_normal;
}
FFI_PREP_RAW_CLOSURE (&closure->closure,
@@ -962,6 +959,7 @@ _Jv_InterpMethod::ncode ()
return self->ncode;
}
+
void *
_Jv_JNIMethod::ncode ()
{
diff --git a/libjava/testsuite/ChangeLog b/libjava/testsuite/ChangeLog
index a359f115f10..4735558e53d 100644
--- a/libjava/testsuite/ChangeLog
+++ b/libjava/testsuite/ChangeLog
@@ -1,20 +1,3 @@
-2003-01-24 Ranjit Mathew <rmathew@hotmail.com>
-
- * libjava.jni/calls.c (Java_calls_docall): Define with
- JNIEXPORT and JNICALL method attributes.
- * libjava.jni/field.c (Java_field_fetch): Likewise.
- * libjava.jni/final_method.c (Java_final_1method_meth): Likewise.
- * libjava.jni/findclass.c (Java_findclass_doit): Likewise.
- * libjava.jni/invoke.c (Java_invoke_val): Likewise.
- * libjava.jni/martin.c (Java_martin_myNative): Likewise.
- * libjava.jni/noclass.c (Java_noclass_find_1it): Likewise.
- * libjava.jni/overload.c (Java_overload_over__I): Likewise.
- (Java_overload_over__II): Likewise.
- * libjava.jni/register.c (JNI_OnLoad): Likewise.
- * libjava.jni/simple_int.c (Java_simple_1int_nat): Likewise.
- * libjava.jni/throwit.c (Java_throwit_throwit): Likewise.
- * libjava.jni/virtual.c (Java_virtual_equals): Likewise.
-
2003-01-21 Tom Tromey <tromey@redhat.com>
* libjava.jacks/jacks.xfail: All 8.4.3 tests and 9.4-modifier-10
diff --git a/libjava/testsuite/libjava.jni/calls.c b/libjava/testsuite/libjava.jni/calls.c
index dd54005ba18..080e5271cfb 100644
--- a/libjava/testsuite/libjava.jni/calls.c
+++ b/libjava/testsuite/libjava.jni/calls.c
@@ -1,7 +1,7 @@
#include <stdio.h>
#include <calls.h>
-JNIEXPORT jint JNICALL
+jint
Java_calls_docall (JNIEnv *env, jobject _this)
{
jmethodID method;
diff --git a/libjava/testsuite/libjava.jni/field.c b/libjava/testsuite/libjava.jni/field.c
index bce0cc896e6..358c293e7c5 100644
--- a/libjava/testsuite/libjava.jni/field.c
+++ b/libjava/testsuite/libjava.jni/field.c
@@ -1,7 +1,7 @@
#include <jni.h>
#include <field.h>
-JNIEXPORT jobjectArray JNICALL
+jobjectArray
Java_field_fetch (JNIEnv *env, jobject this)
{
jclass cls;
diff --git a/libjava/testsuite/libjava.jni/final_method.c b/libjava/testsuite/libjava.jni/final_method.c
index 76d5ae52827..82977374bcb 100644
--- a/libjava/testsuite/libjava.jni/final_method.c
+++ b/libjava/testsuite/libjava.jni/final_method.c
@@ -1,6 +1,6 @@
#include <final_method.h>
-JNIEXPORT jstring JNICALL
+jstring
Java_final_1method_meth (JNIEnv *env, jobject thisv)
{
return (*env)->NewStringUTF (env, "zardoz has spoken");
diff --git a/libjava/testsuite/libjava.jni/findclass.c b/libjava/testsuite/libjava.jni/findclass.c
index 1a58a55fee4..9a71508ab3f 100644
--- a/libjava/testsuite/libjava.jni/findclass.c
+++ b/libjava/testsuite/libjava.jni/findclass.c
@@ -2,7 +2,7 @@
#include <findclass.h>
-JNIEXPORT jclass JNICALL
+jclass
Java_findclass_doit (JNIEnv *env, jclass klass, jstring name)
{
const char *buf = (*env)->GetStringUTFChars (env, name, NULL);
diff --git a/libjava/testsuite/libjava.jni/invoke.c b/libjava/testsuite/libjava.jni/invoke.c
index c2b78d239cb..35a446eae25 100644
--- a/libjava/testsuite/libjava.jni/invoke.c
+++ b/libjava/testsuite/libjava.jni/invoke.c
@@ -1,6 +1,6 @@
#include <invoke.h>
-JNIEXPORT jint JNICALL
+jint
Java_invoke_val (JNIEnv *env, jclass klass)
{
return 23;
diff --git a/libjava/testsuite/libjava.jni/martin.c b/libjava/testsuite/libjava.jni/martin.c
index 0fbb8d0aa73..947bd452c04 100644
--- a/libjava/testsuite/libjava.jni/martin.c
+++ b/libjava/testsuite/libjava.jni/martin.c
@@ -2,8 +2,7 @@
#include "martin.h"
#include <stdio.h>
-JNIEXPORT void JNICALL
-Java_martin_myNative(JNIEnv* env, jobject this, jstring s)
+void Java_martin_myNative(JNIEnv* env, jobject this, jstring s)
{
jclass cls;
jfieldID fid;
diff --git a/libjava/testsuite/libjava.jni/noclass.c b/libjava/testsuite/libjava.jni/noclass.c
index 87c649c30e6..5f2caf428ae 100644
--- a/libjava/testsuite/libjava.jni/noclass.c
+++ b/libjava/testsuite/libjava.jni/noclass.c
@@ -1,6 +1,6 @@
#include <noclass.h>
-JNIEXPORT void JNICALL
+void
Java_noclass_find_1it (JNIEnv *env, jclass k)
{
/* We cause an exception by asking for a class we know does not
diff --git a/libjava/testsuite/libjava.jni/overload.c b/libjava/testsuite/libjava.jni/overload.c
index 4e7a2d9289b..d171fc3ac9b 100644
--- a/libjava/testsuite/libjava.jni/overload.c
+++ b/libjava/testsuite/libjava.jni/overload.c
@@ -1,13 +1,13 @@
#include <overload.h>
-JNIEXPORT jint JNICALL
+jint
Java_overload_over__I (JNIEnv *env, jclass klass, jint val)
{
return val;
}
-JNIEXPORT jint JNICALL
+jint
Java_overload_over__II (JNIEnv *env, jclass klass, jint one, jint two)
{
return one + two;
diff --git a/libjava/testsuite/libjava.jni/register.c b/libjava/testsuite/libjava.jni/register.c
index 0490902420e..738182cf0f6 100644
--- a/libjava/testsuite/libjava.jni/register.c
+++ b/libjava/testsuite/libjava.jni/register.c
@@ -8,7 +8,7 @@ some_random_name (JNIEnv *env, jclass k, jint v)
return v - 1;
}
-JNIEXPORT jint JNICALL
+jint
JNI_OnLoad (JavaVM *vm, void *nothing)
{
JNIEnv *env;
diff --git a/libjava/testsuite/libjava.jni/simple_int.c b/libjava/testsuite/libjava.jni/simple_int.c
index a7c64b0cd5f..a86f2d2babd 100644
--- a/libjava/testsuite/libjava.jni/simple_int.c
+++ b/libjava/testsuite/libjava.jni/simple_int.c
@@ -1,6 +1,6 @@
#include <simple_int.h>
-JNIEXPORT jint JNICALL
+jint
Java_simple_1int_nat (JNIEnv *env, jclass klass, jint val)
{
return 2 * val;
diff --git a/libjava/testsuite/libjava.jni/throwit.c b/libjava/testsuite/libjava.jni/throwit.c
index 34a3ca07676..0b02459b464 100644
--- a/libjava/testsuite/libjava.jni/throwit.c
+++ b/libjava/testsuite/libjava.jni/throwit.c
@@ -1,7 +1,7 @@
#include <stdlib.h>
#include <throwit.h>
-JNIEXPORT void JNICALL
+void
Java_throwit_throwit (JNIEnv *env, jclass klass, jstring name,
jboolean is_new)
{
diff --git a/libjava/testsuite/libjava.jni/virtual.c b/libjava/testsuite/libjava.jni/virtual.c
index 0246970835b..bda837df102 100644
--- a/libjava/testsuite/libjava.jni/virtual.c
+++ b/libjava/testsuite/libjava.jni/virtual.c
@@ -1,6 +1,6 @@
#include <virtual.h>
-JNIEXPORT jboolean JNICALL
+jboolean
Java_virtual_equals (JNIEnv *env, jobject thisv, jobject other)
{
return JNI_FALSE;
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index f47b95fdf90..bda8f070798 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,16 +1,3 @@
-2003-01-24 Nathan Sidwell <nathan@codesourcery.com>
-
- * include/bits/valarray_meta.h: Remove, split into ...
- * include/bits/valarray_before.h: ... this, and ...
- * include/bits/valarray_after.h: ... this.
- * include/std/std_valarray.h: Adjust.
- * include/Makefile.am (bits_headers): Adjust.
- * include/Makefile.in: Regenerate.
-
-2003-01-24 Andreas Schwab <schwab@suse.de>
-
- * config/linker-map.gnu: Fix for size_t variance.
-
2003-01-23 Petur Runolfsson <peturr02@ru.is>
PR libstdc++/9322
diff --git a/libstdc++-v3/config/linker-map.gnu b/libstdc++-v3/config/linker-map.gnu
index 9616efdd05f..cd38a2de825 100644
--- a/libstdc++-v3/config/linker-map.gnu
+++ b/libstdc++-v3/config/linker-map.gnu
@@ -95,8 +95,8 @@ GLIBCPP_3.4 {
_ZNS[sb]I[cw]St11char_traitsI[cw]ESaI[cw]EE20_S_empty_rep_storageE;
# std::__pool_alloc
- _ZNSt12__pool_allocILb1ELi0EE10deallocateEPv[jm]*;
- _ZNSt12__pool_allocILb1ELi0EE8allocateE[jm]*;
+ _ZNSt12__pool_allocILb1ELi0EE10deallocateEPvj*;
+ _ZNSt12__pool_allocILb1ELi0EE8allocateEj*;
_ZNSt12__pool_allocILb1ELi0EE5_Lock*;
_ZNSt12__pool_allocILb1ELi0EE12_S_force_newE;
_ZNSt12__pool_allocILb1ELi0EE12_S_free_listE;
diff --git a/libstdc++-v3/include/Makefile.am b/libstdc++-v3/include/Makefile.am
index 5eb8397c52b..00e12a0a6f6 100644
--- a/libstdc++-v3/include/Makefile.am
+++ b/libstdc++-v3/include/Makefile.am
@@ -97,8 +97,7 @@ bits_headers = \
${bits_srcdir}/type_traits.h \
${bits_srcdir}/valarray_array.h \
${bits_srcdir}/valarray_array.tcc \
- ${bits_srcdir}/valarray_before.h \
- ${bits_srcdir}/valarray_after.h \
+ ${bits_srcdir}/valarray_meta.h \
${bits_srcdir}/vector.tcc
backward_srcdir = ${glibcpp_srcdir}/include/backward
diff --git a/libstdc++-v3/include/Makefile.in b/libstdc++-v3/include/Makefile.in
index 501238a4d69..e39dffdef62 100644
--- a/libstdc++-v3/include/Makefile.in
+++ b/libstdc++-v3/include/Makefile.in
@@ -215,8 +215,7 @@ bits_headers = \
${bits_srcdir}/type_traits.h \
${bits_srcdir}/valarray_array.h \
${bits_srcdir}/valarray_array.tcc \
- ${bits_srcdir}/valarray_before.h \
- ${bits_srcdir}/valarray_after.h \
+ ${bits_srcdir}/valarray_meta.h \
${bits_srcdir}/vector.tcc
diff --git a/libstdc++-v3/include/bits/c++config b/libstdc++-v3/include/bits/c++config
index 60dfecad309..5b8611b49ee 100644
--- a/libstdc++-v3/include/bits/c++config
+++ b/libstdc++-v3/include/bits/c++config
@@ -34,7 +34,7 @@
#include <bits/os_defines.h>
// The current version of the C++ library in compressed ISO date format.
-#define __GLIBCPP__ 20030125
+#define __GLIBCPP__ 20030124
// This is necessary until GCC supports separate template
// compilation.
diff --git a/libstdc++-v3/include/bits/valarray_before.h b/libstdc++-v3/include/bits/valarray_before.h
deleted file mode 100644
index 13b53494987..00000000000
--- a/libstdc++-v3/include/bits/valarray_before.h
+++ /dev/null
@@ -1,701 +0,0 @@
-// The template and inlines for the -*- C++ -*- internal _Meta class.
-
-// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 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.
-
-// Written by Gabriel Dos Reis <Gabriel.Dos-Reis@cmla.ens-cachan.fr>
-
-/** @file valarray_meta.h
- * This is an internal header file, included by other library headers.
- * You should not attempt to use it directly.
- */
-
-#ifndef _CPP_VALARRAY_BEFORE_H
-#define _CPP_VALARRAY_BEFORE_H 1
-
-#pragma GCC system_header
-
-#include <bits/slice_array.h>
-
-namespace std
-{
- //
- // Implementing a loosened valarray return value is tricky.
- // First we need to meet 26.3.1/3: we should not add more than
- // two levels of template nesting. Therefore we resort to template
- // template to "flatten" loosened return value types.
- // At some point we use partial specialization to remove one level
- // template nesting due to _Expr<>
- //
-
- // This class is NOT defined. It doesn't need to.
- template<typename _Tp1, typename _Tp2> class _Constant;
-
- // Implementations of unary functions applied to valarray<>s.
- // I use hard-coded object functions here instead of a generic
- // approach like pointers to function:
- // 1) correctness: some functions take references, others values.
- // we can't deduce the correct type afterwards.
- // 2) efficiency -- object functions can be easily inlined
- // 3) be Koenig-lookup-friendly
-
- struct __abs
- {
- template<typename _Tp>
- _Tp operator()(const _Tp& __t) const { return abs(__t); }
- };
-
- struct __cos
- {
- template<typename _Tp>
- _Tp operator()(const _Tp& __t) const { return cos(__t); }
- };
-
- struct __acos
- {
- template<typename _Tp>
- _Tp operator()(const _Tp& __t) const { return acos(__t); }
- };
-
- struct __cosh
- {
- template<typename _Tp>
- _Tp operator()(const _Tp& __t) const { return cosh(__t); }
- };
-
- struct __sin
- {
- template<typename _Tp>
- _Tp operator()(const _Tp& __t) const { return sin(__t); }
- };
-
- struct __asin
- {
- template<typename _Tp>
- _Tp operator()(const _Tp& __t) const { return asin(__t); }
- };
-
- struct __sinh
- {
- template<typename _Tp>
- _Tp operator()(const _Tp& __t) const { return sinh(__t); }
- };
-
- struct __tan
- {
- template<typename _Tp>
- _Tp operator()(const _Tp& __t) const { return tan(__t); }
- };
-
- struct __atan
- {
- template<typename _Tp>
- _Tp operator()(const _Tp& __t) const { return atan(__t); }
- };
-
- struct __tanh
- {
- template<typename _Tp>
- _Tp operator()(const _Tp& __t) const { return tanh(__t); }
- };
-
- struct __exp
- {
- template<typename _Tp>
- _Tp operator()(const _Tp& __t) const { return exp(__t); }
- };
-
- struct __log
- {
- template<typename _Tp>
- _Tp operator()(const _Tp& __t) const { return log(__t); }
- };
-
- struct __log10
- {
- template<typename _Tp>
- _Tp operator()(const _Tp& __t) const { return log10(__t); }
- };
-
- struct __sqrt
- {
- template<typename _Tp>
- _Tp operator()(const _Tp& __t) const { return sqrt(__t); }
- };
-
- // In the past, we used to tailor operator applications semantics
- // to the specialization of standard function objects (i.e. plus<>, etc.)
- // That is incorrect. Therefore we provide our own surrogates.
-
- struct __unary_plus
- {
- template<typename _Tp>
- _Tp operator()(const _Tp& __t) const { return +__t; }
- };
-
- struct __negate
- {
- template<typename _Tp>
- _Tp operator()(const _Tp& __t) const { return -__t; }
- };
-
- struct __bitwise_not
- {
- template<typename _Tp>
- _Tp operator()(const _Tp& __t) const { return ~__t; }
- };
-
- struct __plus
- {
- template<typename _Tp>
- _Tp operator()(const _Tp& __x, const _Tp& __y) const
- { return __x + __y; }
- };
-
- struct __minus
- {
- template<typename _Tp>
- _Tp operator()(const _Tp& __x, const _Tp& __y) const
- { return __x - __y; }
- };
-
- struct __multiplies
- {
- template<typename _Tp>
- _Tp operator()(const _Tp& __x, const _Tp& __y) const
- { return __x * __y; }
- };
-
- struct __divides
- {
- template<typename _Tp>
- _Tp operator()(const _Tp& __x, const _Tp& __y) const
- { return __x / __y; }
- };
-
- struct __modulus
- {
- template<typename _Tp>
- _Tp operator()(const _Tp& __x, const _Tp& __y) const
- { return __x % __y; }
- };
-
- struct __bitwise_xor
- {
- template<typename _Tp>
- _Tp operator()(const _Tp& __x, const _Tp& __y) const
- { return __x ^ __y; }
- };
-
- struct __bitwise_and
- {
- template<typename _Tp>
- _Tp operator()(const _Tp& __x, const _Tp& __y) const
- { return __x & __y; }
- };
-
- struct __bitwise_or
- {
- template<typename _Tp>
- _Tp operator()(const _Tp& __x, const _Tp& __y) const
- { return __x | __y; }
- };
-
- struct __shift_left
- {
- template<typename _Tp>
- _Tp operator()(const _Tp& __x, const _Tp& __y) const
- { return __x << __y; }
- };
-
- struct __shift_right
- {
- template<typename _Tp>
- _Tp operator()(const _Tp& __x, const _Tp& __y) const
- { return __x >> __y; }
- };
-
- struct __logical_and
- {
- template<typename _Tp>
- bool operator()(const _Tp& __x, const _Tp& __y) const
- { return __x && __y; }
- };
-
- struct __logical_or
- {
- template<typename _Tp>
- bool operator()(const _Tp& __x, const _Tp& __y) const
- { return __x || __y; }
- };
-
- struct __logical_not
- {
- template<typename _Tp>
- bool operator()(const _Tp& __x) const { return !__x; }
- };
-
- struct __equal_to
- {
- template<typename _Tp>
- bool operator()(const _Tp& __x, const _Tp& __y) const
- { return __x == __y; }
- };
-
- struct __not_equal_to
- {
- template<typename _Tp>
- bool operator()(const _Tp& __x, const _Tp& __y) const
- { return __x == __y; }
- };
-
- struct __less
- {
- template<typename _Tp>
- bool operator()(const _Tp& __x, const _Tp& __y) const
- { return __x < __y; }
- };
-
- struct __greater
- {
- template<typename _Tp>
- bool operator()(const _Tp& __x, const _Tp& __y) const
- { return __x > __y; }
- };
-
- struct __less_equal
- {
- template<typename _Tp>
- bool operator()(const _Tp& __x, const _Tp& __y) const
- { return __x <= __y; }
- };
-
- struct __greater_equal
- {
- template<typename _Tp>
- bool operator()(const _Tp& __x, const _Tp& __y) const
- { return __x >= __y; }
- };
-
- // The few binary functions we miss.
- struct __atan2
- {
- template<typename _Tp>
- _Tp operator()(const _Tp& __x, const _Tp& __y) const
- { return atan2(__x, __y); }
- };
-
- struct __pow
- {
- template<typename _Tp>
- _Tp operator()(const _Tp& __x, const _Tp& __y) const
- { return pow(__x, __y); }
- };
-
-
- // We need these bits in order to recover the return type of
- // some functions/operators now that we're no longer using
- // function templates.
- template<typename, typename _Tp>
- struct __fun
- {
- typedef _Tp result_type;
- };
-
- // several specializations for relational operators.
- template<typename _Tp>
- struct __fun<__logical_not, _Tp>
- {
- typedef bool result_type;
- };
-
- template<typename _Tp>
- struct __fun<__logical_and, _Tp>
- {
- typedef bool result_type;
- };
-
- template<typename _Tp>
- struct __fun<__logical_or, _Tp>
- {
- typedef bool result_type;
- };
-
- template<typename _Tp>
- struct __fun<__less, _Tp>
- {
- typedef bool result_type;
- };
-
- template<typename _Tp>
- struct __fun<__greater, _Tp>
- {
- typedef bool result_type;
- };
-
- template<typename _Tp>
- struct __fun<__less_equal, _Tp>
- {
- typedef bool result_type;
- };
-
- template<typename _Tp>
- struct __fun<__greater_equal, _Tp>
- {
- typedef bool result_type;
- };
-
- template<typename _Tp>
- struct __fun<__equal_to, _Tp>
- {
- typedef bool result_type;
- };
-
- template<typename _Tp>
- struct __fun<__not_equal_to, _Tp>
- {
- typedef bool result_type;
- };
-
- //
- // Apply function taking a value/const reference closure
- //
-
- template<typename _Dom, typename _Arg>
- class _FunBase
- {
- public:
- typedef typename _Dom::value_type value_type;
-
- _FunBase(const _Dom& __e, value_type __f(_Arg))
- : _M_expr(__e), _M_func(__f) {}
-
- value_type operator[](size_t __i) const
- { return _M_func (_M_expr[__i]); }
-
- size_t size() const { return _M_expr.size ();}
-
- private:
- const _Dom& _M_expr;
- value_type (*_M_func)(_Arg);
- };
-
- template<class _Dom>
- struct _ValFunClos<_Expr,_Dom> : _FunBase<_Dom, typename _Dom::value_type>
- {
- typedef _FunBase<_Dom, typename _Dom::value_type> _Base;
- typedef typename _Base::value_type value_type;
- typedef value_type _Tp;
-
- _ValFunClos(const _Dom& __e, _Tp __f(_Tp)) : _Base(__e, __f) {}
- };
-
- template<typename _Tp>
- struct _ValFunClos<_ValArray,_Tp> : _FunBase<valarray<_Tp>, _Tp>
- {
- typedef _FunBase<valarray<_Tp>, _Tp> _Base;
- typedef _Tp value_type;
-
- _ValFunClos(const valarray<_Tp>& __v, _Tp __f(_Tp)) : _Base(__v, __f) {}
- };
-
- template<class _Dom>
- struct _RefFunClos<_Expr,_Dom> :
- _FunBase<_Dom, const typename _Dom::value_type&>
- {
- typedef _FunBase<_Dom, const typename _Dom::value_type&> _Base;
- typedef typename _Base::value_type value_type;
- typedef value_type _Tp;
-
- _RefFunClos(const _Dom& __e, _Tp __f(const _Tp&))
- : _Base(__e, __f) {}
- };
-
- template<typename _Tp>
- struct _RefFunClos<_ValArray,_Tp> : _FunBase<valarray<_Tp>, const _Tp&>
- {
- typedef _FunBase<valarray<_Tp>, const _Tp&> _Base;
- typedef _Tp value_type;
-
- _RefFunClos(const valarray<_Tp>& __v, _Tp __f(const _Tp&))
- : _Base(__v, __f) {}
- };
-
- //
- // Unary expression closure.
- //
-
- template<class _Oper, class _Arg>
- class _UnBase
- {
- public:
- typedef typename _Arg::value_type _Vt;
- typedef typename __fun<_Oper, _Vt>::result_type value_type;
-
- _UnBase(const _Arg& __e) : _M_expr(__e) {}
-
- value_type operator[](size_t __i) const
- { return _M_expr[__i]; }
-
- size_t size() const { return _M_expr.size(); }
-
- private:
- const _Arg& _M_expr;
- };
-
- template<class _Oper, class _Dom>
- struct _UnClos<_Oper, _Expr, _Dom> : _UnBase<_Oper, _Dom>
- {
- typedef _Dom _Arg;
- typedef _UnBase<_Oper, _Dom> _Base;
- typedef typename _Base::value_type value_type;
-
- _UnClos(const _Arg& __e) : _Base(__e) {}
- };
-
- template<class _Oper, typename _Tp>
- struct _UnClos<_Oper, _ValArray, _Tp> : _UnBase<_Oper, valarray<_Tp> >
- {
- typedef valarray<_Tp> _Arg;
- typedef _UnBase<_Oper, valarray<_Tp> > _Base;
- typedef typename _Base::value_type value_type;
-
- _UnClos(const _Arg& __e) : _Base(__e) {}
- };
-
-
- //
- // Binary expression closure.
- //
-
- template<class _Oper, class _FirstArg, class _SecondArg>
- class _BinBase
- {
- public:
- typedef typename _FirstArg::value_type _Vt;
- typedef typename __fun<_Oper, _Vt>::result_type value_type;
-
- _BinBase(const _FirstArg& __e1, const _SecondArg& __e2)
- : _M_expr1(__e1), _M_expr2(__e2) {}
-
- value_type operator[](size_t __i) const
- { return _Oper()(_M_expr1[__i], _M_expr2[__i]); }
-
- size_t size() const { return _M_expr1.size(); }
-
- private:
- const _FirstArg& _M_expr1;
- const _SecondArg& _M_expr2;
- };
-
-
- template<class _Oper, class _Clos>
- class _BinBase2
- {
- public:
- typedef typename _Clos::value_type _Vt;
- typedef typename __fun<_Oper, _Vt>::result_type value_type;
-
- _BinBase2(const _Clos& __e, const _Vt& __t)
- : _M_expr1(__e), _M_expr2(__t) {}
-
- value_type operator[](size_t __i) const
- { return _Oper()(_M_expr1[__i], _M_expr2); }
-
- size_t size() const { return _M_expr1.size(); }
-
- private:
- const _Clos& _M_expr1;
- const _Vt& _M_expr2;
- };
-
- template<class _Oper, class _Clos>
- class _BinBase1
- {
- public:
- typedef typename _Clos::value_type _Vt;
- typedef typename __fun<_Oper, _Vt>::result_type value_type;
-
- _BinBase1(const _Vt& __t, const _Clos& __e)
- : _M_expr1(__t), _M_expr2(__e) {}
-
- value_type operator[](size_t __i) const
- { return _Oper()(_M_expr1, _M_expr2[__i]); }
-
- size_t size() const { return _M_expr2.size(); }
-
- private:
- const _Vt& _M_expr1;
- const _Clos& _M_expr2;
- };
-
- template<class _Oper, class _Dom1, class _Dom2>
- struct _BinClos<_Oper, _Expr, _Expr, _Dom1, _Dom2>
- : _BinBase<_Oper,_Dom1,_Dom2>
- {
- typedef _BinBase<_Oper,_Dom1,_Dom2> _Base;
- typedef typename _Base::value_type value_type;
-
- _BinClos(const _Dom1& __e1, const _Dom2& __e2) : _Base(__e1, __e2) {}
- };
-
- template<class _Oper, typename _Tp>
- struct _BinClos<_Oper,_ValArray,_ValArray,_Tp,_Tp>
- : _BinBase<_Oper,valarray<_Tp>,valarray<_Tp> >
- {
- typedef _BinBase<_Oper,valarray<_Tp>,valarray<_Tp> > _Base;
- typedef _Tp value_type;
-
- _BinClos(const valarray<_Tp>& __v, const valarray<_Tp>& __w)
- : _Base(__v, __w) {}
- };
-
- template<class _Oper, class _Dom>
- struct _BinClos<_Oper,_Expr,_ValArray,_Dom,typename _Dom::value_type>
- : _BinBase<_Oper,_Dom,valarray<typename _Dom::value_type> >
- {
- typedef typename _Dom::value_type _Tp;
- typedef _BinBase<_Oper,_Dom,valarray<_Tp> > _Base;
- typedef typename _Base::value_type value_type;
-
- _BinClos(const _Dom& __e1, const valarray<_Tp>& __e2)
- : _Base(__e1, __e2) {}
- };
-
- template<class _Oper, class _Dom>
- struct _BinClos<_Oper,_ValArray,_Expr,typename _Dom::value_type,_Dom>
- : _BinBase<_Oper,valarray<typename _Dom::value_type>,_Dom>
- {
- typedef typename _Dom::value_type _Tp;
- typedef _BinBase<_Oper,valarray<_Tp>,_Dom> _Base;
- typedef typename _Base::value_type value_type;
-
- _BinClos(const valarray<_Tp>& __e1, const _Dom& __e2)
- : _Base(__e1, __e2) {}
- };
-
- template<class _Oper, class _Dom>
- struct _BinClos<_Oper,_Expr,_Constant,_Dom,typename _Dom::value_type>
- : _BinBase2<_Oper,_Dom>
- {
- typedef typename _Dom::value_type _Tp;
- typedef _BinBase2<_Oper,_Dom> _Base;
- typedef typename _Base::value_type value_type;
-
- _BinClos(const _Dom& __e1, const _Tp& __e2) : _Base(__e1, __e2) {}
- };
-
- template<class _Oper, class _Dom>
- struct _BinClos<_Oper,_Constant,_Expr,typename _Dom::value_type,_Dom>
- : _BinBase1<_Oper,_Dom>
- {
- typedef typename _Dom::value_type _Tp;
- typedef _BinBase1<_Oper,_Dom> _Base;
- typedef typename _Base::value_type value_type;
-
- _BinClos(const _Tp& __e1, const _Dom& __e2) : _Base(__e1, __e2) {}
- };
-
- template<class _Oper, typename _Tp>
- struct _BinClos<_Oper,_ValArray,_Constant,_Tp,_Tp>
- : _BinBase2<_Oper,valarray<_Tp> >
- {
- typedef _BinBase2<_Oper,valarray<_Tp> > _Base;
- typedef typename _Base::value_type value_type;
-
- _BinClos(const valarray<_Tp>& __v, const _Tp& __t) : _Base(__v, __t) {}
- };
-
- template<class _Oper, typename _Tp>
- struct _BinClos<_Oper,_Constant,_ValArray,_Tp,_Tp>
- : _BinBase1<_Oper,valarray<_Tp> >
- {
- typedef _BinBase1<_Oper,valarray<_Tp> > _Base;
- typedef typename _Base::value_type value_type;
-
- _BinClos(const _Tp& __t, const valarray<_Tp>& __v) : _Base(__t, __v) {}
- };
-
-
- //
- // slice_array closure.
- //
- template<typename _Dom> class _SBase {
- public:
- typedef typename _Dom::value_type value_type;
-
- _SBase (const _Dom& __e, const slice& __s)
- : _M_expr (__e), _M_slice (__s) {}
- value_type operator[] (size_t __i) const
- { return _M_expr[_M_slice.start () + __i * _M_slice.stride ()]; }
- size_t size() const { return _M_slice.size (); }
-
- private:
- const _Dom& _M_expr;
- const slice& _M_slice;
- };
-
- template<typename _Tp> class _SBase<_Array<_Tp> > {
- public:
- typedef _Tp value_type;
-
- _SBase (_Array<_Tp> __a, const slice& __s)
- : _M_array (__a._M_data+__s.start()), _M_size (__s.size()),
- _M_stride (__s.stride()) {}
- value_type operator[] (size_t __i) const
- { return _M_array._M_data[__i * _M_stride]; }
- size_t size() const { return _M_size; }
-
- private:
- const _Array<_Tp> _M_array;
- const size_t _M_size;
- const size_t _M_stride;
- };
-
- template<class _Dom> struct _SClos<_Expr,_Dom> : _SBase<_Dom> {
- typedef _SBase<_Dom> _Base;
- typedef typename _Base::value_type value_type;
-
- _SClos (const _Dom& __e, const slice& __s) : _Base (__e, __s) {}
- };
-
- template<typename _Tp>
- struct _SClos<_ValArray,_Tp> : _SBase<_Array<_Tp> > {
- typedef _SBase<_Array<_Tp> > _Base;
- typedef _Tp value_type;
-
- _SClos (_Array<_Tp> __a, const slice& __s) : _Base (__a, __s) {}
- };
-
-} // std::
-
-
-#endif /* _CPP_VALARRAY_BEFORE_H */
-
-// Local Variables:
-// mode:c++
-// End:
diff --git a/libstdc++-v3/include/bits/valarray_after.h b/libstdc++-v3/include/bits/valarray_meta.h
index 687e6d21321..457f6bb5b71 100644
--- a/libstdc++-v3/include/bits/valarray_after.h
+++ b/libstdc++-v3/include/bits/valarray_meta.h
@@ -1,6 +1,6 @@
// The template and inlines for the -*- C++ -*- internal _Meta class.
-// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002 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
@@ -34,14 +34,663 @@
* You should not attempt to use it directly.
*/
-#ifndef _CPP_VALARRAY_AFTER_H
-#define _CPP_VALARRAY_AFTER_H 1
+#ifndef _CPP_VALARRAY_META_H
+#define _CPP_VALARRAY_META_H 1
#pragma GCC system_header
+#include <bits/slice_array.h>
+
namespace std
{
+ //
+ // Implementing a loosened valarray return value is tricky.
+ // First we need to meet 26.3.1/3: we should not add more than
+ // two levels of template nesting. Therefore we resort to template
+ // template to "flatten" loosened return value types.
+ // At some point we use partial specialization to remove one level
+ // template nesting due to _Expr<>
+ //
+ // This class is NOT defined. It doesn't need to.
+ template<typename _Tp1, typename _Tp2> class _Constant;
+
+ // Implementations of unary functions applied to valarray<>s.
+ // I use hard-coded object functions here instead of a generic
+ // approach like pointers to function:
+ // 1) correctness: some functions take references, others values.
+ // we can't deduce the correct type afterwards.
+ // 2) efficiency -- object functions can be easily inlined
+ // 3) be Koenig-lookup-friendly
+
+ struct __abs
+ {
+ template<typename _Tp>
+ _Tp operator()(const _Tp& __t) const { return abs(__t); }
+ };
+
+ struct __cos
+ {
+ template<typename _Tp>
+ _Tp operator()(const _Tp& __t) const { return cos(__t); }
+ };
+
+ struct __acos
+ {
+ template<typename _Tp>
+ _Tp operator()(const _Tp& __t) const { return acos(__t); }
+ };
+
+ struct __cosh
+ {
+ template<typename _Tp>
+ _Tp operator()(const _Tp& __t) const { return cosh(__t); }
+ };
+
+ struct __sin
+ {
+ template<typename _Tp>
+ _Tp operator()(const _Tp& __t) const { return sin(__t); }
+ };
+
+ struct __asin
+ {
+ template<typename _Tp>
+ _Tp operator()(const _Tp& __t) const { return asin(__t); }
+ };
+
+ struct __sinh
+ {
+ template<typename _Tp>
+ _Tp operator()(const _Tp& __t) const { return sinh(__t); }
+ };
+
+ struct __tan
+ {
+ template<typename _Tp>
+ _Tp operator()(const _Tp& __t) const { return tan(__t); }
+ };
+
+ struct __atan
+ {
+ template<typename _Tp>
+ _Tp operator()(const _Tp& __t) const { return atan(__t); }
+ };
+
+ struct __tanh
+ {
+ template<typename _Tp>
+ _Tp operator()(const _Tp& __t) const { return tanh(__t); }
+ };
+
+ struct __exp
+ {
+ template<typename _Tp>
+ _Tp operator()(const _Tp& __t) const { return exp(__t); }
+ };
+
+ struct __log
+ {
+ template<typename _Tp>
+ _Tp operator()(const _Tp& __t) const { return log(__t); }
+ };
+
+ struct __log10
+ {
+ template<typename _Tp>
+ _Tp operator()(const _Tp& __t) const { return log10(__t); }
+ };
+
+ struct __sqrt
+ {
+ template<typename _Tp>
+ _Tp operator()(const _Tp& __t) const { return sqrt(__t); }
+ };
+
+ // In the past, we used to tailor operator applications semantics
+ // to the specialization of standard function objects (i.e. plus<>, etc.)
+ // That is incorrect. Therefore we provide our own surrogates.
+
+ struct __unary_plus
+ {
+ template<typename _Tp>
+ _Tp operator()(const _Tp& __t) const { return +__t; }
+ };
+
+ struct __negate
+ {
+ template<typename _Tp>
+ _Tp operator()(const _Tp& __t) const { return -__t; }
+ };
+
+ struct __bitwise_not
+ {
+ template<typename _Tp>
+ _Tp operator()(const _Tp& __t) const { return ~__t; }
+ };
+
+ struct __plus
+ {
+ template<typename _Tp>
+ _Tp operator()(const _Tp& __x, const _Tp& __y) const
+ { return __x + __y; }
+ };
+
+ struct __minus
+ {
+ template<typename _Tp>
+ _Tp operator()(const _Tp& __x, const _Tp& __y) const
+ { return __x - __y; }
+ };
+
+ struct __multiplies
+ {
+ template<typename _Tp>
+ _Tp operator()(const _Tp& __x, const _Tp& __y) const
+ { return __x * __y; }
+ };
+
+ struct __divides
+ {
+ template<typename _Tp>
+ _Tp operator()(const _Tp& __x, const _Tp& __y) const
+ { return __x / __y; }
+ };
+
+ struct __modulus
+ {
+ template<typename _Tp>
+ _Tp operator()(const _Tp& __x, const _Tp& __y) const
+ { return __x % __y; }
+ };
+
+ struct __bitwise_xor
+ {
+ template<typename _Tp>
+ _Tp operator()(const _Tp& __x, const _Tp& __y) const
+ { return __x ^ __y; }
+ };
+
+ struct __bitwise_and
+ {
+ template<typename _Tp>
+ _Tp operator()(const _Tp& __x, const _Tp& __y) const
+ { return __x & __y; }
+ };
+
+ struct __bitwise_or
+ {
+ template<typename _Tp>
+ _Tp operator()(const _Tp& __x, const _Tp& __y) const
+ { return __x | __y; }
+ };
+
+ struct __shift_left
+ {
+ template<typename _Tp>
+ _Tp operator()(const _Tp& __x, const _Tp& __y) const
+ { return __x << __y; }
+ };
+
+ struct __shift_right
+ {
+ template<typename _Tp>
+ _Tp operator()(const _Tp& __x, const _Tp& __y) const
+ { return __x >> __y; }
+ };
+
+ struct __logical_and
+ {
+ template<typename _Tp>
+ bool operator()(const _Tp& __x, const _Tp& __y) const
+ { return __x && __y; }
+ };
+
+ struct __logical_or
+ {
+ template<typename _Tp>
+ bool operator()(const _Tp& __x, const _Tp& __y) const
+ { return __x || __y; }
+ };
+
+ struct __logical_not
+ {
+ template<typename _Tp>
+ bool operator()(const _Tp& __x) const { return !__x; }
+ };
+
+ struct __equal_to
+ {
+ template<typename _Tp>
+ bool operator()(const _Tp& __x, const _Tp& __y) const
+ { return __x == __y; }
+ };
+
+ struct __not_equal_to
+ {
+ template<typename _Tp>
+ bool operator()(const _Tp& __x, const _Tp& __y) const
+ { return __x == __y; }
+ };
+
+ struct __less
+ {
+ template<typename _Tp>
+ bool operator()(const _Tp& __x, const _Tp& __y) const
+ { return __x < __y; }
+ };
+
+ struct __greater
+ {
+ template<typename _Tp>
+ bool operator()(const _Tp& __x, const _Tp& __y) const
+ { return __x > __y; }
+ };
+
+ struct __less_equal
+ {
+ template<typename _Tp>
+ bool operator()(const _Tp& __x, const _Tp& __y) const
+ { return __x <= __y; }
+ };
+
+ struct __greater_equal
+ {
+ template<typename _Tp>
+ bool operator()(const _Tp& __x, const _Tp& __y) const
+ { return __x >= __y; }
+ };
+
+ // The few binary functions we miss.
+ struct __atan2
+ {
+ template<typename _Tp>
+ _Tp operator()(const _Tp& __x, const _Tp& __y) const
+ { return atan2(__x, __y); }
+ };
+
+ struct __pow
+ {
+ template<typename _Tp>
+ _Tp operator()(const _Tp& __x, const _Tp& __y) const
+ { return pow(__x, __y); }
+ };
+
+
+ // We need these bits in order to recover the return type of
+ // some functions/operators now that we're no longer using
+ // function templates.
+ template<typename, typename _Tp>
+ struct __fun
+ {
+ typedef _Tp result_type;
+ };
+
+ // several specializations for relational operators.
+ template<typename _Tp>
+ struct __fun<__logical_not, _Tp>
+ {
+ typedef bool result_type;
+ };
+
+ template<typename _Tp>
+ struct __fun<__logical_and, _Tp>
+ {
+ typedef bool result_type;
+ };
+
+ template<typename _Tp>
+ struct __fun<__logical_or, _Tp>
+ {
+ typedef bool result_type;
+ };
+
+ template<typename _Tp>
+ struct __fun<__less, _Tp>
+ {
+ typedef bool result_type;
+ };
+
+ template<typename _Tp>
+ struct __fun<__greater, _Tp>
+ {
+ typedef bool result_type;
+ };
+
+ template<typename _Tp>
+ struct __fun<__less_equal, _Tp>
+ {
+ typedef bool result_type;
+ };
+
+ template<typename _Tp>
+ struct __fun<__greater_equal, _Tp>
+ {
+ typedef bool result_type;
+ };
+
+ template<typename _Tp>
+ struct __fun<__equal_to, _Tp>
+ {
+ typedef bool result_type;
+ };
+
+ template<typename _Tp>
+ struct __fun<__not_equal_to, _Tp>
+ {
+ typedef bool result_type;
+ };
+
+ //
+ // Apply function taking a value/const reference closure
+ //
+
+ template<typename _Dom, typename _Arg>
+ class _FunBase
+ {
+ public:
+ typedef typename _Dom::value_type value_type;
+
+ _FunBase(const _Dom& __e, value_type __f(_Arg))
+ : _M_expr(__e), _M_func(__f) {}
+
+ value_type operator[](size_t __i) const
+ { return _M_func (_M_expr[__i]); }
+
+ size_t size() const { return _M_expr.size ();}
+
+ private:
+ const _Dom& _M_expr;
+ value_type (*_M_func)(_Arg);
+ };
+
+ template<class _Dom>
+ struct _ValFunClos<_Expr,_Dom> : _FunBase<_Dom, typename _Dom::value_type>
+ {
+ typedef _FunBase<_Dom, typename _Dom::value_type> _Base;
+ typedef typename _Base::value_type value_type;
+ typedef value_type _Tp;
+
+ _ValFunClos(const _Dom& __e, _Tp __f(_Tp)) : _Base(__e, __f) {}
+ };
+
+ template<typename _Tp>
+ struct _ValFunClos<_ValArray,_Tp> : _FunBase<valarray<_Tp>, _Tp>
+ {
+ typedef _FunBase<valarray<_Tp>, _Tp> _Base;
+ typedef _Tp value_type;
+
+ _ValFunClos(const valarray<_Tp>& __v, _Tp __f(_Tp)) : _Base(__v, __f) {}
+ };
+
+ template<class _Dom>
+ struct _RefFunClos<_Expr,_Dom> :
+ _FunBase<_Dom, const typename _Dom::value_type&>
+ {
+ typedef _FunBase<_Dom, const typename _Dom::value_type&> _Base;
+ typedef typename _Base::value_type value_type;
+ typedef value_type _Tp;
+
+ _RefFunClos(const _Dom& __e, _Tp __f(const _Tp&))
+ : _Base(__e, __f) {}
+ };
+
+ template<typename _Tp>
+ struct _RefFunClos<_ValArray,_Tp> : _FunBase<valarray<_Tp>, const _Tp&>
+ {
+ typedef _FunBase<valarray<_Tp>, const _Tp&> _Base;
+ typedef _Tp value_type;
+
+ _RefFunClos(const valarray<_Tp>& __v, _Tp __f(const _Tp&))
+ : _Base(__v, __f) {}
+ };
+
+ //
+ // Unary expression closure.
+ //
+
+ template<class _Oper, class _Arg>
+ class _UnBase
+ {
+ public:
+ typedef typename _Arg::value_type _Vt;
+ typedef typename __fun<_Oper, _Vt>::result_type value_type;
+
+ _UnBase(const _Arg& __e) : _M_expr(__e) {}
+
+ value_type operator[](size_t __i) const
+ { return _M_expr[__i]; }
+
+ size_t size() const { return _M_expr.size(); }
+
+ private:
+ const _Arg& _M_expr;
+ };
+
+ template<class _Oper, class _Dom>
+ struct _UnClos<_Oper, _Expr, _Dom> : _UnBase<_Oper, _Dom>
+ {
+ typedef _Dom _Arg;
+ typedef _UnBase<_Oper, _Dom> _Base;
+ typedef typename _Base::value_type value_type;
+
+ _UnClos(const _Arg& __e) : _Base(__e) {}
+ };
+
+ template<class _Oper, typename _Tp>
+ struct _UnClos<_Oper, _ValArray, _Tp> : _UnBase<_Oper, valarray<_Tp> >
+ {
+ typedef valarray<_Tp> _Arg;
+ typedef _UnBase<_Oper, valarray<_Tp> > _Base;
+ typedef typename _Base::value_type value_type;
+
+ _UnClos(const _Arg& __e) : _Base(__e) {}
+ };
+
+
+ //
+ // Binary expression closure.
+ //
+
+ template<class _Oper, class _FirstArg, class _SecondArg>
+ class _BinBase
+ {
+ public:
+ typedef typename _FirstArg::value_type _Vt;
+ typedef typename __fun<_Oper, _Vt>::result_type value_type;
+
+ _BinBase(const _FirstArg& __e1, const _SecondArg& __e2)
+ : _M_expr1(__e1), _M_expr2(__e2) {}
+
+ value_type operator[](size_t __i) const
+ { return _Oper()(_M_expr1[__i], _M_expr2[__i]); }
+
+ size_t size() const { return _M_expr1.size(); }
+
+ private:
+ const _FirstArg& _M_expr1;
+ const _SecondArg& _M_expr2;
+ };
+
+
+ template<class _Oper, class _Clos>
+ class _BinBase2
+ {
+ public:
+ typedef typename _Clos::value_type _Vt;
+ typedef typename __fun<_Oper, _Vt>::result_type value_type;
+
+ _BinBase2(const _Clos& __e, const _Vt& __t)
+ : _M_expr1(__e), _M_expr2(__t) {}
+
+ value_type operator[](size_t __i) const
+ { return _Oper()(_M_expr1[__i], _M_expr2); }
+
+ size_t size() const { return _M_expr1.size(); }
+
+ private:
+ const _Clos& _M_expr1;
+ const _Vt& _M_expr2;
+ };
+
+ template<class _Oper, class _Clos>
+ class _BinBase1
+ {
+ public:
+ typedef typename _Clos::value_type _Vt;
+ typedef typename __fun<_Oper, _Vt>::result_type value_type;
+
+ _BinBase1(const _Vt& __t, const _Clos& __e)
+ : _M_expr1(__t), _M_expr2(__e) {}
+
+ value_type operator[](size_t __i) const
+ { return _Oper()(_M_expr1, _M_expr2[__i]); }
+
+ size_t size() const { return _M_expr2.size(); }
+
+ private:
+ const _Vt& _M_expr1;
+ const _Clos& _M_expr2;
+ };
+
+ template<class _Oper, class _Dom1, class _Dom2>
+ struct _BinClos<_Oper, _Expr, _Expr, _Dom1, _Dom2>
+ : _BinBase<_Oper,_Dom1,_Dom2>
+ {
+ typedef _BinBase<_Oper,_Dom1,_Dom2> _Base;
+ typedef typename _Base::value_type value_type;
+
+ _BinClos(const _Dom1& __e1, const _Dom2& __e2) : _Base(__e1, __e2) {}
+ };
+
+ template<class _Oper, typename _Tp>
+ struct _BinClos<_Oper,_ValArray,_ValArray,_Tp,_Tp>
+ : _BinBase<_Oper,valarray<_Tp>,valarray<_Tp> >
+ {
+ typedef _BinBase<_Oper,valarray<_Tp>,valarray<_Tp> > _Base;
+ typedef _Tp value_type;
+
+ _BinClos(const valarray<_Tp>& __v, const valarray<_Tp>& __w)
+ : _Base(__v, __w) {}
+ };
+
+ template<class _Oper, class _Dom>
+ struct _BinClos<_Oper,_Expr,_ValArray,_Dom,typename _Dom::value_type>
+ : _BinBase<_Oper,_Dom,valarray<typename _Dom::value_type> >
+ {
+ typedef typename _Dom::value_type _Tp;
+ typedef _BinBase<_Oper,_Dom,valarray<_Tp> > _Base;
+ typedef typename _Base::value_type value_type;
+
+ _BinClos(const _Dom& __e1, const valarray<_Tp>& __e2)
+ : _Base(__e1, __e2) {}
+ };
+
+ template<class _Oper, class _Dom>
+ struct _BinClos<_Oper,_ValArray,_Expr,typename _Dom::value_type,_Dom>
+ : _BinBase<_Oper,valarray<typename _Dom::value_type>,_Dom>
+ {
+ typedef typename _Dom::value_type _Tp;
+ typedef _BinBase<_Oper,valarray<_Tp>,_Dom> _Base;
+ typedef typename _Base::value_type value_type;
+
+ _BinClos(const valarray<_Tp>& __e1, const _Dom& __e2)
+ : _Base(__e1, __e2) {}
+ };
+
+ template<class _Oper, class _Dom>
+ struct _BinClos<_Oper,_Expr,_Constant,_Dom,typename _Dom::value_type>
+ : _BinBase2<_Oper,_Dom>
+ {
+ typedef typename _Dom::value_type _Tp;
+ typedef _BinBase2<_Oper,_Dom> _Base;
+ typedef typename _Base::value_type value_type;
+
+ _BinClos(const _Dom& __e1, const _Tp& __e2) : _Base(__e1, __e2) {}
+ };
+
+ template<class _Oper, class _Dom>
+ struct _BinClos<_Oper,_Constant,_Expr,typename _Dom::value_type,_Dom>
+ : _BinBase1<_Oper,_Dom>
+ {
+ typedef typename _Dom::value_type _Tp;
+ typedef _BinBase1<_Oper,_Dom> _Base;
+ typedef typename _Base::value_type value_type;
+
+ _BinClos(const _Tp& __e1, const _Dom& __e2) : _Base(__e1, __e2) {}
+ };
+
+ template<class _Oper, typename _Tp>
+ struct _BinClos<_Oper,_ValArray,_Constant,_Tp,_Tp>
+ : _BinBase2<_Oper,valarray<_Tp> >
+ {
+ typedef _BinBase2<_Oper,valarray<_Tp> > _Base;
+ typedef typename _Base::value_type value_type;
+
+ _BinClos(const valarray<_Tp>& __v, const _Tp& __t) : _Base(__v, __t) {}
+ };
+
+ template<class _Oper, typename _Tp>
+ struct _BinClos<_Oper,_Constant,_ValArray,_Tp,_Tp>
+ : _BinBase1<_Oper,valarray<_Tp> >
+ {
+ typedef _BinBase1<_Oper,valarray<_Tp> > _Base;
+ typedef typename _Base::value_type value_type;
+
+ _BinClos(const _Tp& __t, const valarray<_Tp>& __v) : _Base(__t, __v) {}
+ };
+
+
+ //
+ // slice_array closure.
+ //
+ template<typename _Dom> class _SBase {
+ public:
+ typedef typename _Dom::value_type value_type;
+
+ _SBase (const _Dom& __e, const slice& __s)
+ : _M_expr (__e), _M_slice (__s) {}
+ value_type operator[] (size_t __i) const
+ { return _M_expr[_M_slice.start () + __i * _M_slice.stride ()]; }
+ size_t size() const { return _M_slice.size (); }
+
+ private:
+ const _Dom& _M_expr;
+ const slice& _M_slice;
+ };
+
+ template<typename _Tp> class _SBase<_Array<_Tp> > {
+ public:
+ typedef _Tp value_type;
+
+ _SBase (_Array<_Tp> __a, const slice& __s)
+ : _M_array (__a._M_data+__s.start()), _M_size (__s.size()),
+ _M_stride (__s.stride()) {}
+ value_type operator[] (size_t __i) const
+ { return _M_array._M_data[__i * _M_stride]; }
+ size_t size() const { return _M_size; }
+
+ private:
+ const _Array<_Tp> _M_array;
+ const size_t _M_size;
+ const size_t _M_stride;
+ };
+
+ template<class _Dom> struct _SClos<_Expr,_Dom> : _SBase<_Dom> {
+ typedef _SBase<_Dom> _Base;
+ typedef typename _Base::value_type value_type;
+
+ _SClos (const _Dom& __e, const slice& __s) : _Base (__e, __s) {}
+ };
+
+ template<typename _Tp>
+ struct _SClos<_ValArray,_Tp> : _SBase<_Array<_Tp> > {
+ typedef _SBase<_Array<_Tp> > _Base;
+ typedef _Tp value_type;
+
+ _SClos (_Array<_Tp> __a, const slice& __s) : _Base (__a, __s) {}
+ };
+
//
// gslice_array closure.
//
@@ -95,6 +744,7 @@ namespace std
//
// indirect_array closure
//
+
template<class _Dom> class _IBase {
public:
typedef typename _Dom::value_type value_type;
@@ -492,7 +1142,7 @@ _DEFINE_EXPR_BINARY_FUNCTION(pow)
} // std::
-#endif /* _CPP_VALARRAY_AFTER_H */
+#endif /* _CPP_VALARRAY_META_H */
// Local Variables:
// mode:c++
diff --git a/libstdc++-v3/include/std/std_valarray.h b/libstdc++-v3/include/std/std_valarray.h
index 31b84399c72..b4de5dfec37 100644
--- a/libstdc++-v3/include/std/std_valarray.h
+++ b/libstdc++-v3/include/std/std_valarray.h
@@ -90,7 +90,7 @@ namespace std
} // namespace std
#include <bits/valarray_array.h>
-#include <bits/valarray_before.h>
+#include <bits/valarray_meta.h>
namespace std
{
@@ -229,9 +229,7 @@ namespace std
{ return _M_data[__i]; }
} // std::
-
-#include <bits/valarray_after.h>
-
+
#include <bits/slice_array.h>
#include <bits/gslice.h>
#include <bits/gslice_array.h>