diff options
author | kan <kan@FreeBSD.org> | 2004-08-12 16:41:42 +0000 |
---|---|---|
committer | kan <kan@FreeBSD.org> | 2004-08-12 16:41:42 +0000 |
commit | 1cd197c850fbf2cebb1cf92e2cc7b1ad60e19cbb (patch) | |
tree | ec9fa386d0db0e8a0278709d5705ff4b03fe8a31 | |
parent | 44be17529b330657e94bec9b7c894ed5dcd5f8b0 (diff) | |
download | FreeBSD-src-1cd197c850fbf2cebb1cf92e2cc7b1ad60e19cbb.zip FreeBSD-src-1cd197c850fbf2cebb1cf92e2cc7b1ad60e19cbb.tar.gz |
This commit was generated by cvs2svn to compensate for changes in r133582,
which included commits to RCS files with non-trunk default branches.
105 files changed, 0 insertions, 33131 deletions
diff --git a/contrib/gcc/acconfig.h b/contrib/gcc/acconfig.h deleted file mode 100644 index 6367cf1..0000000 --- a/contrib/gcc/acconfig.h +++ /dev/null @@ -1,44 +0,0 @@ -/* Define to 1 if NLS is requested. */ -#undef ENABLE_NLS - -/* Define as 1 if you have catgets and don't want to use GNU gettext. */ -#undef HAVE_CATGETS - -/* Define as 1 if you have gettext and don't want to use GNU gettext. */ -#undef HAVE_GETTEXT - -/* Define if your locale.h file contains LC_MESSAGES. */ -#undef HAVE_LC_MESSAGES - -/* Define as 1 if you have the stpcpy function. */ -#undef HAVE_STPCPY - -/* Define if your assembler supports specifying the maximum number - of bytes to skip when using the GAS .p2align command. */ -#undef HAVE_GAS_MAX_SKIP_P2ALIGN - -/* Define if your assembler supports .balign and .p2align. */ -#undef HAVE_GAS_BALIGN_AND_P2ALIGN - -/* Define if your assembler uses the old HImode fild and fist notation. */ -#undef HAVE_GAS_FILDS_FISTS - -/* Define to `int' if <sys/types.h> doesn't define. */ -#undef ssize_t - -/* Define if cpp should also search $prefix/include. */ -#undef PREFIX_INCLUDE_DIR - -@BOTTOM@ - -/* Bison unconditionally undefines `const' if neither `__STDC__' nor - __cplusplus are defined. That's a problem since we use `const' in - the GCC headers, and the resulting bison code is therefore type - unsafe. Thus, we must match the bison behavior here. */ - -#ifndef __STDC__ -#ifndef __cplusplus -#undef const -#define const -#endif -#endif diff --git a/contrib/gcc/config.guess b/contrib/gcc/config.guess deleted file mode 100755 index fd7602d..0000000 --- a/contrib/gcc/config.guess +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/sh -# Use the top-level config.guess so that we don't have two of them. -guesssys=`echo $0 | sed 's|config.guess|../config.guess|'` -exec ${guesssys} "$@" diff --git a/contrib/gcc/config/alpha/alpha-interix.h b/contrib/gcc/config/alpha/alpha-interix.h deleted file mode 100644 index 3f1580d..0000000 --- a/contrib/gcc/config/alpha/alpha-interix.h +++ /dev/null @@ -1,150 +0,0 @@ -/* Definitions of target machine for GNU compiler, for DEC Alpha - running Windows/NT. - Copyright (C) 1995, 1996, 1999, 2000, 2002 Free Software Foundation, Inc. - - Donn Terry, Softway Systems, Inc. - From code - Contributed by Richard Kenner (kenner@vlsi1.ultra.nyu.edu) - -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. */ - -/* cpp handles __STDC__ */ -/* The three "Alpha" defines on the first such line are from the CLAXP spec */ -#define TARGET_OS_CPP_BUILTINS() \ - do { \ - builtin_define ("__INTERIX"); \ - builtin_define ("__OPENNT"); \ - builtin_define ("__Alpha_AXP"); \ - builtin_define ("_M_ALPHA"); \ - builtin_define ("_ALPHA_"); \ - builtin_define ("__stdcall="); \ - builtin_define ("__cdecl="); \ - builtin_assert ("system=unix"); \ - builtin_assert ("system=interix"); \ - } while (0) - -#undef CPP_SUBTARGET_SPEC -#define CPP_SUBTARGET_SPEC "\ --remap \ -%{posix:-D_POSIX_SOURCE} \ --isystem %$INTERIX_ROOT/usr/include" - -#undef TARGET_VERSION -#define TARGET_VERSION fprintf (stderr, " (alpha Interix)"); - -/* alpha.h sets this, but it doesn't apply to us */ -#undef OBJECT_FORMAT_ECOFF -#undef OBJECT_FORMAT_COFF - -/* LINK_SPEC */ - -/* MD_STARTFILE_PREFIX */ - -/* ASM_OUTPUT_LOOP_ALIGN; ASM_OUTPUT_ALIGN_CODE */ - -/* Codegen macro overrides for NT internal conventions */ - -/* the below are ecoff specific... we don't need them, so - undef them (they'll get a default later) */ - -#undef PUT_SDB_BLOCK_START -#undef PUT_SDB_BLOCK_END - -/* The following are needed for C++, but also needed for profiling */ - -/* Support const sections and the ctors and dtors sections for g++. */ - -#define READONLY_DATA_SECTION_ASM_OP "\t.rdata" - -/* Define the pseudo-ops used to switch to the .ctors and .dtors sections. - - Note that we want to give these sections the SHF_WRITE attribute - because these sections will actually contain data (i.e. tables of - addresses of functions in the current root executable or shared library - file) and, in the case of a shared library, the relocatable addresses - will have to be properly resolved/relocated (and then written into) by - the dynamic linker when it actually attaches the given shared library - to the executing process. (Note that on SVR4, you may wish to use the - `-z text' option to the ELF linker, when building a shared library, as - an additional check that you are doing everything right. But if you do - use the `-z text' option when building a shared library, you will get - errors unless the .ctors and .dtors sections are marked as writable - via the SHF_WRITE attribute.) */ - -#define CTORS_SECTION_ASM_OP "\t.ctors" -#define DTORS_SECTION_ASM_OP "\t.dtors" - -/* The linker will take care of this, and having them causes problems with - ld -r (specifically -rU). */ -#define CTOR_LISTS_DEFINED_EXTERNALLY 1 - -#define SET_ASM_OP "\t.set\t" -/* Output a definition (implements alias) */ -#define ASM_OUTPUT_DEF(FILE,LABEL1,LABEL2) \ -do \ -{ \ - fprintf ((FILE), "\t"); \ - assemble_name (FILE, LABEL1); \ - fprintf (FILE, "="); \ - assemble_name (FILE, LABEL2); \ - fprintf (FILE, "\n"); \ - } \ -while (0) - -/* We use the defaults, so undef the null definitions */ -#undef PUT_SDB_FUNCTION_START -#undef PUT_SDB_FUNCTION_END -#undef PUT_SDB_EPILOGUE_END - -#define HOST_PTR_PRINTF "%p" -#define HOST_PTR_AS_INT unsigned long - -#define PCC_BITFIELD_TYPE_MATTERS 1 -#define PCC_BITFIELD_TYPE_TEST TYPE_NATIVE(rec) -#define GROUP_BITFIELDS_BY_ALIGN TYPE_NATIVE(rec) - -/* DWARF2 Unwinding doesn't work with exception handling yet. */ -#undef DWARF2_UNWIND_INFO -#define DWARF2_UNWIND_INFO 0 - -/* Don't assume anything about the header files. */ -#define NO_IMPLICIT_EXTERN_C - -/* The definition of this macro implies that there are cases where - a scalar value cannot be returned in registers. - - On NT (according to the spec) anything except strings/array that fits - in 64 bits is returned in the registers (this appears to differ from - the rest of the Alpha family). */ - -#undef RETURN_IN_MEMORY -#define RETURN_IN_MEMORY(TYPE) \ - (TREE_CODE (TYPE) == ARRAY_TYPE || int_size_in_bytes(TYPE) > 8) - -#define ASM_LOAD_ADDR(loc, reg) " lda " #reg "," #loc "\n" - -#undef ASM_FILE_START -#define ASM_FILE_START(FILE) \ -{ \ - alpha_write_verstamp (FILE); \ - fprintf (FILE, "\t.set noreorder\n"); \ - fprintf (FILE, "\t.set volatile\n"); \ - fprintf (FILE, "\t.set noat\n"); \ - fprintf (FILE, "\t.globl\t__fltused\n"); \ - ASM_OUTPUT_SOURCE_FILENAME (FILE, main_input_filename); \ -} diff --git a/contrib/gcc/config/alpha/alpha32.h b/contrib/gcc/config/alpha/alpha32.h deleted file mode 100644 index 8d9df0b..0000000 --- a/contrib/gcc/config/alpha/alpha32.h +++ /dev/null @@ -1,85 +0,0 @@ -/* Definitions of target machine for GNU compiler, for DEC Alpha - running Windows/NT. - Copyright (C) 1995, 1996, 1998, 1999 Free Software Foundation, Inc. - - Derived from code - Contributed by Richard Kenner (kenner@vlsi1.ultra.nyu.edu) - - Donn Terry, Softway Systems, Inc. - - This file contains the code-generation stuff common to the 32-bit - versions of the DEC/Compaq Alpha architecture. It is shared by - Interix and NT/Win32 ports. It should not contain compile-time - or run-time dependent environment values (such as compiler options - or anything containing a file or pathname.) - -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. */ - -#undef TARGET_ABI_WINDOWS_NT -#define TARGET_ABI_WINDOWS_NT 1 - -/* WinNT (and thus Interix) use unsigned int */ -#define SIZE_TYPE "unsigned int" - -/* Pointer is 32 bits but the hardware has 64-bit addresses, sign extended. */ -#undef POINTER_SIZE -#define POINTER_SIZE 32 -#define POINTERS_EXTEND_UNSIGNED 0 - -/* We don't change Pmode to the "obvious" SI mode... the above appears - to affect the in-memory size; we want the registers to stay DImode - to match the md file */ - -/* "long" is 32 bits. */ -#undef LONG_TYPE_SIZE -#define LONG_TYPE_SIZE 32 - - -/* Output assembler code for a block containing the constant parts - of a trampoline, leaving space for the variable parts. - - The trampoline should set the static chain pointer to value placed - into the trampoline and should branch to the specified routine. */ - -#undef TRAMPOLINE_TEMPLATE -#define TRAMPOLINE_TEMPLATE(FILE) \ -{ \ - fprintf (FILE, "\tbr $27,$LTRAMPP\n"); \ - fprintf (FILE, "$LTRAMPP:\n\tldl $1,12($27)\n"); \ - fprintf (FILE, "\tldl $27,16($27)\n"); \ - fprintf (FILE, "\tjmp $31,($27),0\n"); \ - fprintf (FILE, "\t.long 0,0\n"); \ -} - -/* Length in units of the trampoline for entering a nested function. */ - -#undef TRAMPOLINE_SIZE -#define TRAMPOLINE_SIZE 24 - -/* The alignment of a trampoline, in bits. */ - -#undef TRAMPOLINE_ALIGNMENT -#define TRAMPOLINE_ALIGNMENT 32 - -/* Emit RTL insns to initialize the variable parts of a trampoline. - FNADDR is an RTX for the address of the function's pure code. - CXT is an RTX for the static chain value for the function. */ - -#undef INITIALIZE_TRAMPOLINE -#define INITIALIZE_TRAMPOLINE(TRAMP, FNADDR, CXT) \ - alpha_initialize_trampoline (TRAMP, FNADDR, CXT, 20, 16, 12) diff --git a/contrib/gcc/config/alpha/t-interix b/contrib/gcc/config/alpha/t-interix deleted file mode 100644 index 3d570c6..0000000 --- a/contrib/gcc/config/alpha/t-interix +++ /dev/null @@ -1,7 +0,0 @@ -# t-interix - -# System headers will track gcc's needs. -USER_H= - -LIB1ASMSRC = alpha/lib1funcs.asm -LIB1ASMFUNCS = _divqu _divq _divlu _divl _remqu _remq _remlu _reml diff --git a/contrib/gcc/config/alpha/vxworks.h b/contrib/gcc/config/alpha/vxworks.h deleted file mode 100644 index a27c645..0000000 --- a/contrib/gcc/config/alpha/vxworks.h +++ /dev/null @@ -1,55 +0,0 @@ -/* Definitions of target machine for GNU compiler. Vxworks Alpha version. - Copyright (C) 1998 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. */ - -/* This file just exists to give specs for the Alpha running on VxWorks. */ - -#undef CPP_SUBTARGET_SPEC -#define CPP_SUBTARGET_SPEC "\ -%{mvxsim:-DCPU=SIMALPHADUNIX} \ -%{!mvxsim: %{!mcpu*|mcpu=21064:-DCPU=21064} %{mcpu=21164:-DCPU=21164}} \ -%{posix: -D_POSIX_SOURCE}" - -#define TARGET_OS_CPP_BUILTINS() \ - do { \ - builtin_define ("__vxworks"); \ - builtin_define ("__alpha_vxworks"); \ - builtin_define ("_LONGLONG"); \ - builtin_assert ("system=vxworks"); \ - builtin_assert ("system=embedded"); \ - } while (0) - -/* VxWorks does all the library stuff itself. */ - -#undef LIB_SPEC -#define LIB_SPEC "" - -/* VxWorks uses object files, not loadable images. Make linker just combine - objects. Also show using 32 bit mode and set start of text to 0. */ - -#undef LINK_SPEC -#define LINK_SPEC "-r -taso -T 0" - -/* VxWorks provides the functionality of crt0.o and friends itself. */ - -#undef STARTFILE_SPEC -#define STARTFILE_SPEC "" - -#undef ENDFILE_SPEC -#define ENDFILE_SPEC "" diff --git a/contrib/gcc/config/alpha/xm-alpha-interix.h b/contrib/gcc/config/alpha/xm-alpha-interix.h deleted file mode 100644 index dd71a1d..0000000 --- a/contrib/gcc/config/alpha/xm-alpha-interix.h +++ /dev/null @@ -1,39 +0,0 @@ -/* Configuration for GNU compiler - for an DEC/Compaq Alpha - Copyright (C) 1999, 2001 Free Software Foundation, Inc. - Donn Terry, Softway Systems, Inc. - derived from code by Douglas B. Rupp (drupp@cs.washington.edu) - -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 HOST_BITS_PER_WIDE_INT 64 -#ifdef __GNUC__ -# define HOST_WIDE_INT long long -#else -# define HOST_WIDE_INT __int64 -#endif - -#define HOST_BITS_PER_WIDEST_INT HOST_BITS_PER_LONGLONG -#ifdef __GNUC__ -# define HOST_WIDEST_INT long long -#else -# define HOST_WIDEST_INT __int64 -#endif -#define HOST_WIDEST_INT_PRINT_DEC "%lld" -#define HOST_WIDEST_INT_PRINT_UNSIGNED "%llu" -#define HOST_WIDEST_INT_PRINT_HEX "0x%llx" diff --git a/contrib/gcc/config/alpha/xm-vms64.h b/contrib/gcc/config/alpha/xm-vms64.h deleted file mode 100644 index 26fd829..0000000 --- a/contrib/gcc/config/alpha/xm-vms64.h +++ /dev/null @@ -1,29 +0,0 @@ -/* Configuration for GNU C-compiler for openVMS/Alpha. - Copyright (C) 2001 Free Software Foundation, Inc. - Contributed by Douglas Rupp (rupp@gnat.com). - -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. */ - -#undef HOST_WIDE_INT - -/* Since DEC C long != Gnu C long */ -#define HOST_PTR_PRINTF "%llx" -#define HOST_WIDE_INT_PRINT_DEC "%lld" -#define HOST_WIDE_INT_PRINT_UNSIGNED "%llu" -#define HOST_WIDE_INT_PRINT_HEX "0x%llx" -#define HOST_WIDE_INT_PRINT_DOUBLE_HEX "0x%llx%016llx" diff --git a/contrib/gcc/config/aoutos.h b/contrib/gcc/config/aoutos.h deleted file mode 100644 index 6f4e262..0000000 --- a/contrib/gcc/config/aoutos.h +++ /dev/null @@ -1,41 +0,0 @@ -/* aoutos.h -- operating system specific defines to be used when - targeting GCC for some system that uses a.out file format. - Copyright (C) 1992 Free Software Foundation, Inc. - - Written by Ron Guilmette (rfg@netcom.com). - -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. */ - -/* To use this file, make up a file with a name like: - - ?????aout.h - - where ????? is replaced by the name of the basic hardware that you - are targeting for. Then, in the file ?????aout.h, put something - like: - - #include "?????.h" - #include "aoutos.h" - - followed by any really system-specific defines (or overrides of - defines) which you find that you need. Now, modify the configure - or configure.in script to properly use the new ?????aout.h file - when configuring for the system. */ - -/* Define a symbol indicating that we are using aoutos.h. */ -#define USING_AOUTOS_H diff --git a/contrib/gcc/config/arm/conix-elf.h b/contrib/gcc/config/arm/conix-elf.h deleted file mode 100644 index 4a137d6..0000000 --- a/contrib/gcc/config/arm/conix-elf.h +++ /dev/null @@ -1,46 +0,0 @@ -/* Definitions of target machine for GNU compiler, - for ARM with ConiX OS. - Copyright (C) 2000, 2001 Free Software Foundation, Inc. - Contributed by Philip Blundell <pb@futuretv.com> - -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. */ - -/* elfos.h should have already been included. Now just override - any conflicting definitions and add any extras. */ - -/* Run-time Target Specification. */ -#undef TARGET_VERSION -#define TARGET_VERSION fputs (" (ARM/ELF ConiX)", stderr); - -/* Default to using APCS-32 and software floating point. */ -#undef TARGET_DEFAULT -#define TARGET_DEFAULT (ARM_FLAG_SOFT_FLOAT | ARM_FLAG_APCS_32) - -#ifndef CPP_APCS_PC_DEFAULT_SPEC -#define CPP_APCS_PC_DEFAULT_SPEC "-D__APCS_32__" -#endif - -#ifndef SUBTARGET_CPU_DEFAULT -#define SUBTARGET_CPU_DEFAULT TARGET_CPU_arm7tdmi -#endif - -#define TARGET_OS_CPP_BUILTINS() \ - do { \ - builtin_define ("__CONIX__"); \ - builtin_define ("__ELF__"); \ - } while (0) diff --git a/contrib/gcc/config/arm/t-arm-aout b/contrib/gcc/config/arm/t-arm-aout deleted file mode 100644 index 2ce20e4..0000000 --- a/contrib/gcc/config/arm/t-arm-aout +++ /dev/null @@ -1,29 +0,0 @@ -LIB1ASMSRC = arm/lib1funcs.asm -LIB1ASMFUNCS = _udivsi3 _divsi3 _umodsi3 _modsi3 _dvmd_tls _call_via_rX _interwork_call_via_rX - -# We want fine grained libraries, so use the new code to build the -# floating point emulation libraries. -FPBIT = fp-bit.c -DPBIT = dp-bit.c - -fp-bit.c: $(srcdir)/config/fp-bit.c - echo '#define FLOAT' > fp-bit.c - echo '#ifndef __ARMEB__' >> fp-bit.c - echo '#define FLOAT_BIT_ORDER_MISMATCH' >> fp-bit.c - echo '#endif' >> fp-bit.c - cat $(srcdir)/config/fp-bit.c >> fp-bit.c - -dp-bit.c: $(srcdir)/config/fp-bit.c - echo '#ifndef __ARMEB__' > dp-bit.c - echo '#define FLOAT_BIT_ORDER_MISMATCH' >> dp-bit.c - echo '#define FLOAT_WORD_ORDER_MISMATCH' >> dp-bit.c - echo '#endif' >> dp-bit.c - cat $(srcdir)/config/fp-bit.c >> dp-bit.c - -# MULTILIB_OPTIONS = mhard-float/msoft-float mapcs-32/mapcs-26 mno-thumb-interwork/mthumb-interwork arm/thumb -# MULTILIB_DIRNAMES = le be fpu soft 32bit 26bit normal interwork arm thumb -# MULTILIB_MATCHES = -# MULTILIB_EXCEPTIONS = *mapcs-26/*mthumb-interwork* *mpacs-26/*mthumb* - -LIBGCC = stmp-multilib -INSTALL_LIBGCC = install-multilib diff --git a/contrib/gcc/config/arm/t-strongarm-coff b/contrib/gcc/config/arm/t-strongarm-coff deleted file mode 100644 index 0a66360..0000000 --- a/contrib/gcc/config/arm/t-strongarm-coff +++ /dev/null @@ -1,34 +0,0 @@ -LIB1ASMSRC = arm/lib1funcs.asm -LIB1ASMFUNCS = _udivsi3 _divsi3 _umodsi3 _modsi3 _dvmd_tls _bb_init_func - -# We want fine grained libraries, so use the new code to build the -# floating point emulation libraries. -FPBIT = fp-bit.c -DPBIT = dp-bit.c - -fp-bit.c: $(srcdir)/config/fp-bit.c - echo '#define FLOAT' > fp-bit.c - echo '#ifndef __ARMEB__' >> fp-bit.c - echo '#define FLOAT_BIT_ORDER_MISMATCH' >> fp-bit.c - echo '#endif' >> fp-bit.c - cat $(srcdir)/config/fp-bit.c >> fp-bit.c - -dp-bit.c: $(srcdir)/config/fp-bit.c - echo '#ifndef __ARMEB__' > dp-bit.c - echo '#define FLOAT_BIT_ORDER_MISMATCH' >> dp-bit.c - echo '#define FLOAT_WORD_ORDER_MISMATCH' >> dp-bit.c - echo '#endif' >> dp-bit.c - cat $(srcdir)/config/fp-bit.c >> dp-bit.c - -MULTILIB_OPTIONS = mlittle-endian/mbig-endian mhard-float/msoft-float -MULTILIB_DIRNAMES = le be fpu soft -MULTILIB_MATCHES = -EXTRA_MULTILIB_PARTS = crtbegin.o crtend.o - -LIBGCC = stmp-multilib -INSTALL_LIBGCC = install-multilib - -# Currently there is a bug somwehere in GCC's alias analysis -# or scheduling code that is breaking _fpmul_parts in fp-bit.c. -# Disabling function inlining is a workaround for this problem. -TARGET_LIBGCC2_CFLAGS = -Dinhibit_libc -fno-inline diff --git a/contrib/gcc/config/arm/unknown-elf-oabi.h b/contrib/gcc/config/arm/unknown-elf-oabi.h deleted file mode 100644 index 91f18c0..0000000 --- a/contrib/gcc/config/arm/unknown-elf-oabi.h +++ /dev/null @@ -1,29 +0,0 @@ -/* Definitions for non-Linux based ARM systems using ELF old abi - Copyright (C) 1998, 1999 Free Software Foundation, Inc. - Contributed by Catherine Moore <clm@cygnus.com> - -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 this program; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -/* Run-time Target Specification. */ -#undef TARGET_VERSION -#define TARGET_VERSION fputs (" (ARM/ELF non-Linux old abi)", stderr); - -#undef ASM_SPEC -#define ASM_SPEC "-moabi %{mbig-endian:-EB} %{mcpu=*:-mcpu=%*} %{march=*:-march=%*} \ - %{mapcs-*:-mapcs-%*} %{mthumb-interwork:-mthumb-interwork}" - diff --git a/contrib/gcc/config/arm/vxarm.h b/contrib/gcc/config/arm/vxarm.h deleted file mode 100644 index 473362e..0000000 --- a/contrib/gcc/config/arm/vxarm.h +++ /dev/null @@ -1,71 +0,0 @@ -/* Definitions of target machine for GNU compiler, - for ARM with targetting the VXWorks run time environment. - Copyright (C) 1999, 2000 Free Software Foundation, Inc. - - Contributed by: Mike Stump <mrs@wrs.com> - -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 SUBTARGET_CPU_DEFAULT TARGET_CPU_arm710 - -#undef SUBTARGET_CPP_SPEC -#define SUBTARGET_CPP_SPEC \ -"%{march=arm710:-DCPU=ARM710A} \ - %{march=arm7tdmi:-DCPU=ARM7TDMI} \ - %{march=arm810:-DCPU=ARM810} \ - %{march=strongarm110:-DCPU=ARMSA110} \ - %{!march=*: \ - %{mcpu=arm710:-DCPU=ARM710A} \ - %{mcpu=arm7tdmi:-DCPU=ARM7TDMI} \ - %{mcpu=arm810:-DCPU=ARM810} \ - %{mcpu=strongarm110:-DCPU=ARMSA110}} \ - %{!mcpu*:%{!march=*:-DCPU=ARM710A}} \ -" - -#define TARGET_OS_CPP_BUILTINS() \ - do { \ - builtin_define ("__vxworks"); \ - } while (0) - -/* VxWorks does all the library stuff itself. */ -#undef LIB_SPEC -#define LIB_SPEC "" - -/* VxWorks uses object files, not loadable images. make linker just - combine objects. */ -#undef LINK_SPEC -#define LINK_SPEC "-r" - -/* VxWorks provides the functionality of crt0.o and friends itself. */ -#undef STARTFILE_SPEC -#define STARTFILE_SPEC "" - -#undef ENDFILE_SPEC -#define ENDFILE_SPEC "" - -#undef TARGET_VERSION -#define TARGET_VERSION fputs (" (ARM/VxWorks)", stderr); - -#undef ASM_FILE_START -#define ASM_FILE_START(STREAM) \ - do \ - { \ - fprintf (STREAM, "%s Generated by gcc %s for ARM/VxWorks\n", \ - ASM_COMMENT_START, version_string); \ - } \ - while (0) diff --git a/contrib/gcc/config/freebsd3.h b/contrib/gcc/config/freebsd3.h deleted file mode 100644 index 7b5426f..0000000 --- a/contrib/gcc/config/freebsd3.h +++ /dev/null @@ -1,22 +0,0 @@ -/* FreeBSD version number setting for FreeBSD 3.x systems. - Copyright (C) 2001 Free Software Foundation, Inc. - Contributed by David E. O'Brien <obrien@FreeBSD.org> and BSDi. - -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 FBSD_MAJOR 3 diff --git a/contrib/gcc/config/freebsd4.h b/contrib/gcc/config/freebsd4.h deleted file mode 100644 index ec2ae47..0000000 --- a/contrib/gcc/config/freebsd4.h +++ /dev/null @@ -1,22 +0,0 @@ -/* FreeBSD version number setting for FreeBSD 4.x systems. - Copyright (C) 2001 Free Software Foundation, Inc. - Contributed by David E. O'Brien <obrien@FreeBSD.org> and BSDi. - -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 FBSD_MAJOR 4 diff --git a/contrib/gcc/config/freebsd5.h b/contrib/gcc/config/freebsd5.h deleted file mode 100644 index 3c276d5..0000000 --- a/contrib/gcc/config/freebsd5.h +++ /dev/null @@ -1,22 +0,0 @@ -/* FreeBSD version number setting for FreeBSD 5.x systems. - Copyright (C) 2001 Free Software Foundation, Inc. - Contributed by David E. O'Brien <obrien@FreeBSD.org> and BSDi. - -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 FBSD_MAJOR 5 diff --git a/contrib/gcc/config/freebsd6.h b/contrib/gcc/config/freebsd6.h deleted file mode 100644 index 38bc0cd..0000000 --- a/contrib/gcc/config/freebsd6.h +++ /dev/null @@ -1,22 +0,0 @@ -/* FreeBSD version number setting for FreeBSD 6.x systems. - Copyright (C) 2001 Free Software Foundation, Inc. - Contributed by David E. O'Brien <obrien@FreeBSD.org> and BSDi. - -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 FBSD_MAJOR 6 diff --git a/contrib/gcc/config/i386/vxi386.h b/contrib/gcc/config/i386/vxi386.h deleted file mode 100644 index ee4a740..0000000 --- a/contrib/gcc/config/i386/vxi386.h +++ /dev/null @@ -1,66 +0,0 @@ -/* Definitions of target machine for GNU compiler. VxWorks i386 version. - Copyright (C) 1998, 2002 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. */ - -#undef TARGET_VERSION -#define TARGET_VERSION fprintf (stderr, " (80386, VxWorks BSD syntax)"); - -#define TARGET_OS_CPP_BUILTINS() \ - do \ - { \ - builtin_define ("__vxworks"); \ - builtin_assert ("system=unix"); \ - \ - if (TARGET_386) \ - builtin_define ("CPU=I80386"); \ - else if (TARGET_486) \ - builtin_define ("CPU=I80486"); \ - else if (TARGET_PENTIUM) \ - { \ - builtin_define ("CPU=PENTIUM"); \ - builtin_define ("CPU_VARIANT=PENTIUM"); \ - } \ - else if (TARGET_PENTIUMPRO) \ - { \ - builtin_define ("CPU=PENTIUM"); \ - builtin_define ("CPU_VARIANT=PENTIUMPRO"); \ - } \ - } \ - while (0) - -#define HANDLE_SYSV_PRAGMA 1 - -/* VxWorks does all the library stuff itself. */ - -#undef LIB_SPEC -#define LIB_SPEC "" - -/* VxWorks uses object files, not loadable images. make linker just - combine objects. */ - -#undef LINK_SPEC -#define LINK_SPEC "-r" - -/* VxWorks provides the functionality of crt0.o and friends itself. */ - -#undef STARTFILE_SPEC -#define STARTFILE_SPEC "" - -#undef ENDFILE_SPEC -#define ENDFILE_SPEC "" diff --git a/contrib/gcc/config/i386/win32.h b/contrib/gcc/config/i386/win32.h deleted file mode 100644 index 93f58c9..0000000 --- a/contrib/gcc/config/i386/win32.h +++ /dev/null @@ -1,173 +0,0 @@ -/* Operating system specific defines to be used when targeting GCC for - hosting on Windows NT 3.x, using a Unix style C library and tools, - as distinct from winnt.h, which is used to build GCC for use with a - windows style library and tool set and uses the Microsoft tools. - Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2002 - 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. */ - -/* Enable parsing of #pragma pack(push,<n>) and #pragma pack(pop). */ -#define HANDLE_PRAGMA_PACK_PUSH_POP 1 - -#define DBX_DEBUGGING_INFO 1 -#define SDB_DEBUGGING_INFO 1 -#define PREFERRED_DEBUGGING_TYPE DBX_DEBUG - -#include "i386/unix.h" -#include "i386/bsd.h" -#include "i386/gas.h" -#include "dbxcoff.h" - -/* Augment TARGET_SWITCHES with the cygwin/win32 options. */ -#define MASK_WIN32 0x40000000 /* Use -lming32 interface */ -#define MASK_CYGWIN 0x20000000 /* Use -lcygwin interface */ -#define MASK_WINDOWS 0x10000000 /* Use windows interface */ -#define MASK_DLL 0x08000000 /* Use dll interface */ -#define MASK_NOP_FUN_DLLIMPORT 0x20000 /* Ignore dllimport for functions */ - -#define TARGET_WIN32 (target_flags & MASK_WIN32) -#define TARGET_CYGWIN (target_flags & MASK_CYGWIN) -#define TARGET_WINDOWS (target_flags & MASK_WINDOWS) -#define TARGET_DLL (target_flags & MASK_DLL) -#define TARGET_NOP_FUN_DLLIMPORT (target_flags & MASK_NOP_FUN_DLLIMPORT) - -#undef SUBTARGET_SWITCHES -#define SUBTARGET_SWITCHES \ - { "win32", MASK_WIN32, \ - N_("Use Mingw32 interface") }, \ - { "cygwin", MASK_CYGWIN, \ - N_("Use Cygwin interface") }, \ - { "windows", MASK_WINDOWS, \ - N_("Use bare Windows interface") }, \ - { "dll", MASK_DLL, \ - N_("Generate code for a DLL") }, \ - { "nop-fun-dllimport", MASK_NOP_FUN_DLLIMPORT, \ - N_("Ignore dllimport for functions") }, \ - { "no-nop-fun-dllimport", MASK_NOP_FUN_DLLIMPORT, "" }, - - -#define TARGET_OS_CPP_BUILTINS() \ - do \ - { \ - builtin_define ("_WIN32"); \ - builtin_define_std ("WINNT"); \ - builtin_define ("_X86_"); \ - builtin_define ("__stdcall=__attribute__((__stdcall__))"); \ - builtin_define ("__cdecl=__attribute__((__cdecl__))"); \ - builtin_assert ("system=winnt"); \ - if (TARGET_CYGWIN) \ - { \ - builtin_define ("__CYGWIN32__"); \ - builtin_define ("__CYGWIN__"); \ - } \ - else \ - builtin_define ("__MINGW32__"); \ - } \ - while (0) - -#undef STARTFILE_SPEC - -#define STARTFILE_SPEC "%{mdll:dllcrt0%O%s} %{!mdll: %{!mcygwin:mcrt0%O%s} \ - %{mcygwin:crt0%O%s} %{pg:gcrt0%O%s}}" - -#undef CPP_SPEC -#define CPP_SPEC "%{posix:-D_POSIX_SOURCE} \ - %{!mcygwin:-iwithprefixbefore include/mingw32}" - -/* We have to dynamic link to get to the system DLLs. All of libc, libm and - the Unix stuff is in cygwin.dll. The import library is called - 'libcygwin.a'. For Windows applications, include more libraries, but - always include kernel32. We'd like to specific subsystem windows to - ld, but that doesn't work just yet. */ - -#undef LIB_SPEC -#define LIB_SPEC "%{pg:-lgmon} \ - %{!mcygwin:-lmingw32 -lmoldname -lmsvcrt -lcrtdll} \ - %{mcygwin:-lcygwin} %{mwindows:-luser32 -lgdi32 -lcomdlg32} \ - -lkernel32 -ladvapi32 -lshell32" - -#define LINK_SPEC "%{mwindows:--subsystem windows} \ - %{mdll:--dll -e _DllMainCRTStartup@12}" - -#define SIZE_TYPE "unsigned int" -#define PTRDIFF_TYPE "int" -#define WCHAR_TYPE_SIZE 16 -#define WCHAR_TYPE "short unsigned int" -/* Currently we do not have the atexit() function, - so take that from libgcc2.c */ - -#define NEED_ATEXIT 1 - -#undef TARGET_ENCODE_SECTION_INFO -#define TARGET_ENCODE_SECTION_INFO i386_pe_encode_section_info -#undef TARGET_STRIP_NAME_ENCODING -#define TARGET_STRIP_NAME_ENCODING i386_pe_strip_name_encoding_full - -/* Emit code to check the stack when allocating more that 4000 - bytes in one go. */ - -#define CHECK_STACK_LIMIT 4000 - -/* By default, target has a 80387, uses IEEE compatible arithmetic, - and returns float values in the 387 and needs stack probes */ -#undef TARGET_SUBTARGET_DEFAULT - -#define TARGET_SUBTARGET_DEFAULT \ - (MASK_80387 | MASK_IEEE_FP | MASK_FLOAT_RETURNS | MASK_STACK_PROBE) - -/* This is how to output an assembler line - that says to advance the location counter - to a multiple of 2**LOG bytes. */ - -#undef ASM_OUTPUT_ALIGN -#define ASM_OUTPUT_ALIGN(FILE,LOG) \ - if ((LOG)!=0) fprintf ((FILE), "\t.align %d\n", 1<<(LOG)) - -/* Define this macro if in some cases global symbols from one translation - unit may not be bound to undefined symbols in another translation unit - without user intervention. For instance, under Microsoft Windows - symbols must be explicitly imported from shared libraries (DLLs). */ -#define MULTIPLE_SYMBOL_SPACES - -extern void i386_pe_unique_section PARAMS ((tree, int)); -#define TARGET_ASM_UNIQUE_SECTION i386_pe_unique_section - -#define SUPPORTS_ONE_ONLY 1 - -/* Switch into a generic section. */ -#define TARGET_ASM_NAMED_SECTION i386_pe_asm_named_section - -/* Select attributes for named sections. */ -#define TARGET_SECTION_TYPE_FLAGS i386_pe_section_type_flags - -#undef ASM_COMMENT_START -#define ASM_COMMENT_START " #" - -/* Don't assume anything about the header files. */ -#define NO_IMPLICIT_EXTERN_C - -#define SUBTARGET_PROLOGUE \ - if (current_function_profile \ - && MAIN_NAME_P (DECL_NAME (current_function_decl)) \ - { \ - rtx xops[1]; \ - xops[0] = gen_rtx_MEM (FUNCTION_MODE, \ - gen_rtx (SYMBOL_REF, Pmode, "_monstartup")); \ - emit_call_insn (gen_rtx (CALL, VOIDmode, xops[0], const0_rtx)); \ - } diff --git a/contrib/gcc/config/i386/xm-i386-interix.h b/contrib/gcc/config/i386/xm-i386-interix.h deleted file mode 100644 index bd010e4..0000000 --- a/contrib/gcc/config/i386/xm-i386-interix.h +++ /dev/null @@ -1,32 +0,0 @@ -/* Configuration for GNU compiler - for an Intel i386 or later processor running Interix. - Copyright (C) 1999 Free Software Foundation, Inc. - Contributed by Donn Terry (donn@interix.com) - Derived from code by Douglas B. Rupp (drupp@cs.washington.edu) - -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 HOST_BITS_PER_WIDEST_INT HOST_BITS_PER_LONGLONG -#ifdef __GNUC__ -# define HOST_WIDEST_INT long long -#else -# define HOST_WIDEST_INT __int64 -#endif -#define HOST_WIDEST_INT_PRINT_DEC "%lld" -#define HOST_WIDEST_INT_PRINT_UNSIGNED "%llu" -#define HOST_WIDEST_INT_PRINT_HEX "0x%llx" diff --git a/contrib/gcc/config/i386/xm-vsta.h b/contrib/gcc/config/i386/xm-vsta.h deleted file mode 100644 index 53943ea..0000000 --- a/contrib/gcc/config/i386/xm-vsta.h +++ /dev/null @@ -1,11 +0,0 @@ -/* Use semicolons to separate elements of a path. */ -#define PATH_SEPARATOR ';' - -#define TARGET_OS_CPP_BUILTINS() \ - do \ - { \ - builtin_define_std ("unix"); \ - } \ - while (0) - -#define CPP_SPEC "%{posix:-D_POSIX_SOURCE}" diff --git a/contrib/gcc/config/ia64/aix.h b/contrib/gcc/config/ia64/aix.h deleted file mode 100644 index 5eb2334..0000000 --- a/contrib/gcc/config/ia64/aix.h +++ /dev/null @@ -1,159 +0,0 @@ -/* Definitions of target machine GNU compiler. IA-64/AIX version. - Copyright (C) 1999, 2000, 2001, 2002 Free Software Foundation, Inc. - Contributed by Timothy Wall (twall@cygnus.com) - -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. */ - -/* AIX5 (aka Monterey): a mix of AIX and UnixWare. - This file is loosely based on ia64/linux.h. */ - -/* This macro is a C statement to print on `stderr' a string describing the - particular machine description choice. */ - -#define TARGET_VERSION fprintf (stderr, " (IA-64) AIX"); - -#undef ASM_APP_ON -#define ASM_APP_ON "#APP\n" - -#undef ASM_APP_OFF -#define ASM_APP_OFF "#NO_APP\n" - -#define SET_ASM_OP "\t.set\t" - -#undef MD_EXEC_PREFIX -#undef MD_STARTFILE_PREFIX -#define MD_STARTFILE_PREFIX "/usr/lib/ia64l64/" - -/* Output at beginning of assembler file. */ -/* The .file command should always begin the output. */ -#undef ASM_FILE_START -#define ASM_FILE_START(FILE) \ - do { \ - output_file_directive (FILE, main_input_filename); \ - fprintf (FILE, "\t.version\t\"01.01\"\n"); \ - } while (0) - -/* Provide a STARTFILE_SPEC appropriate for AIX. Here we add - the crti C++ startup files file which provide part of the support - for getting C++ file-scope static object constructed before entering - `main'. */ - -#undef STARTFILE_SPEC -#define STARTFILE_SPEC \ -"%{!shared: \ - %{pg:gcrt1_64.o%s} %{!pg:%{p:mcrt1_64.o%s} \ - %{!p:%{profile:gcrt1_64.o%s} \ - %{!profile:crt1_64.o%s}}}} \ - crti.o%s %{!shared:crtbegin.o%s} %{shared:crtbeginS.o%s}" - -/* Provide a ENDFILE_SPEC appropriate for AIX. Here we tack on - the crtn file which provides termination of the support for getting C++ - file-scope static object constructed before entering `main'. */ - -#undef ENDFILE_SPEC -#define ENDFILE_SPEC "%{!shared:crtend.o%s} %{shared:crtendS.o%s} crtn.o%s" - -/* Define this so we can compile MS code for use with WINE. */ -#define HANDLE_PRAGMA_PACK_PUSH_POP - -/* Target OS builtins. */ -#define TARGET_OS_CPP_BUILTINS() \ -do { \ - if (flag_iso) \ - builtin_define("_ANSI_C_SOURCE"); \ - builtin_define("_AIX"); \ - builtin_define("_AIX64"); \ - builtin_define("unix"); \ - builtin_assert("system=unix"); \ - builtin_assert("system=aix"); \ - builtin_define("__64BIT__"); \ - builtin_define("_LONG_LONG"); \ - builtin_define("_IA64"); \ - builtin_define("__int128=__size128_t"); \ - if (c_language == clk_cplusplus) \ - { \ - builtin_define("_XOPEN_SOURCE=500"); \ - builtin_define("_XOPEN_SOURCE_EXTENDED=1"); \ - builtin_define("_LARGE_FILE_API"); \ - builtin_define("_ALL_SOURCE"); \ - } \ -} while (0) - -/* A C string constant that tells the GNU CC driver program options to pass to - CPP. It can also specify how to translate options you give to GNU CC into - options for GNU CC to pass to the CPP. */ - -#undef CPP_SPEC -#define CPP_SPEC "\ -%{posix:-D_POSIX_SOURCE}" - -/* Define this for shared library support. */ - -#undef LINK_SPEC -#define LINK_SPEC "\ -%{shared:-shared} \ -%{!shared: \ - %{!static: \ - %{rdynamic:-export-dynamic} \ - %{!dynamic-linker:-dynamic-linker /usr/lib/ia64l64/libc.so.1}} \ - %{static:-static}}" - -#define JMP_BUF_SIZE 85 - -/* A C statement or compound statement to output to FILE some assembler code to - call the profiling subroutine `mcount'. - - FIXME this is not supported until xlC supports it and can thus tell us - how to do it. -*/ - -#undef FUNCTION_PROFILER -#define FUNCTION_PROFILER(FILE, LABELNO) \ -do { \ -} while (0) - -/* Tell the linker where to find the crt*.o files. */ - -#ifndef CROSS_COMPILE -#undef STANDARD_STARTFILE_PREFIX -#define STANDARD_STARTFILE_PREFIX "/usr/lib/ia64l64/" -#endif - -/* It is illegal to have relocations in shared segments on AIX. - Pretend flag_pic is always set. */ -#undef TARGET_ASM_SELECT_SECTION -#define TARGET_ASM_SELECT_SECTION ia64_rwreloc_select_section -#undef TARGET_ASM_UNIQUE_SECTION -#define TARGET_ASM_UNIQUE_SECTION ia64_rwreloc_unique_section -#undef TARGET_ASM_SELECT_RTX_SECTION -#define TARGET_ASM_SELECT_RTX_SECTION ia64_rwreloc_select_rtx_section - -/* Override ia64/sysv4.h setting with that used by AIX5. */ -#undef WCHAR_TYPE -#ifdef __64BIT__ -#define WCHAR_TYPE "unsigned int" -#else -#define WCHAR_TYPE "unsigned short" -#endif - -/* Define the `__builtin_va_list' type for AIX. Use char* b/c that's what the - system headers expect. */ -#define BUILD_VA_LIST_TYPE(VALIST) \ - (VALIST) = build_pointer_type(char_type_node) - -/* End of aix.h */ diff --git a/contrib/gcc/config/ia64/hpux_longdouble.h b/contrib/gcc/config/ia64/hpux_longdouble.h deleted file mode 100644 index 5333033..0000000 --- a/contrib/gcc/config/ia64/hpux_longdouble.h +++ /dev/null @@ -1,99 +0,0 @@ -/* Definitions of long double support for GNU compiler. - Copyright (C) 2000, 2001 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. */ - -/* We are using IEEE quad precision, not a double-extended with padding. */ -#undef INTEL_EXTENDED_IEEE_FORMAT -#define INTEL_EXTENDED_IEEE_FORMAT 0 - -/* Define library calls for quad FP operations. These are all part of the - IA32 and IA64 ABIs. */ - -#define ADDTF3_LIBCALL "_U_Qfadd" -#define SUBTF3_LIBCALL "_U_Qfsub" -#define MULTF3_LIBCALL "_U_Qfmpy" -#define DIVTF3_LIBCALL "_U_Qfdiv" -#define NEGTF2_LIBCALL "_U_Qfneg" -#define ABSTF2_LIBCALL "_U_Qfabs" -#define SMINTF3_LIBCALL "_U_Qfmin" -#define SMAXTF3_LIBCALL "_U_Qfmax" -#define EXTENDSFTF2_LIBCALL "_U_Qfcnvff_sgl_to_quad" -#define EXTENDDFTF2_LIBCALL "_U_Qfcnvff_dbl_to_quad" -#define TRUNCTFSF2_LIBCALL "_U_Qfcnvff_quad_to_sgl" -#define TRUNCTFDF2_LIBCALL "_U_Qfcnvff_quad_to_dbl" -#define FLOATSITF2_LIBCALL "_U_Qfcnvxf_sgl_to_quad" -#define FLOATDITF2_LIBCALL "_U_Qfcnvxf_dbl_to_quad" -#define FIX_TRUNCTFSI2_LIBCALL "_U_Qfcnvfxt_quad_to_sgl" -#define FIX_TRUNCTFDI2_LIBCALL "_U_Qfcnvfxt_quad_to_dbl" -#define FIXUNS_TRUNCTFSI2_LIBCALL "_U_Qfcnvfxut_quad_to_sgl" -#define FIXUNS_TRUNCTFDI2_LIBCALL "_U_Qfcnvfxut_quad_to_dbl" -#define EQTF2_LIBCALL "_U_Qfeq" -#define NETF2_LIBCALL "_U_Qfne" -#define GTTF2_LIBCALL "_U_Qfgt" -#define GETF2_LIBCALL "_U_Qfge" -#define LTTF2_LIBCALL "_U_Qflt" -#define LETF2_LIBCALL "_U_Qfle" - - -#undef INIT_TARGET_OPTABS -#define INIT_TARGET_OPTABS \ - do { \ - add_optab->handlers[(int) TFmode].libfunc \ - = gen_rtx_SYMBOL_REF (Pmode, ADDTF3_LIBCALL); \ - sub_optab->handlers[(int) TFmode].libfunc \ - = gen_rtx_SYMBOL_REF (Pmode, SUBTF3_LIBCALL); \ - smul_optab->handlers[(int) TFmode].libfunc \ - = gen_rtx_SYMBOL_REF (Pmode, MULTF3_LIBCALL); \ - sdiv_optab->handlers[(int) TFmode].libfunc \ - = gen_rtx_SYMBOL_REF (Pmode, DIVTF3_LIBCALL); \ - smin_optab->handlers[(int) TFmode].libfunc \ - = gen_rtx_SYMBOL_REF (Pmode, SMINTF3_LIBCALL); \ - smax_optab->handlers[(int) TFmode].libfunc \ - = gen_rtx_SYMBOL_REF (Pmode, SMAXTF3_LIBCALL); \ - abs_optab->handlers[(int) TFmode].libfunc \ - = gen_rtx_SYMBOL_REF (Pmode, ABSTF2_LIBCALL); \ - neg_optab->handlers[(int) TFmode].libfunc \ - = gen_rtx_SYMBOL_REF (Pmode, NEGTF2_LIBCALL); \ - extendsftf2_libfunc = gen_rtx_SYMBOL_REF (Pmode, EXTENDSFTF2_LIBCALL); \ - extenddftf2_libfunc = gen_rtx_SYMBOL_REF (Pmode, EXTENDDFTF2_LIBCALL); \ - trunctfsf2_libfunc = gen_rtx_SYMBOL_REF (Pmode, TRUNCTFSF2_LIBCALL); \ - trunctfdf2_libfunc = gen_rtx_SYMBOL_REF (Pmode, TRUNCTFDF2_LIBCALL); \ - floatsitf_libfunc = gen_rtx_SYMBOL_REF (Pmode, FLOATSITF2_LIBCALL); \ - floatditf_libfunc = gen_rtx_SYMBOL_REF (Pmode, FLOATDITF2_LIBCALL); \ - fixtfsi_libfunc = gen_rtx_SYMBOL_REF (Pmode, FIX_TRUNCTFSI2_LIBCALL);\ - fixtfdi_libfunc = gen_rtx_SYMBOL_REF (Pmode, FIX_TRUNCTFDI2_LIBCALL);\ - fixunstfsi_libfunc = gen_rtx_SYMBOL_REF (Pmode, FIXUNS_TRUNCTFSI2_LIBCALL); \ - fixunstfdi_libfunc = gen_rtx_SYMBOL_REF (Pmode, FIXUNS_TRUNCTFDI2_LIBCALL); \ - eqtf2_libfunc = gen_rtx_SYMBOL_REF (Pmode, EQTF2_LIBCALL); \ - netf2_libfunc = gen_rtx_SYMBOL_REF (Pmode, NETF2_LIBCALL); \ - gttf2_libfunc = gen_rtx_SYMBOL_REF (Pmode, GTTF2_LIBCALL); \ - getf2_libfunc = gen_rtx_SYMBOL_REF (Pmode, GETF2_LIBCALL); \ - lttf2_libfunc = gen_rtx_SYMBOL_REF (Pmode, LTTF2_LIBCALL); \ - letf2_libfunc = gen_rtx_SYMBOL_REF (Pmode, LETF2_LIBCALL); \ - \ - INIT_SUBTARGET_OPTABS; \ - } while (0) - -/* This is meant to be redefined in the host dependent files */ -#define INIT_SUBTARGET_OPTABS - -/* Nonzero if a floating point comparison library call for - mode MODE that will return a boolean value. Zero if one - of the libgcc2 functions is used. */ -#define FLOAT_LIB_COMPARE_RETURNS_BOOL(MODE, COMPARISON) ((MODE) == TFmode) diff --git a/contrib/gcc/config/ia64/t-aix b/contrib/gcc/config/ia64/t-aix deleted file mode 100644 index 7b6df46..0000000 --- a/contrib/gcc/config/ia64/t-aix +++ /dev/null @@ -1,15 +0,0 @@ -# AIX support - -# Compile crtbeginS.o and crtendS.o with pic. -CRTSTUFF_T_CFLAGS_S = -fPIC -# Compile libgcc2.a with pic and defines required by AIX headers -TARGET_LIBGCC2_CFLAGS = -fPIC -D__64BIT__ -D_LONG_LONG -D_IA64 -D__int128=__size128_t -LIB2ADDEH += $(srcdir)/config/ia64/unwind-aix.c - -# Assemble startup files. -crti.o: $(srcdir)/config/ia64/crti.asm $(GCC_PASSES) - $(GCC_FOR_TARGET) -c -o crti.o -x assembler $(srcdir)/config/ia64/crti.asm -crtn.o: $(srcdir)/config/ia64/crtn.asm $(GCC_PASSES) - $(GCC_FOR_TARGET) -c -o crtn.o -x assembler $(srcdir)/config/ia64/crtn.asm - -# end t-aix diff --git a/contrib/gcc/config/ia64/unwind-aix.c b/contrib/gcc/config/ia64/unwind-aix.c deleted file mode 100644 index 7e59406..0000000 --- a/contrib/gcc/config/ia64/unwind-aix.c +++ /dev/null @@ -1,120 +0,0 @@ -/* Implements unwind table entry lookup for AIX (cf. fde-glibc.c). - Copyright (C) 2001, 2002 Free Software Foundation, Inc. - Contributed by Timothy Wall <twall@redhat.com> - - 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 "tconfig.h" -#include "tsystem.h" -#include "unwind.h" -#include "unwind-ia64.h" - -#include <dlfcn.h> -#include <link.h> -#include <sys/mman.h> - -static struct unw_table_entry * -find_fde_for_dso (Elf64_Addr pc, rt_link_map *map, - unsigned long* pseg_base, unsigned long* pgp) -{ - rt_segment *seg; - Elf64_Addr seg_base; - struct unw_table_entry *f_base; - size_t lo, hi; - - /* See if PC falls into one of the loaded segments. */ - for (seg = map->l_segments; seg; seg = (rt_segment *)seg->s_next) - { - if (pc >= seg->s_map_addr && pc < seg->s_map_addr + seg->s_mapsz) - break; - } - if (!seg) - return NULL; - - /* Search for the entry within the unwind table. */ - f_base = (struct unw_table_entry *) (map->l_unwind_table); - seg_base = (Elf64_Addr) seg->s_map_addr; - lo = 0; - hi = map->l_unwind_sz / sizeof (struct unw_table_entry); - - while (lo < hi) - { - size_t mid = (lo + hi) / 2; - struct unw_table_entry *f = f_base + mid; - - if (pc < f->start_offset + seg_base) - hi = mid; - else if (pc >= f->end_offset + seg_base) - lo = mid + 1; - else { - /* AIX executables are *always* dynamic. Look up GP for this - object. */ - Elf64_Dyn *dyn = map->l_ld; - *pgp = 0; - for (; dyn->d_tag != DT_NULL ; dyn++) - { - if (dyn->d_tag == DT_PLTGOT) - { - *pgp = dyn->d_un.d_ptr; - break; - } - } - *pseg_base = seg_base; - return f; - } - } - return NULL; -} - -/* Return a pointer to the unwind table entry for the function containing - PC. */ -struct unw_table_entry * -_Unwind_FindTableEntry (void *pc, unsigned long *pseg_base, unsigned long *pgp) -{ - extern rt_r_debug _r_debug; - struct unw_table_entry *ret; - rt_link_map *map = _r_debug.r_map; /* address of link map */ - - /* Check the main application first, hoping that most of the user's - code is there instead of in some library. */ - ret = find_fde_for_dso ((Elf64_Addr)pc, map, pseg_base, pgp); - if (ret) - { - /* If we're in the main application, use the current GP value. */ - register unsigned long gp __asm__("gp"); - *pgp = gp; - return ret; - } - - /* FIXME need a DSO lock mechanism for AIX here, to ensure shared - libraries aren't changed while we're examining them. */ - - for (map = _r_debug.r_map; map; map = map->l_next) - { - /* Skip the main application's entry. */ - if (!map->l_name) - continue; - ret = find_fde_for_dso ((Elf64_Addr)pc, map, pseg_base, pgp); - if (ret) - break; - } - - /* FIXME need a DSO unlock mechanism for AIX here. */ - - return ret; -} diff --git a/contrib/gcc/config/psos.h b/contrib/gcc/config/psos.h deleted file mode 100644 index 72825d4..0000000 --- a/contrib/gcc/config/psos.h +++ /dev/null @@ -1,88 +0,0 @@ -/* Operating system specific defines to be used when targeting GCC for some - embedded system running pSOS. We assume GNU tools with ELF, but - try to maintain compatibility with the MRI tools. Based on svr4.h. - Copyright (C) 1996, 1999, 2000 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. - - To use this file, make up a file with a name like: - - ?????-psos.h - - where ????? is replaced by the name of the basic hardware that you - are targeting for. Then, in the file ?????-psos.h, put something - like: - - #include "?????.h" - #include "psos.h" - - followed by any really system-specific defines (or overrides of - defines) which you find that you need. -*/ - - -/* Define a symbol indicating that we are using psos.h. */ - -#define USING_PSOS_H - - -/* All pSOS targets currently use the ELF object file format. */ - -#define OBJECT_FORMAT_ELF - - -/* Provide a NULL STARTFILE_SPEC. The startfile cannot be specified - here because it depends on the architecture (e.g. 68K), the - board-support package (e.g. M162) and the run-time configuration - (e.g. application vs. ram-image vs. rom-image). Specify the - startfile in a linker-script created from the generic - architecture-specific linker-scripts. */ - -#undef STARTFILE_SPEC -#define STARTFILE_SPEC "" - - -/* Predefined macros (independent of processor type). */ - -#undef CPP_PREDEFINES -#define CPP_PREDEFINES "-Dpsos" - - -/* Implicit library calls should use ANSI memcpy rather than BSD - bcopy, etc. */ - -#define TARGET_MEM_FUNCTIONS - -/* This is how we tell the assembler that a symbol is weak. */ - -#define ASM_WEAKEN_LABEL(FILE,NAME) \ - do { fputs ("\t.weak\t", FILE); assemble_name (FILE, NAME); \ - fputc ('\n', FILE); } while (0) - -/* Switch into a generic section. */ -#define TARGET_ASM_NAMED_SECTION default_elf_asm_named_section - -/* Use DBX debugging info by default. */ - -#ifndef PREFERRED_DEBUGGING_TYPE -#define PREFERRED_DEBUGGING_TYPE DBX_DEBUG -#endif - -/* For pSOS we use DBX debugging info. */ - -#define DBX_DEBUGGING_INFO 1 diff --git a/contrib/gcc/config/rs6000/aix31.h b/contrib/gcc/config/rs6000/aix31.h deleted file mode 100644 index 7379a34..0000000 --- a/contrib/gcc/config/rs6000/aix31.h +++ /dev/null @@ -1,87 +0,0 @@ -/* Definitions of target machine for GNU compiler, - for IBM RS/6000 running AIX version 3.1. - Copyright (C) 1993,1997, 2000, 2001 Free Software Foundation, Inc. - Contributed by Richard Kenner (kenner@nyu.edu) - -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. */ - - -/* Output something to declare an external symbol to the assembler. Most - assemblers don't need this. - - If we haven't already, add "[RW]" (or "[DS]" for a function) to the - name. Normally we write this out along with the name. In the few cases - where we can't, it gets stripped off. */ - -#undef ASM_OUTPUT_EXTERNAL -#define ASM_OUTPUT_EXTERNAL(FILE, DECL, NAME) \ -{ rtx _symref = XEXP (DECL_RTL (DECL), 0); \ - if ((TREE_CODE (DECL) == VAR_DECL \ - || TREE_CODE (DECL) == FUNCTION_DECL) \ - && (NAME)[strlen (NAME) - 1] != ']') \ - { \ - XSTR (_symref, 0) = concat (XSTR (_symref, 0), \ - (TREE_CODE (DECL) == FUNCTION_DECL \ - ? "[DS]" : "[RW]"), \ - NULL); \ - } \ - fputs ("\t.extern ", FILE); \ - assemble_name (FILE, XSTR (_symref, 0)); \ - if (TREE_CODE (DECL) == FUNCTION_DECL) \ - { \ - fputs ("\n\t.extern .", FILE); \ - RS6000_OUTPUT_BASENAME (FILE, XSTR (_symref, 0)); \ - } \ - putc ('\n', FILE); \ -} - -/* Similar, but for libcall. We only have to worry about the function name, - not that of the descriptor. */ - -#define ASM_OUTPUT_EXTERNAL_LIBCALL(FILE, FUN) \ -{ fputs ("\t.extern .", FILE); \ - assemble_name (FILE, XSTR (FUN, 0)); \ - putc ('\n', FILE); \ -} - -/* AIX 3.2 defined _AIX32, but older versions do not. */ -#undef TARGET_OS_CPP_BUILTINS -#define TARGET_OS_CPP_BUILTINS() \ - do \ - { \ - builtin_define ("_IBMR2"); \ - builtin_define ("_AIX"); \ - builtin_assert ("system=unix"); \ - builtin_assert ("system=aix"); \ - builtin_assert ("cpu=rs6000"); \ - builtin_assert ("machine=rs6000"); \ - } \ - while (0) - -/* AIX 3.1 uses bit 15 in CROR as the magic nop. */ -#undef RS6000_CALL_GLUE -#define RS6000_CALL_GLUE "cror 15,15,15" - -/* AIX 3.1 does not prepend underscores to itrunc, uitrunc, or mcount. */ -#undef RS6000_ITRUNC -#define RS6000_ITRUNC "itrunc" -#undef RS6000_UITRUNC -#define RS6000_UITRUNC "uitrunc" -#undef RS6000_MCOUNT -#define RS6000_MCOUNT ".mcount" - diff --git a/contrib/gcc/config/rs6000/aix3newas.h b/contrib/gcc/config/rs6000/aix3newas.h deleted file mode 100644 index bc6dc9b..0000000 --- a/contrib/gcc/config/rs6000/aix3newas.h +++ /dev/null @@ -1,60 +0,0 @@ -/* Definitions of target machine for GNU compiler, - for IBM RS/6000 POWER running AIX version 3.x with the fixed assembler. - Copyright (C) 1995, 1996, 2000, 2001 Free Software Foundation, Inc. - Contributed by Jason Merrill (jason@cygnus.com). - -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. */ - - -/* Tell the assembler to assume that all undefined names are external. */ - -#undef ASM_SPEC -#define ASM_SPEC "-u %(asm_cpu)" - -#undef ASM_DEFAULT_SPEC -#define ASM_DEFAULT_SPEC "-mpwr" - -/* Define the options for the binder: Start text at 512, align all segments - to 512 bytes, and warn if there is text relocation. - - The -bhalt:4 option supposedly changes the level at which ld will abort, - but it also suppresses warnings about multiply defined symbols and is - used by the AIX cc command. So we use it here. - - -bnodelcsect undoes a poor choice of default relating to multiply-defined - csects. See AIX documentation for more information about this. - - -bM:SRE tells the linker that the output file is Shared REusable. Note - that to actually build a shared library you will also need to specify an - export list with the -Wl,-bE option. - - If -mcpu=common, export the architecture dependent multiply/divide routines - as per README.RS6000. */ - -#undef LINK_SPEC -#ifndef CROSS_COMPILE -#define LINK_SPEC "-T512 -H512 %{!r:-btextro} -bhalt:4 -bnodelcsect\ - %{static:-bnso -bI:/lib/syscalls.exp} \ - %{mcpu=common: milli.exp%s} \ - %{!shared:%{g*:-bexport:/usr/lib/libg.exp}} %{shared:-bM:SRE}" -#else -#define LINK_SPEC "-T512 -H512 %{!r:-btextro} -bhalt:4 -bnodelcsect\ - %{static:-bnso} \ - %{mcpu=common: milli.exp%s} \ - %{shared:-bM:SRE}" -#endif diff --git a/contrib/gcc/config/rs6000/eabiaix.h b/contrib/gcc/config/rs6000/eabiaix.h deleted file mode 100644 index 4e18067..0000000 --- a/contrib/gcc/config/rs6000/eabiaix.h +++ /dev/null @@ -1,36 +0,0 @@ -/* Embedded ELF system support, using old AIX based calling sequence. - Copyright (C) 1995, 1996, 2000 Free Software Foundation, Inc. - Contributed by Cygnus Support. - -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. */ - -/* Default ABI to use */ -#undef RS6000_ABI_NAME -#define RS6000_ABI_NAME "aix" - -/* Define this macro as a C expression for the initializer of an - array of string to tell the driver program which options are - defaults for this target and thus do not need to be handled - specially when using `MULTILIB_OPTIONS'. - - Do not define this macro if `MULTILIB_OPTIONS' is not defined in - the target makefile fragment or if none of the options listed in - `MULTILIB_OPTIONS' are set by default. *Note Target Fragment::. */ - -#undef MULTILIB_DEFAULTS -#define MULTILIB_DEFAULTS { "mbig", "mcall-aix" } diff --git a/contrib/gcc/config/rs6000/mach.h b/contrib/gcc/config/rs6000/mach.h deleted file mode 100644 index a246f91..0000000 --- a/contrib/gcc/config/rs6000/mach.h +++ /dev/null @@ -1,54 +0,0 @@ -/* Definitions of target machine for GNU compiler, - for IBM RS/6000 running MACH. - Copyright (C) 1992, 1999 Free Software Foundation, Inc. - Contributed by Richard Kenner (kenner@nyu.edu) - -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 TARGET_AIX 0 - -/* Print subsidiary information on the compiler version in use. */ -#define TARGET_VERSION fprintf (stderr, " (Mach-RS/6000)"); - -/* We don't define AIX under MACH; instead we define `unix'. */ -#undef TARGET_OS_CPP_BUILTINS -#define TARGET_OS_CPP_BUILTINS() \ - do \ - { \ - builtin_define_std ("rios"); \ - builtin_define ("_IBMR2"); \ - builtin_define_std ("unix"); \ - builtin_assert ("system=unix"); \ - builtin_assert ("system=mach"); \ - builtin_assert ("cpu=rs6000"); \ - builtin_assert ("machine=rs6000"); \ - } \ - while (0) - -/* Define different binder options for MACH. */ -#undef LINK_SPEC -#define LINK_SPEC \ - "-T0x10000000 -D0x20000000 -K %{!nostdlib:%{!r*:%{!e*:-e __start}}} \ - -bnoso -berrmsg -btextro -bhalt:4 -bnodelcsect" - -/* MACH doesn't have atexit. */ -#define NEED_ATEXIT - -/* Don't default to pcc-struct-return, because gcc is the only compiler, and - we want to retain compatibility with older gcc versions. */ -#define DEFAULT_PCC_STRUCT_RETURN 0 diff --git a/contrib/gcc/config/rs6000/t-rs6000-c-rule b/contrib/gcc/config/rs6000/t-rs6000-c-rule deleted file mode 100644 index a768fb5..0000000 --- a/contrib/gcc/config/rs6000/t-rs6000-c-rule +++ /dev/null @@ -1,4 +0,0 @@ -rs6000-c.o: $(srcdir)/config/rs6000/rs6000-c.c \ - $(srcdir)/config/rs6000/rs6000-protos.h \ - $(CONFIG_H) $(SYSTEM_H) $(TREE_H) $(CPPLIB_H) $(TM_P_H) c-pragma.h errors.h - $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION) diff --git a/contrib/gcc/config/rs6000/vxppc.h b/contrib/gcc/config/rs6000/vxppc.h deleted file mode 100644 index 91250a6..0000000 --- a/contrib/gcc/config/rs6000/vxppc.h +++ /dev/null @@ -1,57 +0,0 @@ -/* Definitions of target machine for GNU compiler. Vxworks PowerPC version. - Copyright (C) 1996, 2000 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. */ - -/* This file just exists to give specs for the PowerPC running on VxWorks. */ - -/* Reset defaults */ -#undef CPP_OS_DEFAULT_SPEC -#define CPP_OS_DEFAULT_SPEC "%(cpp_os_vxworks)" - -#undef LIB_DEFAULT_SPEC -#define LIB_DEFAULT_SPEC "%(lib_vxworks)" - -#undef STARTFILE_DEFAULT_SPEC -#define STARTFILE_DEFAULT_SPEC "%(startfile_vxworks)" - -#undef ENDFILE_DEFAULT_SPEC -#define ENDFILE_DEFAULT_SPEC "%(endfile_vxworks)" - -#undef LINK_START_DEFAULT_SPEC -#define LINK_START_DEFAULT_SPEC "%(link_start_vxworks)" - -#undef LINK_OS_DEFAULT_SPEC -#define LINK_OS_DEFAULT_SPEC "%(link_os_vxworks)" - -#undef TARGET_OS_CPP_BUILTINS -#define TARGET_OS_CPP_BUILTINS() \ - do \ - { \ - builtin_define ("__vxworks"); \ - builtin_define ("__vxworks__"); \ - builtin_assert ("system=vxworks"); \ - builtin_assert ("system=embedded"); \ - builtin_assert ("cpu=powerpc"); \ - builtin_assert ("machine=powerpc"); \ - } \ - while (0) - -/* We use stabs-in-elf for debugging */ -#undef PREFERRED_DEBUGGING_TYPE -#define PREFERRED_DEBUGGING_TYPE DBX_DEBUG diff --git a/contrib/gcc/config/sparc/bsd.h b/contrib/gcc/config/sparc/bsd.h deleted file mode 100644 index 41f8308..0000000 --- a/contrib/gcc/config/sparc/bsd.h +++ /dev/null @@ -1,5 +0,0 @@ -#undef LIB_SPEC -#define LIB_SPEC "%{!p:%{!pg:-lc}}%{p:-lc_p}%{pg:-lc_p}" - -#undef STARTFILE_SPEC -#define STARTFILE_SPEC "%{pg:gcrt0.o%s}%{!pg:%{p:gcrt0.o%s}%{!p:crt0.o%s}}" diff --git a/contrib/gcc/config/sparc/hal.h b/contrib/gcc/config/sparc/hal.h deleted file mode 100644 index 0222b81..0000000 --- a/contrib/gcc/config/sparc/hal.h +++ /dev/null @@ -1,33 +0,0 @@ -/* Definitions of target machine for GNU compiler, for HAL - SPARC running Solaris 2 HALOS - Copyright 1998 Free Software Foundation, Inc. - Contributed by Carol LePage (carolo@hal.com) - -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. */ - -/* Need different command line for assembler */ - -#undef ASM_SPEC -#define ASM_SPEC \ - "%{V} %{v:%{!V:-V}} %{Qy:} %{!Qn:-Qy} %{n} %{T} %{Ym,*} %{Wa,*:%*} -e1 \ - %{fpic:-K PIC} %{fPIC:-K PIC}" - -/* Need DWARF for debuggers. */ - -#undef PREFERRED_DEBUGGING_TYPE -#define PREFERRED_DEBUGGING_TYPE DWARF_DEBUG diff --git a/contrib/gcc/config/sparc/linux-aout.h b/contrib/gcc/config/sparc/linux-aout.h deleted file mode 100644 index 70b2c79..0000000 --- a/contrib/gcc/config/sparc/linux-aout.h +++ /dev/null @@ -1,96 +0,0 @@ -/* Definitions for SPARC running Linux-based GNU systems with a.out. - Copyright (C) 1996, 1997, 1999, 2002 Free Software Foundation, Inc. - Contributed by Eddie C. Dost (ecd@skynet.be) - -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. */ - -/* Don't assume anything about the header files. */ -#define NO_IMPLICIT_EXTERN_C - -/* GNU/Linux uses ctype from glibc.a. I am not sure how complete it is. - For now, we play safe. It may change later. */ - -#if 0 -#undef MULTIBYTE_CHARS -#define MULTIBYTE_CHARS 1 -#endif - -/* We need that too. */ -#define HANDLE_SYSV_PRAGMA 1 - -#undef MD_EXEC_PREFIX -#undef MD_STARTFILE_PREFIX - -/* Output at beginning of assembler file. */ -/* The .file command should always begin the output. */ -#undef ASM_FILE_START -#define ASM_FILE_START(FILE) output_file_directive (FILE, main_input_filename) - -#undef STARTFILE_SPEC -#define STARTFILE_SPEC "%{pg:gcrt0.o%s} %{!pg:%{p:gcrt0.o%s} %{!p:crt0.o%s}} %{static:-static}" - -#undef TARGET_VERSION -#define TARGET_VERSION fprintf (stderr, " (sparc GNU/Linux with a.out)"); - -#undef SIZE_TYPE -#define SIZE_TYPE "unsigned int" - -#undef PTRDIFF_TYPE -#define PTRDIFF_TYPE "int" - -#undef WCHAR_TYPE -#define WCHAR_TYPE "int" - -#undef WCHAR_TYPE_SIZE -#define WCHAR_TYPE_SIZE 32 - -#undef CPP_PREDEFINES -#define CPP_PREDEFINES "-Dunix -Dsparc -D__gnu_linux__ -Dlinux -Asystem=unix -Asystem=posix" - -#undef CPP_SUBTARGET_SPEC -#define CPP_SUBTARGET_SPEC \ -"%{fPIC:-D__PIC__ -D__pic__} %{fpic:-D__PIC__ -D__pic__} %{posix:-D_POSIX_SOURCE}" - -/* Don't default to pcc-struct-return, because gcc is the only compiler, - and we want to retain compatibility with older gcc versions. */ -#undef DEFAULT_PCC_STRUCT_RETURN -#define DEFAULT_PCC_STRUCT_RETURN 0 - -#undef LIB_SPEC - -#if 1 -/* We no longer link with libc_p.a or libg.a by default. If you - want to profile or debug the GNU/Linux C library, please add - -lc_p or -ggdb to LDFLAGS at the link time, respectively. */ -#define LIB_SPEC \ -"%{mieee-fp:-lieee} %{p:-lgmon} %{pg:-lgmon} %{!ggdb:-lc} %{ggdb:-lg}" -#else -#define LIB_SPEC \ -"%{mieee-fp:-lieee} %{p:-lgmon -lc_p} %{pg:-lgmon -lc_p} \ - %{!p:%{!pg:%{!g*:-lc} %{g*:-lg -static}}}" -#endif - -#undef LINK_SPEC -#define LINK_SPEC "-m sparclinux" - -/* The sun bundled assembler doesn't accept -Yd, (and neither does gas). - It's safe to pass -s always, even if -g is not used. */ -#undef ASM_SPEC -#define ASM_SPEC \ - "%{V} %{v:%{!V:-V}} %{n} %{T} %{Ym,*} %{Wa,*:%*} -s %{fpic:-K PIC} %{fPIC:-K PIC}" - diff --git a/contrib/gcc/config/sparc/lynx-ng.h b/contrib/gcc/config/sparc/lynx-ng.h deleted file mode 100644 index b1a6ef5..0000000 --- a/contrib/gcc/config/sparc/lynx-ng.h +++ /dev/null @@ -1,38 +0,0 @@ -/* Definitions for SPARC running LynxOS, using Lynx's old as and ld. - Copyright (C) 1993, 1995 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. */ - -/* ??? Must redefine to get sparclite and v8 defines. Can this be done - differently? */ - -#undef CPP_SPEC -#define CPP_SPEC "%{mthreads:-D_MULTITHREADED} \ - %{mposix:-D_POSIX_SOURCE} \ - %{msystem-v:-I/usr/include_v} \ - %(cpp_cpu)" - -/* Names to predefine in the preprocessor for this target machine. */ - -#undef CPP_PREDEFINES -#define CPP_PREDEFINES "-Dunix -Dsparc -DLynx -DIBITS32 -Asystem=unix -Asystem=lynx -Acpu=sparc -Amachine=sparc" - -/* Provide required defaults for linker switches. */ - -#undef LINK_SPEC -#define LINK_SPEC "-e __main -T 0 %{msystem-v:-V} %{mcoff:-k}" diff --git a/contrib/gcc/config/sparc/lynx.h b/contrib/gcc/config/sparc/lynx.h deleted file mode 100644 index 805f65f..0000000 --- a/contrib/gcc/config/sparc/lynx.h +++ /dev/null @@ -1,47 +0,0 @@ -/* Definitions for SPARC running LynxOS. - Copyright (C) 1993, 1995, 1996, 2000 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. */ - -#undef ASM_OUTPUT_IDENT - -#define BSS_SECTION_ASM_OP "\t.section\t\".bss\"" - -/* ??? Must redefine to get sparclite and v8 defines. Can this be done - differently? */ - -#undef CPP_SPEC -#define CPP_SPEC "%{mthreads:-D_MULTITHREADED} \ - %{mposix:-D_POSIX_SOURCE} \ - %{msystem-v:-I/usr/include_v} \ - %(cpp_cpu)" - -/* Names to predefine in the preprocessor for this target machine. */ - -#undef CPP_PREDEFINES -#define CPP_PREDEFINES "-Dunix -Dsparc -DSPARC -DLynx -DLYNX -DIBITS32 -Asystem=unix -Asystem=lynx -Acpu=sparc -Amachine=sparc" - -#undef LINK_SPEC - -/* SPARC version of libc.a has references to libm.a (printf calls pow for - instance), so we must always link both. */ - -#undef LIB_SPEC -#define LIB_SPEC "%{mthreads:-L/lib/thread/} \ - %{msystem-v:-lc_v -lm_v -lc_v} \ - %{!msystem-v:%{mposix:-lc_p} -lc -lm -lc}" diff --git a/contrib/gcc/config/sparc/netbsd.h b/contrib/gcc/config/sparc/netbsd.h deleted file mode 100644 index 284e288..0000000 --- a/contrib/gcc/config/sparc/netbsd.h +++ /dev/null @@ -1,49 +0,0 @@ -#define TARGET_OS_CPP_BUILTINS() \ - do \ - { \ - NETBSD_OS_CPP_BUILTINS_AOUT(); \ - builtin_define_std ("sparc"); \ - builtin_assert ("cpu=sparc"); \ - builtin_assert ("machine=sparc"); \ - } \ - while (0) - -/* Make sure this is undefined. */ -#undef CPP_PREDEFINES - -/* What extra spec entries do we need? */ -#undef SUBTARGET_EXTRA_SPECS -#define SUBTARGET_EXTRA_SPECS \ - { "netbsd_cpp_spec", NETBSD_CPP_SPEC }, - -#undef CPP_SPEC -#define CPP_SPEC "%(cpp_cpu) %(netbsd_cpp_spec)" - -/* Make gcc agree with <machine/ansi.h> */ - -#undef SIZE_TYPE -#define SIZE_TYPE "unsigned int" - -#undef PTRDIFF_TYPE -#define PTRDIFF_TYPE "int" - -/* This is BSD, so it wants DBX format. */ - -#define DBX_DEBUGGING_INFO 1 - -/* This is the char to use for continuation (in case we need to turn - continuation back on). */ - -#define DBX_CONTIN_CHAR '?' - -/* Don't default to pcc-struct-return, because gcc is the only compiler, and - we want to retain compatibility with older gcc versions. */ -#undef DEFAULT_PCC_STRUCT_RETURN -#define DEFAULT_PCC_STRUCT_RETURN 0 - -/* Until they use ELF or something that handles dwarf2 unwinds - and initialization stuff better. */ -#define DWARF2_UNWIND_INFO 0 - -/* Attempt to enable execute permissions on the stack. */ -#define TRANSFER_FROM_TRAMPOLINE NETBSD_ENABLE_EXECUTE_STACK diff --git a/contrib/gcc/config/sparc/sp86x-aout.h b/contrib/gcc/config/sparc/sp86x-aout.h deleted file mode 100644 index 74607d3..0000000 --- a/contrib/gcc/config/sparc/sp86x-aout.h +++ /dev/null @@ -1,51 +0,0 @@ -/* Definitions of target machine for GNU compiler, for sparclite 86x w/o FPU. - Copyright (C) 1998, 1999, 2000 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. */ - - -#undef CPP_PREDEFINES -#define CPP_PREDEFINES "-D__sparc__ -D__sparclite86x__ -Acpu=sparc -Amachine=sparc" - -#undef TARGET_VERSION -#define TARGET_VERSION fprintf (stderr, " (sparclite 86x)"); - -/* Enable app-regs and epilogue options. Do not enable the fpu. */ - -#undef TARGET_DEFAULT -#define TARGET_DEFAULT MASK_APP_REGS - -#undef ASM_SPEC -#define ASM_SPEC "%{v:-v} %{mlittle-endian-data:--little-endian-data} %(asm_cpu)" - -/* US Software GOFAST library support. */ -#undef INIT_SUBTARGET_OPTABS -#define INIT_SUBTARGET_OPTABS INIT_GOFAST_OPTABS - -#undef LINK_SPEC -#define LINK_SPEC "%{v:-V}" - -#undef BYTES_BIG_ENDIAN -#define BYTES_BIG_ENDIAN (! TARGET_LITTLE_ENDIAN_DATA) -#undef WORDS_BIG_ENDIAN -#define WORDS_BIG_ENDIAN (! TARGET_LITTLE_ENDIAN_DATA) - -#define TARGET_LITTLE_ENDIAN_DATA (target_flags & MASK_LITTLE_ENDIAN) -#undef SUBTARGET_SWITCHES -#define SUBTARGET_SWITCHES \ - { "little-endian-data", MASK_LITTLE_ENDIAN, N_("Use little-endian byte order for data")}, diff --git a/contrib/gcc/config/sparc/splet.h b/contrib/gcc/config/sparc/splet.h deleted file mode 100644 index 0d3f054..0000000 --- a/contrib/gcc/config/sparc/splet.h +++ /dev/null @@ -1,46 +0,0 @@ -/* Definitions of target machine for GNU compiler, for SPARClet. - Copyright (C) 1996, 1997, 2000 Free Software Foundation, Inc. - Contributed by Doug Evans (dje@cygnus.com). - -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. */ - -#undef TARGET_DEFAULT -#define TARGET_DEFAULT MASK_APP_REGS - -#define CPP_PREDEFINES "-Dsparc -Acpu=sparc -Amachine=sparc" - -#undef SUBTARGET_SWITCHES -#define SUBTARGET_SWITCHES \ -{"big-endian", -MASK_LITTLE_ENDIAN, N_("Generate code for big endian") }, \ -{"little-endian", MASK_LITTLE_ENDIAN, N_("Generate code for little endian") }, - -#undef ASM_SPEC -#define ASM_SPEC "%{mlittle-endian:-EL} %(asm_cpu)" - -/* Require the user to supply crt0.o. */ -#undef STARTFILE_SPEC -#define STARTFILE_SPEC "" - -#undef LINK_SPEC -#define LINK_SPEC "%{mlittle-endian:-EL}" - -/* sparclet chips are bi-endian. */ -#undef BYTES_BIG_ENDIAN -#define BYTES_BIG_ENDIAN (! TARGET_LITTLE_ENDIAN) -#undef WORDS_BIG_ENDIAN -#define WORDS_BIG_ENDIAN (! TARGET_LITTLE_ENDIAN) diff --git a/contrib/gcc/config/sparc/sun4gas.h b/contrib/gcc/config/sparc/sun4gas.h deleted file mode 100644 index 7f4f7db..0000000 --- a/contrib/gcc/config/sparc/sun4gas.h +++ /dev/null @@ -1,22 +0,0 @@ -/* Definitions of target machine for GNU compiler, for SunOS 4.x with gas - Copyright (C) 1997, 2000 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. */ - -/* defaults.h will define DWARF2_UNWIND_INFO for us. */ -#undef DWARF2_UNWIND_INFO diff --git a/contrib/gcc/config/sparc/sun4o3.h b/contrib/gcc/config/sparc/sun4o3.h deleted file mode 100644 index e79a4c8..0000000 --- a/contrib/gcc/config/sparc/sun4o3.h +++ /dev/null @@ -1,11 +0,0 @@ -#undef CPP_PREDEFINES -#define CPP_PREDEFINES "-Dsparc -Dsun -Dunix -Asystem=unix -Asystem=bsd" - -/* Override the name of the mcount profiling function. */ - -#undef MCOUNT_FUNCTION -#define MCOUNT_FUNCTION "*.mcount" - -/* LINK_SPEC is needed only for SunOS 4. */ - -#undef LINK_SPEC diff --git a/contrib/gcc/config/sparc/sunos4.h b/contrib/gcc/config/sparc/sunos4.h deleted file mode 100644 index 513251c..0000000 --- a/contrib/gcc/config/sparc/sunos4.h +++ /dev/null @@ -1,48 +0,0 @@ -/* Definitions of target machine for GNU compiler, for SunOS 4.x - Copyright (C) 1994, 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. */ - -#undef SUNOS4_SHARED_LIBRARIES -#define SUNOS4_SHARED_LIBRARIES 1 - -#undef CPP_PREDEFINES -#define CPP_PREDEFINES "-Dsparc -Dsun -Dunix -Asystem=unix -Asystem=bsd" - -#define LIB_SPEC "%{!shared:%{!p:%{!pg:-lc}}%{p:-lc_p}%{pg:-lc_p} %{g:-lg}}" - -/* Provide required defaults for linker -e and -d switches. */ - -#define LINK_SPEC \ - "%{!shared:%{!nostdlib:%{!r*:%{!e*:-e start}}} -dc -dp} %{static:-Bstatic} \ - %{assert*} %{shared:%{!mimpure-text:-assert pure-text}}" - -/* Use N_BINCL stabs. */ - -#define DBX_USE_BINCL - -/* The Sun as doesn't like unaligned data. */ -#define DWARF2_UNWIND_INFO 0 - -/* SunOS has on_exit instead of atexit. */ -/* The man page says it returns int. */ -#ifdef IN_LIBGCC2 -extern int on_exit PARAMS ((void *, void *)); -#endif -#define ON_EXIT(FUNC) on_exit ((FUNC), 0) -#define NEED_ATEXIT diff --git a/contrib/gcc/config/sparc/t-chorus-elf b/contrib/gcc/config/sparc/t-chorus-elf deleted file mode 100644 index 5fc405b..0000000 --- a/contrib/gcc/config/sparc/t-chorus-elf +++ /dev/null @@ -1,29 +0,0 @@ -LIB1ASMSRC = sparc/lb1spc.asm -LIB1ASMFUNCS = _mulsi3 _divsi3 _modsi3 - -# We want fine grained libraries, so use the new code to build the -# floating point emulation libraries. -FPBIT = fp-bit.c -DPBIT = dp-bit.c - -dp-bit.c: $(srcdir)/config/fp-bit.c - cat $(srcdir)/config/fp-bit.c > dp-bit.c - -fp-bit.c: $(srcdir)/config/fp-bit.c - echo '#define FLOAT' > fp-bit.c - cat $(srcdir)/config/fp-bit.c >> fp-bit.c - -# MULTILIB_OPTIONS should have msparclite too, but we'd have to make -# gas build... -MULTILIB_OPTIONS = -MULTILIB_DIRNAMES = -MULTILIB_MATCHES = - -LIBGCC = stmp-multilib -INSTALL_LIBGCC = install-multilib - -# Assemble startup files. -crti.o: $(srcdir)/config/sparc/sol2-ci.asm $(GCC_PASSES) - $(GCC_FOR_TARGET) -c -o crti.o -x assembler $(srcdir)/config/sparc/sol2-ci.asm -crtn.o: $(srcdir)/config/sparc/sol2-cn.asm $(GCC_PASSES) - $(GCC_FOR_TARGET) -c -o crtn.o -x assembler $(srcdir)/config/sparc/sol2-cn.asm diff --git a/contrib/gcc/config/sparc/t-halos b/contrib/gcc/config/sparc/t-halos deleted file mode 100644 index 0bd5496..0000000 --- a/contrib/gcc/config/sparc/t-halos +++ /dev/null @@ -1,2 +0,0 @@ -# For a native HALOS compile, we need to set -e1 for the assembler -AS=as -e1 diff --git a/contrib/gcc/config/sparc/t-sparcbare b/contrib/gcc/config/sparc/t-sparcbare deleted file mode 100644 index bac38de..0000000 --- a/contrib/gcc/config/sparc/t-sparcbare +++ /dev/null @@ -1,25 +0,0 @@ -# configuration file for a bare sparc cpu - -LIB1ASMSRC = sparc/lb1spc.asm -LIB1ASMFUNCS = _mulsi3 _divsi3 _modsi3 - -# We want fine grained libraries, so use the new code to build the -# floating point emulation libraries. -FPBIT = fp-bit.c -DPBIT = dp-bit.c - -dp-bit.c: $(srcdir)/config/fp-bit.c - cat $(srcdir)/config/fp-bit.c > dp-bit.c - -fp-bit.c: $(srcdir)/config/fp-bit.c - echo '#define FLOAT' > fp-bit.c - cat $(srcdir)/config/fp-bit.c >> fp-bit.c - -# MULTILIB_OPTIONS should have msparclite too, but we'd have to make -# gas build... -MULTILIB_OPTIONS = msoft-float mcpu=v8 -MULTILIB_DIRNAMES = soft v8 -MULTILIB_MATCHES = msoft-float=mno-fpu mcpu?v8=mv8 - -LIBGCC = stmp-multilib -INSTALL_LIBGCC = install-multilib diff --git a/contrib/gcc/config/sparc/t-splet b/contrib/gcc/config/sparc/t-splet deleted file mode 100644 index 3334200..0000000 --- a/contrib/gcc/config/sparc/t-splet +++ /dev/null @@ -1,21 +0,0 @@ -# configuration file for a bare sparclet cpu, aout format files - -LIB1ASMSRC = sparc/lb1spc.asm -LIB1ASMFUNCS = _mulsi3 _divsi3 _modsi3 - -# We want fine grained libraries, so use the new code to build the -# floating point emulation libraries. -FPBIT = fp-bit.c -DPBIT = dp-bit.c - -dp-bit.c: $(srcdir)/config/fp-bit.c - cat $(srcdir)/config/fp-bit.c > dp-bit.c - -fp-bit.c: $(srcdir)/config/fp-bit.c - echo '#define FLOAT' > fp-bit.c - cat $(srcdir)/config/fp-bit.c >> fp-bit.c - -MULTILIB_OPTIONS = mlittle-endian mflat -MULTILIB_DIRNAMES = little flat -LIBGCC = stmp-multilib -INSTALL_LIBGCC = install-multilib diff --git a/contrib/gcc/config/sparc/t-sunos41 b/contrib/gcc/config/sparc/t-sunos41 deleted file mode 100644 index 1056d93..0000000 --- a/contrib/gcc/config/sparc/t-sunos41 +++ /dev/null @@ -1,12 +0,0 @@ -# SunOS 4.1.* - -MULTILIB_OPTIONS = fpic/fPIC mcpu=v8 -MULTILIB_DIRNAMES = pic ucpic v8 -MULTILIB_MATCHES = mcpu?v8=mv8 - -LIBGCC = stmp-multilib -INSTALL_LIBGCC = install-multilib - -# The native linker doesn't handle linking -fpic code with -fPIC code. Ugh. -# We cope by building both variants of libgcc. -#TARGET_LIBGCC2_CFLAGS = -fPIC diff --git a/contrib/gcc/config/sparc/t-vxsparc b/contrib/gcc/config/sparc/t-vxsparc deleted file mode 100644 index 5a47341..0000000 --- a/contrib/gcc/config/sparc/t-vxsparc +++ /dev/null @@ -1,10 +0,0 @@ -# We don't want to put exit in libgcc.a for VxWorks, because VxWorks -# does not have _exit. -TARGET_LIBGCC2_CFLAGS = -Dexit=unused_exit - -MULTILIB_OPTIONS=msoft-float mv8 -MULTILIB_DIRNAMES=soft v8 -MULTILIB_MATCHES=msoft-float=mno-fpu - -LIBGCC = stmp-multilib -INSTALL_LIBGCC = install-multilib diff --git a/contrib/gcc/config/sparc/t-vxsparc64 b/contrib/gcc/config/sparc/t-vxsparc64 deleted file mode 100644 index ee779ee..0000000 --- a/contrib/gcc/config/sparc/t-vxsparc64 +++ /dev/null @@ -1,23 +0,0 @@ -# We don't want to put exit in libgcc.a for VxWorks, because VxWorks -# does not have _exit. -TARGET_LIBGCC2_CFLAGS = -Dexit=unused_exit - -LIB2FUNCS_EXTRA = fp-bit.c dp-bit.c - -dp-bit.c: $(srcdir)/config/fp-bit.c - echo '#define US_SOFTWARE_GOFAST' > dp-bit.c - cat $(srcdir)/config/fp-bit.c >> dp-bit.c - -fp-bit.c: $(srcdir)/config/fp-bit.c - echo '#define FLOAT' > fp-bit.c - echo '#define US_SOFTWARE_GOFAST' >> fp-bit.c - cat $(srcdir)/config/fp-bit.c >> fp-bit.c - -MULTILIB_OPTIONS=O0 -MULTILIB_DIRNAMES=O0 -MULTILIB_MATCHES= -MULTILIB_EXCEPTIONS= -MULTILIB_EXTRA_OPTS=m64 mcpu=ultrasparc - -LIBGCC = stmp-multilib -INSTALL_LIBGCC = install-multilib diff --git a/contrib/gcc/config/sparc/vxsim.h b/contrib/gcc/config/sparc/vxsim.h deleted file mode 100644 index c9c3569..0000000 --- a/contrib/gcc/config/sparc/vxsim.h +++ /dev/null @@ -1,136 +0,0 @@ -/* Definitions of target machine for GNU compiler, for SPARC VxSim - Copyright 1996 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. */ - -#undef TARGET_VERSION -#define TARGET_VERSION fprintf (stderr, " (sparc VxSim)"); - -/* Supposedly the same as vanilla sparc svr4, except for the stuff below: */ - -#undef CPP_PREDEFINES -#define CPP_PREDEFINES \ - "-DCPU=SIMSPARCSOLARIS -D__vxworks -D__vxworks__ -Dsparc -D__svr4__ -D__SVR4 \ - -Asystem=embedded -Asystem=svr4 -Acpu=sparc -Amachine=sparc\ - -D__GCC_NEW_VARARGS__" - -#undef CPP_SPEC -#define CPP_SPEC "" - -#undef CC1_SPEC -#define CC1_SPEC "-fno-builtin %{sun4:} %{target:}" - -/* The sun bundled assembler doesn't accept -Yd, (and neither does gas). - It's safe to pass -s always, even if -g is not used. */ -#undef ASM_SPEC -#define ASM_SPEC \ - "%{V} %{v:%{!V:-V}} %{Qy:} %{!Qn:-Qy} %{n} %{T} %{Ym,*} %{Wa,*:%*} -s \ - %{fpic:-K PIC} %{fPIC:-K PIC}" - -/* However it appears that Solaris 2.0 uses the same reg numbering as - the old BSD-style system did. */ - -#undef DBX_REGISTER_NUMBER -/* Same as sparc.h */ -#define DBX_REGISTER_NUMBER(REGNO) (REGNO) - -/* We use stabs-in-elf for debugging, because that is what the native - toolchain uses. */ -#undef PREFERRED_DEBUGGING_TYPE -#define PREFERRED_DEBUGGING_TYPE DBX_DEBUG - -/* The Solaris 2 assembler uses .skip, not .zero, so put this back. */ -#undef ASM_OUTPUT_SKIP -#define ASM_OUTPUT_SKIP(FILE,SIZE) \ - fprintf (FILE, "\t.skip %u\n", (SIZE)) - -#undef ASM_OUTPUT_ALIGNED_LOCAL -#define ASM_OUTPUT_ALIGNED_LOCAL(FILE, NAME, SIZE, ALIGN) \ -do { \ - fputs ("\t.local\t", (FILE)); \ - assemble_name ((FILE), (NAME)); \ - putc ('\n', (FILE)); \ - ASM_OUTPUT_ALIGNED_COMMON (FILE, NAME, SIZE, ALIGN); \ -} while (0) - -#undef COMMON_ASM_OP -#define COMMON_ASM_OP "\t.common\t" - -#undef LOCAL_LABEL_PREFIX -#define LOCAL_LABEL_PREFIX "." - -/* This is how to output a definition of an internal numbered label where - PREFIX is the class of label and NUM is the number within the class. */ - -#undef ASM_OUTPUT_INTERNAL_LABEL -#define ASM_OUTPUT_INTERNAL_LABEL(FILE,PREFIX,NUM) \ - fprintf (FILE, ".L%s%d:\n", PREFIX, NUM) - -/* This is how to output a reference to an internal numbered label where - PREFIX is the class of label and NUM is the number within the class. */ - -#undef ASM_OUTPUT_INTERNAL_LABELREF -#define ASM_OUTPUT_INTERNAL_LABELREF(FILE,PREFIX,NUM) \ - fprintf (FILE, ".L%s%d", PREFIX, NUM) - -/* This is how to store into the string LABEL - the symbol_ref name of an internal numbered label where - PREFIX is the class of label and NUM is the number within the class. - This is suitable for output with `assemble_name'. */ - -#undef ASM_GENERATE_INTERNAL_LABEL -#define ASM_GENERATE_INTERNAL_LABEL(LABEL,PREFIX,NUM) \ - sprintf (LABEL, "*.L%s%ld", PREFIX, (long)(NUM)) - - - -#undef LIB_SPEC -#define LIB_SPEC "" - -#undef STARTFILE_SPEC -#define STARTFILE_SPEC "" - -#undef ENDFILE_SPEC -#define ENDFILE_SPEC "" - -#undef LINK_SPEC -#define LINK_SPEC "-r" - -/* This defines which switch letters take arguments. - It is as in svr4.h but with -R added. */ - -#undef SWITCH_TAKES_ARG -#define SWITCH_TAKES_ARG(CHAR) \ - ( (CHAR) == 'D' \ - || (CHAR) == 'U' \ - || (CHAR) == 'o' \ - || (CHAR) == 'e' \ - || (CHAR) == 'u' \ - || (CHAR) == 'I' \ - || (CHAR) == 'm' \ - || (CHAR) == 'L' \ - || (CHAR) == 'R' \ - || (CHAR) == 'A' \ - || (CHAR) == 'h' \ - || (CHAR) == 'z') - -/* ??? This does not work in SunOS 4.x, so it is not enabled in sparc.h. - Instead, it is enabled here, because it does work under Solaris. */ -/* Define for support of TFmode long double. - SPARC ABI says that long double is 4 words. */ -#define LONG_DOUBLE_TYPE_SIZE 64 diff --git a/contrib/gcc/config/sparc/vxsparc.h b/contrib/gcc/config/sparc/vxsparc.h deleted file mode 100644 index da3e591..0000000 --- a/contrib/gcc/config/sparc/vxsparc.h +++ /dev/null @@ -1,59 +0,0 @@ -/* Definitions of target machine for GNU compiler. Vxworks SPARC version. - Copyright (C) 1994, 1996 Free Software Foundation, Inc. - Contributed by David Henkel-Wallace (gumby@cygnus.com) - -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. */ - - -/* Specify what to link with. */ -/* VxWorks does all the library stuff itself. */ - -#undef LIB_SPEC -#define LIB_SPEC "" - -/* Provide required defaults for linker -e. */ -#undef LINK_SPEC -#define LINK_SPEC "%{!nostdlib:%{!r*:%{!e*:-e start}}}" - -/* VxWorks provides the functionality of crt0.o and friends itself. */ -#undef STARTFILE_SPEC -#define STARTFILE_SPEC "" - -#undef CPP_PREDEFINES -#define CPP_PREDEFINES "-Dsparc -Acpu=sparc -Amachine=sparc" - -/* Note that we define CPU here even if the user has specified -ansi. - This violates user namespace, but the VxWorks headers, and potentially - user code, all explicitly rely upon the definition of CPU in order to get - the proper processor information. */ -#undef CPP_SPEC -#define CPP_SPEC "%(cpp_cpu) -DCPU=SPARC" - -#undef PTRDIFF_TYPE -#undef SIZE_TYPE -#undef WCHAR_TYPE -#undef WCHAR_TYPE_SIZE - -#define PTRDIFF_TYPE "long int" -#define SIZE_TYPE "unsigned int" -#define WCHAR_TYPE "char" -#define WCHAR_TYPE_SIZE 8 - -/* US Software GOFAST library support. */ -#undef INIT_SUBTARGET_OPTABS -#define INIT_SUBTARGET_OPTABS INIT_GOFAST_OPTABS diff --git a/contrib/gcc/config/sparc/vxsparc64.h b/contrib/gcc/config/sparc/vxsparc64.h deleted file mode 100644 index 1da8b7f..0000000 --- a/contrib/gcc/config/sparc/vxsparc64.h +++ /dev/null @@ -1,92 +0,0 @@ -/* Definitions of target machine for GNU compiler. - 64-bit VxWorks SPARC version. - Copyright (C) 2001 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. */ - - -/* Specify what to link with. */ -/* VxWorks does all the library stuff itself. */ -#undef LIB_SPEC -#define LIB_SPEC "-r" - -/* VxWorks provides the functionality of crt0.o and friends itself. */ -#undef STARTFILE_SPEC -#undef ENDFILE_SPEC -#define STARTFILE_SPEC "" -#define ENDFILE_SPEC "" - -#undef LINK_SPEC -#define LINK_SPEC "" - -/* We need to prohibit dots in constructor labels so that we can build a - table of { string, address } entries for each non-static name in a - program. The address, being of the form &name, it cannot contain a dot or - C will try to parse it as a &struct.field phrase. */ -#undef NO_DOLLAR_IN_LABEL -#undef DOLLARS_IN_IDENTIFIERS -#define DOLLARS_IN_IDENTIFIERS 1 -#define NO_DOT_IN_LABEL - -/* Enable #pragma pack(n) */ -#define HANDLE_SYSV_PRAGMA 1 - -/* We use stabs for debugging */ -#undef PREFERRED_DEBUGGING_TYPE -#define PREFERRED_DEBUGGING_TYPE DBX_DEBUG - -/* Longs are still only 32bits for vxWorks, even for UltraSPARC */ -#undef LONG_TYPE_SIZE -#define LONG_TYPE_SIZE 32 - -#undef CPP_ARCH32_SPEC -#define CPP_ARCH32_SPEC "-Acpu(sparc) -Amachine(sparc)" -#undef CPP_ARCH64_SPEC -#define CPP_ARCH64_SPEC \ -"-Dsparc64 -D__arch64__ -Acpu(sparc64) -Amachine(sparc64)" - -#undef CPP_PREDEFINES -#define CPP_PREDEFINES "-D__vxworks -D__sparc__ -Dsparc -D__GCC_NEW_VARARGS__" - -/* Note that we define CPU here even if the user has specified -ansi. - This violates user namespace, but the VxWorks headers, and potentially - user code, all explicitly rely upon the definition of CPU in order to get - the proper processor information. */ -#undef CPP_SPEC -#define CPP_SPEC "%(cpp_cpu) %(cpp_arch) -DCPU=ULTRASPARC -D__CPU__=CPU" - -#undef TARGET_DEFAULT -#define TARGET_DEFAULT (MASK_APP_REGS | MASK_FPU \ - | MASK_LONG_DOUBLE_128 | MASK_64BIT) - -#undef SPARC_DEFAULT_CMODEL -#define SPARC_DEFAULT_CMODEL CM_MEDLOW - -#undef PTRDIFF_TYPE -#undef SIZE_TYPE -#undef WCHAR_TYPE -#undef WCHAR_TYPE_SIZE - -#define PTRDIFF_TYPE "long int" -#define SIZE_TYPE "unsigned int" -#define WCHAR_TYPE "char" -#define WCHAR_TYPE_SIZE 8 - -/* US Software GOFAST library support. */ -#undef INIT_SUBTARGET_OPTABS -#define INIT_SUBTARGET_OPTABS INIT_GOFAST_OPTABS diff --git a/contrib/gcc/config/t-interix b/contrib/gcc/config/t-interix deleted file mode 100644 index d284b3e..0000000 --- a/contrib/gcc/config/t-interix +++ /dev/null @@ -1,2 +0,0 @@ -# Don't run fixproto -STMP_FIXPROTO = diff --git a/contrib/gcc/config/t-linux-aout b/contrib/gcc/config/t-linux-aout deleted file mode 100644 index d284b3e..0000000 --- a/contrib/gcc/config/t-linux-aout +++ /dev/null @@ -1,2 +0,0 @@ -# Don't run fixproto -STMP_FIXPROTO = diff --git a/contrib/gcc/configure.frag b/contrib/gcc/configure.frag deleted file mode 100644 index 2fdbca8..0000000 --- a/contrib/gcc/configure.frag +++ /dev/null @@ -1,77 +0,0 @@ -# configure.frag for GCC -# Process the host/target/language Makefile fragments. - -# Copyright (C) 1997 Free Software Foundation, Inc. - -#This file is part of GCC. - -#GCC is free software; you can redistribute it and/or modify it under -#the terms of the GNU General Public License as published by the Free -#Software Foundation; either version 2, or (at your option) any later -#version. - -#GCC is distributed in the hope that it will be useful, but WITHOUT -#ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -#FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -#for more details. - -#You should have received a copy of the GNU General Public License -#along with GCC; see the file COPYING. If not, write to the Free -#Software Foundation, 59 Temple Place - Suite 330, Boston, MA -#02111-1307, USA. - -# First parameter is the source directory, second is list of subdirectories, -# third is list of host makefile fragments, fourth is list of target makefile -# fragments. - -srcdir=$1 -subdirs=$2 -xmake_files=$3 -tmake_files=$4 - -# Copy all the host makefile fragments into Make-host. - -rm -f Make-host -touch Make-host -for f in .. $xmake_files -do - if [ -f $f ] - then - cat $f >> Make-host - fi -done - -# Copy all the target makefile fragments into Make-target. - -rm -f Make-target -touch Make-target -for f in .. $tmake_files -do - if [ -f $f ] - then - cat $f >> Make-target - fi -done - -# Ensure the language build subdirectories exist. - -for subdir in . $subdirs -do - if [ $subdir != . ] - then - test -d $subdir || mkdir $subdir - fi -done - -# Now copy each language's Make-lang.in file to Make-lang. - -rm -f Make-lang -touch Make-lang - -for subdir in . $subdirs -do - if [ $subdir != . ] - then - cat $srcdir/$subdir/Make-lang.in >> Make-lang - fi -done diff --git a/contrib/gcc/configure.in b/contrib/gcc/configure.in deleted file mode 100644 index 0f64d07..0000000 --- a/contrib/gcc/configure.in +++ /dev/null @@ -1,2969 +0,0 @@ -# configure.in for GCC -# Process this file with autoconf to generate a configuration script. - -# Copyright 1997, 1998, 1999, 2000, 2001, 2002, 2003 -# Free Software Foundation, Inc. - -#This file is part of GCC. - -#GCC is free software; you can redistribute it and/or modify it under -#the terms of the GNU General Public License as published by the Free -#Software Foundation; either version 2, or (at your option) any later -#version. - -#GCC is distributed in the hope that it will be useful, but WITHOUT -#ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -#FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -#for more details. - -#You should have received a copy of the GNU General Public License -#along with GCC; see the file COPYING. If not, write to the Free -#Software Foundation, 59 Temple Place - Suite 330, Boston, MA -#02111-1307, USA. - -# Initialization and defaults -AC_PREREQ(2.13) -AC_INIT(tree.c) -AC_CONFIG_HEADER(auto-host.h:config.in) - -remove=rm -hard_link=ln -symbolic_link='ln -s' -copy=cp - -# Check for bogus environment variables. -# Test if LIBRARY_PATH contains the notation for the current directory -# since this would lead to problems installing/building glibc. -# LIBRARY_PATH contains the current directory if one of the following -# is true: -# - one of the terminals (":" and ";") is the first or last sign -# - two terminals occur directly after each other -# - the path contains an element with a dot in it -AC_MSG_CHECKING(LIBRARY_PATH variable) -changequote(,)dnl -case ${LIBRARY_PATH} in - [:\;]* | *[:\;] | *[:\;][:\;]* | *[:\;]. | .[:\;]*| . | *[:\;].[:\;]* ) - library_path_setting="contains current directory" - ;; - *) - library_path_setting="ok" - ;; -esac -changequote([,])dnl -AC_MSG_RESULT($library_path_setting) -if test "$library_path_setting" != "ok"; then -AC_MSG_ERROR([ -*** LIBRARY_PATH shouldn't contain the current directory when -*** building gcc. Please change the environment variable -*** and run configure again.]) -fi - -# Test if GCC_EXEC_PREFIX contains the notation for the current directory -# since this would lead to problems installing/building glibc. -# GCC_EXEC_PREFIX contains the current directory if one of the following -# is true: -# - one of the terminals (":" and ";") is the first or last sign -# - two terminals occur directly after each other -# - the path contains an element with a dot in it -AC_MSG_CHECKING(GCC_EXEC_PREFIX variable) -changequote(,)dnl -case ${GCC_EXEC_PREFIX} in - [:\;]* | *[:\;] | *[:\;][:\;]* | *[:\;]. | .[:\;]*| . | *[:\;].[:\;]* ) - gcc_exec_prefix_setting="contains current directory" - ;; - *) - gcc_exec_prefix_setting="ok" - ;; -esac -changequote([,])dnl -AC_MSG_RESULT($gcc_exec_prefix_setting) -if test "$gcc_exec_prefix_setting" != "ok"; then -AC_MSG_ERROR([ -*** GCC_EXEC_PREFIX shouldn't contain the current directory when -*** building gcc. Please change the environment variable -*** and run configure again.]) -fi - -# Check for additional parameters - -# With GNU ld -AC_ARG_WITH(gnu-ld, -[ --with-gnu-ld arrange to work with GNU ld.], -gnu_ld_flag="$with_gnu_ld", -gnu_ld_flag=no) - -# With pre-defined ld -AC_ARG_WITH(ld, -[ --with-ld arrange to use the specified ld (full pathname)], -DEFAULT_LINKER="$with_ld") -if test x"${DEFAULT_LINKER+set}" = x"set"; then - if test ! -x "$DEFAULT_LINKER"; then - AC_MSG_WARN([cannot execute: $DEFAULT_LINKER: check --with-ld or env. var. DEFAULT_LINKER]) - elif $DEFAULT_LINKER -v < /dev/null 2>&1 | grep GNU > /dev/null; then - gnu_ld_flag=yes - fi - AC_DEFINE_UNQUOTED(DEFAULT_LINKER,"$DEFAULT_LINKER", - [Define to enable the use of a default linker.]) -fi - -# With GNU as -AC_ARG_WITH(gnu-as, -[ --with-gnu-as arrange to work with GNU as], -gas_flag="$with_gnu_as", -gas_flag=no) - -AC_ARG_WITH(as, -[ --with-as arrange to use the specified as (full pathname)], -DEFAULT_ASSEMBLER="$with_as") -if test x"${DEFAULT_ASSEMBLER+set}" = x"set"; then - if test ! -x "$DEFAULT_ASSEMBLER"; then - AC_MSG_WARN([cannot execute: $DEFAULT_ASSEMBLER: check --with-as or env. var. DEFAULT_ASSEMBLER]) - elif $DEFAULT_ASSEMBLER -v < /dev/null 2>&1 | grep GNU > /dev/null; then - gas_flag=yes - fi - AC_DEFINE_UNQUOTED(DEFAULT_ASSEMBLER,"$DEFAULT_ASSEMBLER", - [Define to enable the use of a default assembler.]) -fi - -# With stabs -AC_ARG_WITH(stabs, -[ --with-stabs arrange to use stabs instead of host debug format], -stabs="$with_stabs", -stabs=no) - -# With ELF -AC_ARG_WITH(elf, -[ --with-elf arrange to use ELF instead of host debug format], -elf="$with_elf", -elf=no) - -# Specify the local prefix -local_prefix= -AC_ARG_WITH(local-prefix, -[ --with-local-prefix=DIR specifies directory to put local include], -[case "${withval}" in -yes) AC_MSG_ERROR(bad value ${withval} given for local include directory prefix) ;; -no) ;; -*) local_prefix=$with_local_prefix ;; -esac]) - -# Default local prefix if it is empty -if test x$local_prefix = x; then - local_prefix=/usr/local -fi - -# Don't set gcc_gxx_include_dir to gxx_include_dir since that's only -# passed in by the toplevel make and thus we'd get different behavior -# depending on where we built the sources. -gcc_gxx_include_dir= -# Specify the g++ header file directory -AC_ARG_WITH(gxx-include-dir, -[ --with-gxx-include-dir=DIR - specifies directory to put g++ header files], -[case "${withval}" in -yes) AC_MSG_ERROR(bad value ${withval} given for g++ include directory) ;; -no) ;; -*) gcc_gxx_include_dir=$with_gxx_include_dir ;; -esac]) - -if test x${gcc_gxx_include_dir} = x; then - if test x${enable_version_specific_runtime_libs} = xyes; then - gcc_gxx_include_dir='${libsubdir}/include/c++' - else - topsrcdir=${srcdir}/.. . ${srcdir}/../config.if -changequote(<<, >>)dnl - gcc_gxx_include_dir="\$(libsubdir)/\$(unlibsubdir)/..\`echo \$(exec_prefix) | sed -e 's|^\$(prefix)||' -e 's|/[^/]*|/..|g'\`/include/"${libstdcxx_incdir} -changequote([, ])dnl - fi -fi - -# Determine the host, build, and target systems -AC_CANONICAL_SYSTEM - -# Set program_transform_name -AC_ARG_PROGRAM - -# Find the native compiler -AC_PROG_CC -AC_PROG_CC_C_O -# autoconf is lame and doesn't give us any substitution variable for this. -if eval "test \"`echo '$ac_cv_prog_cc_'${ac_cc}_c_o`\" = no"; then - NO_MINUS_C_MINUS_O=yes -else - OUTPUT_OPTION='-o $@' -fi -AC_SUBST(NO_MINUS_C_MINUS_O) -AC_SUBST(OUTPUT_OPTION) - -# See if GNAT has been installed -gcc_AC_PROG_GNAT - -AC_CACHE_CHECK(whether ${CC-cc} accepts -Wno-long-long, -ac_cv_prog_cc_no_long_long, -[save_CFLAGS="$CFLAGS" -CFLAGS="-Wno-long-long" -AC_TRY_COMPILE(,,ac_cv_prog_cc_no_long_long=yes, - ac_cv_prog_cc_no_long_long=no) -CFLAGS="$save_CFLAGS"]) - -if test x$have_gnat != xno ; then -AC_CACHE_CHECK(whether ${ADAC} accepts -Wno-long-long, -ac_cv_prog_adac_no_long_long, -[cat >conftest.adb <<EOF -procedure conftest is begin null; end conftest; -EOF -if $ADAC -Wno-long-long -c conftest.adb 1>&5 2>&5 ; then - ac_cv_prog_adac_no_long_long=yes -else - ac_cv_prog_adac_no_long_long=no -fi -rm -f conftest*]) -else - ac_cv_prog_adac_no_long_long=yes -fi - -strict1_warn= -if test $ac_cv_prog_cc_no_long_long = yes && \ - test $ac_cv_prog_adac_no_long_long = yes ; then - strict1_warn="-pedantic -Wno-long-long" -fi -AC_SUBST(strict1_warn) - -AC_PROG_CPP -AC_C_INLINE -gcc_AC_C_VOLATILE - -gcc_AC_C_LONG_DOUBLE -gcc_AC_C_LONG_LONG -gcc_AC_C__BOOL - -# sizeof(char) is 1 by definition. -gcc_AC_COMPILE_CHECK_SIZEOF(short) -gcc_AC_COMPILE_CHECK_SIZEOF(int) -gcc_AC_COMPILE_CHECK_SIZEOF(long) -if test $ac_cv_c_long_long = yes; then - gcc_AC_COMPILE_CHECK_SIZEOF(long long) -fi -if test $ac_cv_c___int64 = yes; then - gcc_AC_COMPILE_CHECK_SIZEOF(__int64) -fi - -gcc_AC_C_CHARSET - -# If the native compiler is GCC, we can enable warnings even in stage1. -# That's useful for people building cross-compilers, or just running a -# quick `make'. -warn_cflags= -if test "x$GCC" = "xyes"; then - warn_cflags='$(GCC_WARN_CFLAGS)' -fi -AC_SUBST(warn_cflags) - -# Determine whether or not multilibs are enabled. -AC_ARG_ENABLE(multilib, -[ --enable-multilib enable library support for multiple ABIs], -[], [enable_multilib=yes]) -AC_SUBST(enable_multilib) - -# Enable expensive internal checks -AC_ARG_ENABLE(checking, -[ --enable-checking[=LIST] - enable expensive run-time checks. With LIST, - enable only specific categories of checks. - Categories are: misc,tree,rtl,rtlflag,gc,gcac; - default is misc,tree,gc,rtlflag], -[ac_checking= -ac_tree_checking= -ac_rtl_checking= -ac_rtlflag_checking= -ac_gc_checking= -ac_gc_always_collect= -case "${enableval}" in -yes) ac_checking=1 ; ac_tree_checking=1 ; ac_gc_checking=1 ; - ac_rtlflag_checking=1 ;; -no) ;; -*) IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS="$IFS," - set fnord $enableval; shift - IFS="$ac_save_IFS" - for check - do - case $check in - misc) ac_checking=1 ;; - tree) ac_tree_checking=1 ;; - rtlflag) ac_rtlflag_checking=1 ;; - rtl) ac_rtl_checking=1 ;; - gc) ac_gc_checking=1 ;; - gcac) ac_gc_always_collect=1 ;; - valgrind) ac_checking_valgrind=1 ;; - *) AC_MSG_ERROR(unknown check category $check) ;; - esac - done - ;; -esac -], -[]) -nocommon_flag="" -if test x$ac_checking != x ; then - AC_DEFINE(ENABLE_CHECKING, 1, -[Define if you want more run-time sanity checks. This one gets a grab - bag of miscellaneous but relatively cheap checks.]) - nocommon_flag=-fno-common -fi -AC_SUBST(nocommon_flag) -if test x$ac_tree_checking != x ; then - AC_DEFINE(ENABLE_TREE_CHECKING, 1, -[Define if you want all operations on trees (the basic data - structure of the front ends) to be checked for dynamic type safety - at runtime. This is moderately expensive.]) -fi -if test x$ac_rtl_checking != x ; then - AC_DEFINE(ENABLE_RTL_CHECKING, 1, -[Define if you want all operations on RTL (the basic data structure - of the optimizer and back end) to be checked for dynamic type safety - at runtime. This is quite expensive.]) -fi -if test x$ac_rtlflag_checking != x ; then - AC_DEFINE(ENABLE_RTL_FLAG_CHECKING, 1, -[Define if you want RTL flag accesses to be checked against the RTL - codes that are supported for each access macro. This is relatively - cheap.]) -fi -if test x$ac_gc_checking != x ; then - AC_DEFINE(ENABLE_GC_CHECKING, 1, -[Define if you want the garbage collector to do object poisoning and - other memory allocation checks. This is quite expensive.]) -fi -if test x$ac_gc_always_collect != x ; then - AC_DEFINE(ENABLE_GC_ALWAYS_COLLECT, 1, -[Define if you want the garbage collector to operate in maximally - paranoid mode, validating the entire heap and collecting garbage at - every opportunity. This is extremely expensive.]) -fi -valgrind_path_defines= -valgrind_command= -if test x$ac_checking_valgrind != x ; then - # It is certainly possible that there's valgrind but no valgrind.h. - # GCC relies on making annotations so we must have both. - AC_CHECK_HEADER(valgrind.h, have_valgrind_h=yes, have_valgrind_h=no) - AM_PATH_PROG_WITH_TEST(valgrind_path, valgrind, - [$ac_dir/$ac_word --version | grep valgrind- >/dev/null 2>&1]) - if test "x$valgrind_path" = "x" || test $have_valgrind_h = no; then - AC_MSG_ERROR([*** Can't find both valgrind and valgrind.h]) - fi - valgrind_path_defines=-DVALGRIND_PATH='\"'$valgrind_path'\"' - valgrind_command="$valgrind_path -q" - AC_DEFINE(ENABLE_VALGRIND_CHECKING, 1, -[Define if you want to run subprograms and generated programs - through valgrind (a memory checker). This is extremely expensive.]) -fi -AC_SUBST(valgrind_path_defines) -AC_SUBST(valgrind_command) - -# Enable code coverage collection -AC_ARG_ENABLE(coverage, -[ --enable-coverage[=LEVEL] - enable compiler\'s code coverage collection. - Use to measure compiler performance and locate - unused parts of the compiler. With LEVEL, specificy - optimization. Values are opt, noopt, - default is noopt], -[case "${enableval}" in -yes|noopt) - coverage_flags="-fprofile-arcs -ftest-coverage -O0" - ;; -opt) - coverage_flags="-fprofile-arcs -ftest-coverage -O2" - ;; -*) - AC_MSG_ERROR(unknown coverage setting $enableval) - ;; -esac], -[coverage_flags=""]) -AC_SUBST(coverage_flags) - -AC_ARG_WITH(cpp_install_dir, -[ --with-cpp-install-dir=DIR - install the user visible C preprocessor in DIR - (relative to PREFIX) as well as PREFIX/bin], -[if test x$withval = xyes; then - AC_MSG_ERROR([option --with-cpp-install-dir requires an argument]) -elif test x$withval != xno; then - cpp_install_dir=$withval -fi]) - -# Enable __cxa_atexit for C++. -AC_ARG_ENABLE(__cxa_atexit, -[ --enable-__cxa_atexit enable __cxa_atexit for C++], -[], []) -if test x$enable___cxa_atexit = xyes; then - AC_DEFINE(DEFAULT_USE_CXA_ATEXIT, 1, - [Define if you want to use __cxa_atexit, rather than atexit, to - register C++ destructors for local statics and global objects. - This is essential for fully standards-compliant handling of - destructors, but requires __cxa_atexit in libc.]) -fi - -# Enable Multibyte Characters for C/C++ -AC_ARG_ENABLE(c-mbchar, -[ --enable-c-mbchar enable multibyte characters for C and C++], -if test x$enable_c_mbchar != xno; then - AC_DEFINE(MULTIBYTE_CHARS, 1, - [Define if you want the C and C++ compilers to support multibyte - character sets for source code.]) -fi) - -# Enable threads -# Pass with no value to take the default -# Pass with a value to specify a thread package -AC_ARG_ENABLE(threads, -[ --enable-threads enable thread usage for target GCC - --enable-threads=LIB use LIB thread package for target GCC],, -enable_threads='') - -enable_threads_flag=$enable_threads -# Check if a valid thread package -case x${enable_threads_flag} in - x | xno) - # No threads - target_thread_file='single' - ;; - xyes) - # default - target_thread_file='' - ;; - xdecosf1 | xirix | xmach | xos2 | xposix | xpthreads | xsingle | \ - xsolaris | xwin32 | xdce | xrtems| xvxworks | xaix) - target_thread_file=$enable_threads_flag - ;; - *) - echo "$enable_threads is an unknown thread package" 1>&2 - exit 1 - ;; -esac - -AC_ARG_ENABLE(objc-gc, -[ --enable-objc-gc enable the use of Boehm's garbage collector with - the GNU Objective-C runtime], -if test x$enable_objc_gc = xno; then - objc_boehm_gc='' -else - objc_boehm_gc=1 -fi, -objc_boehm_gc='') - -AC_ARG_WITH(dwarf2, -[ --with-dwarf2 force the default debug format to be DWARF 2], -dwarf2="$with_dwarf2", -dwarf2=no) - -AC_ARG_ENABLE(shared, -[ --disable-shared don't provide a shared libgcc], -[ - case $enable_shared in - yes | no) ;; - *) - enable_shared=no - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:," - for pkg in $enableval; do - if test "X$pkg" = "Xgcc" || test "X$pkg" = "Xlibgcc"; then - enable_shared=yes - fi - done - IFS="$ac_save_ifs" - ;; - esac -], [enable_shared=yes]) -AC_SUBST(enable_shared) - -# Stage specific cflags for build. -stage1_cflags= -case $build in -vax-*-*) - if test x$GCC = xyes - then - stage1_cflags="-Wa,-J" - else - stage1_cflags="-J" - fi - ;; -powerpc-*-darwin*) - # The spiffy cpp-precomp chokes on some legitimate constructs in GCC - # sources; use -no-cpp-precomp to get to GNU cpp. - # Apple's GCC has bugs in designated initializer handling, so disable - # that too. - stage1_cflags="-no-cpp-precomp -DHAVE_DESIGNATED_INITIALIZERS=0" - ;; -esac -AC_SUBST(stage1_cflags) - -AC_PROG_MAKE_SET - -AC_MSG_CHECKING([whether a default assembler was specified]) -if test x"${DEFAULT_ASSEMBLER+set}" = x"set"; then - if test x"$gas_flag" = x"no"; then - AC_MSG_RESULT([yes ($DEFAULT_ASSEMBLER)]) - else - AC_MSG_RESULT([yes ($DEFAULT_ASSEMBLER - GNU as)]) - fi -else - AC_MSG_RESULT(no) -fi - -AC_MSG_CHECKING([whether a default linker was specified]) -if test x"${DEFAULT_LINKER+set}" = x"set"; then - if test x"$gnu_ld_flag" = x"no"; then - AC_MSG_RESULT([yes ($DEFAULT_LINKER)]) - else - AC_MSG_RESULT([yes ($DEFAULT_LINKER - GNU ld)]) - fi -else - AC_MSG_RESULT(no) -fi - -AC_MSG_CHECKING(for GNU C library) -AC_CACHE_VAL(gcc_cv_glibc, -[AC_TRY_COMPILE( - [#include <features.h>],[ -#if ! (defined __GLIBC__ || defined __GNU_LIBRARY__) -#error Not a GNU C library system -#endif], - [gcc_cv_glibc=yes], - gcc_cv_glibc=no)]) -AC_MSG_RESULT($gcc_cv_glibc) -if test $gcc_cv_glibc = yes; then - AC_DEFINE(_GNU_SOURCE, 1, [Always define this when using the GNU C Library]) -fi - -# Find some useful tools -AC_PROG_AWK -gcc_AC_PROG_LN -gcc_AC_PROG_LN_S -AC_PROG_RANLIB -gcc_AC_PROG_INSTALL - -AC_HEADER_STDC -AC_HEADER_TIME -gcc_AC_HEADER_STDBOOL -gcc_AC_HEADER_STRING -AC_HEADER_SYS_WAIT -AC_CHECK_HEADERS(limits.h stddef.h string.h strings.h stdlib.h time.h \ - fcntl.h unistd.h sys/file.h sys/time.h sys/mman.h \ - sys/resource.h sys/param.h sys/times.h sys/stat.h \ - direct.h malloc.h langinfo.h) - -# Check for thread headers. -AC_CHECK_HEADER(thread.h, [have_thread_h=yes], [have_thread_h=]) -AC_CHECK_HEADER(pthread.h, [have_pthread_h=yes], [have_pthread_h=]) - -# These tests can't be done till we know if we have limits.h. -gcc_AC_C_CHAR_BIT -gcc_AC_C_COMPILE_ENDIAN -gcc_AC_C_FLOAT_FORMAT - -# See if we have the mktemp command. -AC_CHECK_PROG(have_mktemp_command, mktemp, yes, no) - -# Do we have a single-tree copy of texinfo? -if test -f $srcdir/../texinfo/Makefile.in; then - MAKEINFO='$(objdir)/../texinfo/makeinfo/makeinfo' - gcc_cv_prog_makeinfo_modern=yes - AC_MSG_RESULT([Using makeinfo from the unified source tree.]) -else - # See if makeinfo has been installed and is modern enough - # that we can use it. - gcc_AC_CHECK_PROG_VER(MAKEINFO, makeinfo, --version, - [GNU texinfo.* \([0-9][0-9.]*\)], - [4.[2-9]*]) -fi - -if test $gcc_cv_prog_makeinfo_modern = no; then - AC_MSG_WARN([ -*** Makeinfo is missing or too old. -*** Info documentation will not be built.]) - BUILD_INFO= -else - BUILD_INFO=info AC_SUBST(BUILD_INFO) -fi - -# Is pod2man recent enough to regenerate manpages? -AC_MSG_CHECKING([for recent Pod::Man]) -if (perl -e 'use 1.10 Pod::Man') >/dev/null 2>&1; then - AC_MSG_RESULT(yes) - GENERATED_MANPAGES=generated-manpages AC_SUBST(GENERATED_MANPAGES) -else - AC_MSG_RESULT(no) - GENERATED_MANPAGES= -fi - -# How about lex? -dnl Don't use AC_PROG_LEX; we insist on flex. -dnl LEXLIB is not useful in gcc. -if test -f $srcdir/../flex/skel.c; then - FLEX='$(objdir)/../flex/flex' -else - AC_CHECK_PROG(FLEX, flex, flex, ${CONFIG_SHELL-/bin/sh} ${srcdir}/../missing flex) -fi - -# Bison? -# The -L switch is so bison can find its skeleton file. -if test -f $srcdir/../bison/bison.simple; then - BISON='$(objdir)/../bison/bison -L $(srcdir)/../bison/' -else - AC_CHECK_PROG(BISON, bison, bison, ${CONFIG_SHELL-/bin/sh} ${srcdir}/../missing bison) -fi - -# These libraries may be used by collect2. -# We may need a special search path to get them linked. -AC_CACHE_CHECK(for collect2 libraries, gcc_cv_collect2_libs, -[save_LIBS="$LIBS" -for libs in '' -lld -lmld \ - '-L/usr/lib/cmplrs/cc2.11 -lmld' \ - '-L/usr/lib/cmplrs/cc3.11 -lmld' -do - LIBS="$libs" - AC_TRY_LINK_FUNC(ldopen, - [gcc_cv_collect2_libs="$libs"; break]) -done -LIBS="$save_LIBS" -test -z "$gcc_cv_collect2_libs" && gcc_cv_collect2_libs='none required']) -case $gcc_cv_collect2_libs in - "none required") ;; - *) COLLECT2_LIBS=$gcc_cv_collect2_libs ;; -esac -AC_SUBST(COLLECT2_LIBS) - -# When building Ada code on Alpha, we need exc_resume which is usually in -# -lexc. So test for it. -save_LIBS="$LIBS" -LIBS= -AC_SEARCH_LIBS(exc_resume, exc) -GNAT_LIBEXC="$LIBS" -LIBS="$save_LIBS" -AC_SUBST(GNAT_LIBEXC) - -# Some systems put ldexp and frexp in libm instead of libc; assume -# they're both in the same place. jcf-dump needs them. -save_LIBS="$LIBS" -LIBS= -AC_SEARCH_LIBS(ldexp, m) -LDEXP_LIB="$LIBS" -LIBS="$save_LIBS" -AC_SUBST(LDEXP_LIB) - -# See if the stage1 system preprocessor understands the ANSI C -# preprocessor stringification operator. (Used by symcat.h.) -AC_C_STRINGIZE - -# Use <inttypes.h> only if it exists, -# doesn't clash with <sys/types.h>, and declares intmax_t. -AC_MSG_CHECKING(for inttypes.h) -AC_CACHE_VAL(gcc_cv_header_inttypes_h, -[AC_TRY_COMPILE( - [#include <sys/types.h> -#include <inttypes.h>], - [intmax_t i = -1;], - [gcc_cv_header_inttypes_h=yes], - gcc_cv_header_inttypes_h=no)]) -AC_MSG_RESULT($gcc_cv_header_inttypes_h) -if test $gcc_cv_header_inttypes_h = yes; then - AC_DEFINE(HAVE_INTTYPES_H, 1, - [Define if you have a working <inttypes.h> header file.]) -fi - -dnl Disabled until we have a complete test for buggy enum bitfields. -dnl gcc_AC_C_ENUM_BF_UNSIGNED - -AC_CHECK_FUNCS(times clock dup2 kill getrlimit setrlimit atoll atoq \ - sysconf strsignal putc_unlocked fputc_unlocked fputs_unlocked \ - fwrite_unlocked fprintf_unlocked getrusage nl_langinfo lstat \ - scandir alphasort gettimeofday mmap) - -AC_CHECK_TYPE(ssize_t, int) - -# Try to determine the array type of the second argument of getgroups -# for the target system (int or gid_t). -AC_TYPE_GETGROUPS -if test "${target}" = "${build}"; then - TARGET_GETGROUPS_T=$ac_cv_type_getgroups -else - case "${target}" in - # This condition may need some tweaking. It should include all - # targets where the array type of the second argument of getgroups - # is int and the type of gid_t is not equivalent to int. - *-*-sunos* | *-*-ultrix*) - TARGET_GETGROUPS_T=int - ;; - *) - TARGET_GETGROUPS_T=gid_t - ;; - esac -fi -AC_SUBST(TARGET_GETGROUPS_T) - -gcc_AC_FUNC_PRINTF_PTR -gcc_AC_FUNC_MMAP_BLACKLIST - -case "${host}" in -*-*-uwin*) - AC_MSG_ERROR([ -*** UWIN may not be used as a host platform because -*** linking with posix.dll is not allowed by the GNU GPL]) - ;; -*-*-*vms*) - # Under VMS, vfork works very different than on Unix. The standard test - # won't work, and it isn't easily adaptable. It makes more sense to - # just force it. - ac_cv_func_vfork_works=yes - ;; -esac -AC_FUNC_VFORK - -AM_ICONV - -# We will need to find libiberty.h and ansidecl.h -saved_CFLAGS="$CFLAGS" -CFLAGS="$CFLAGS -I${srcdir} -I${srcdir}/../include" -gcc_AC_CHECK_DECLS(getenv atol sbrk abort atof getcwd getwd \ - strsignal putc_unlocked fputs_unlocked fwrite_unlocked \ - fprintf_unlocked strstr errno vasprintf \ - malloc realloc calloc free basename getopt clock, , ,[ -#include "ansidecl.h" -#include "system.h"]) - -gcc_AC_CHECK_DECLS(getrlimit setrlimit getrusage, , ,[ -#include "ansidecl.h" -#include "system.h" -#ifdef HAVE_SYS_RESOURCE_H -#include <sys/resource.h> -#endif -]) - -AC_TRY_COMPILE([ -#include "ansidecl.h" -#include "system.h" -#ifdef HAVE_SYS_RESOURCE_H -#include <sys/resource.h> -#endif -],[rlim_t l = 0;],,[AC_DEFINE([rlim_t],[long], -[Define to \`long' if <sys/resource.h> doesn't define.])]) - -gcc_AC_CHECK_DECLS(times, , ,[ -#include "ansidecl.h" -#include "system.h" -#ifdef HAVE_SYS_TIMES_H -#include <sys/times.h> -#endif -]) - -# More time-related stuff. -AC_CACHE_CHECK(for struct tms, ac_cv_struct_tms, [ -AC_TRY_COMPILE([ -#include "ansidecl.h" -#include "system.h" -#ifdef HAVE_SYS_TIMES_H -#include <sys/times.h> -#endif -], [struct tms tms;], ac_cv_struct_tms=yes, ac_cv_struct_tms=no)]) -if test $ac_cv_struct_tms = yes; then - AC_DEFINE(HAVE_STRUCT_TMS, 1, - [Define if <sys/times.h> defines struct tms.]) -fi - -# use gcc_cv_* here because this doesn't match the behavior of AC_CHECK_TYPE. -# revisit after autoconf 2.50. -AC_CACHE_CHECK(for clock_t, gcc_cv_type_clock_t, [ -AC_TRY_COMPILE([ -#include "ansidecl.h" -#include "system.h" -], [clock_t x;], gcc_cv_type_clock_t=yes, gcc_cv_type_clock_t=no)]) -if test $gcc_cv_type_clock_t = yes; then - AC_DEFINE(HAVE_CLOCK_T, 1, - [Define if <time.h> defines clock_t.]) -fi - -AC_ARG_ENABLE(initfini-array, - [ --enable-initfini-array use .init_array/.fini_array sections], - gcc_cv_initfinit_array=$enableval, [gcc_AC_INITFINI_ARRAY]) - -# Restore CFLAGS from before the gcc_AC_NEED_DECLARATIONS tests. -CFLAGS="$saved_CFLAGS" - -# mkdir takes a single argument on some systems. -gcc_AC_FUNC_MKDIR_TAKES_ONE_ARG - -# File extensions -manext='.1' -objext='.o' -AC_SUBST(manext) -AC_SUBST(objext) - -# With Setjmp/Longjmp based exception handling. -AC_ARG_ENABLE(sjlj-exceptions, -[ --enable-sjlj-exceptions - arrange to use setjmp/longjmp exception handling], -[sjlj=`if test $enableval = yes; then echo 1; else echo 0; fi` -AC_DEFINE_UNQUOTED(CONFIG_SJLJ_EXCEPTIONS, $sjlj, - [Define 0/1 to force the choice for exception handling model.])]) - -AC_CHECK_LIB(unwind, main, use_libunwind_default=yes, use_libunwind_default=no) -# Use libunwind based exception handling. -AC_ARG_ENABLE(libunwind-exceptions, -[ --enable-libunwind-exceptions force use libunwind for exceptions], -use_libunwind_exceptions=$enableval, -use_libunwind_exceptions=$use_libunwind_default) -if test x"$use_libunwind_exceptions" = xyes; then - AC_DEFINE(USE_LIBUNWIND_EXCEPTIONS, 1, - [Define if gcc should use -lunwind.]) -fi - -target_gtfiles= -build_xm_file= -build_xm_defines= -build_install_headers_dir=install-headers-tar -build_exeext= -host_xm_file= -host_xm_defines= -host_xmake_file= -host_truncate_target= -host_exeext= - -# Decode the host machine, then the target machine. -# For the host machine, we save the xm_file variable as host_xm_file; -# then we decode the target machine and forget everything else -# that came from the host machine. -for machine in $build $host $target; do - . ${srcdir}/config.gcc -done - -extra_objs="${host_extra_objs} ${extra_objs}" - -# Default the target-machine variables that were not explicitly set. -if test x"$tm_file" = x -then tm_file=$cpu_type/$cpu_type.h; fi - -if test x"$extra_headers" = x -then extra_headers=; fi - -if test x$md_file = x -then md_file=$cpu_type/$cpu_type.md; fi - -if test x$out_file = x -then out_file=$cpu_type/$cpu_type.c; fi - -if test x"$tmake_file" = x -then tmake_file=$cpu_type/t-$cpu_type -fi - -if test x"$dwarf2" = xyes -then tm_file="$tm_file tm-dwarf2.h" -fi - -# Say what files are being used for the output code and MD file. -echo "Using \`$srcdir/config/$out_file' for machine-specific logic." -echo "Using \`$srcdir/config/$md_file' as machine description file." - -# If any of the xm_file variables contain nonexistent files, warn -# about them and drop them. - -bx= -for x in $build_xm_file; do - if test -f $srcdir/config/$x - then bx="$bx $x" - else AC_MSG_WARN($srcdir/config/$x does not exist.) - fi -done -build_xm_file="$bx" - -hx= -for x in $host_xm_file; do - if test -f $srcdir/config/$x - then hx="$hx $x" - else AC_MSG_WARN($srcdir/config/$x does not exist.) - fi -done -host_xm_file="$hx" - -tx= -for x in $xm_file; do - if test -f $srcdir/config/$x - then tx="$tx $x" - else AC_MSG_WARN($srcdir/config/$x does not exist.) - fi -done -xm_file="$tx" - -count=a -for f in $tm_file; do - count=${count}x -done -if test $count = ax; then - echo "Using \`$srcdir/config/$tm_file' as target machine macro file." -else - echo "Using the following target machine macro files:" - for f in $tm_file; do - echo " $srcdir/config/$f" - done -fi - -count=a -for f in $host_xm_file; do - count=${count}x -done -if test $count = a; then - : -elif test $count = ax; then - echo "Using \`$srcdir/config/$host_xm_file' as host machine macro file." -else - echo "Using the following host machine macro files:" - for f in $host_xm_file; do - echo " $srcdir/config/$f" - done -fi - -if test "$host_xm_file" != "$build_xm_file"; then - count=a - for f in $build_xm_file; do - count=${count}x - done - if test $count = a; then - : - elif test $count = ax; then - echo "Using \`$srcdir/config/$build_xm_file' as build machine macro file." - else - echo "Using the following build machine macro files:" - for f in $build_xm_file; do - echo " $srcdir/config/$f" - done - fi -fi - -if test x$thread_file = x; then - if test x$target_thread_file != x; then - thread_file=$target_thread_file - else - thread_file='single' - fi -fi - -# Look for a file containing extra machine modes. -if test -n "$extra_modes" && test -f $srcdir/config/$extra_modes; then - extra_modes_file='$(srcdir)'/config/${extra_modes} - AC_SUBST(extra_modes_file) - AC_DEFINE_UNQUOTED(EXTRA_MODES_FILE, "$extra_modes", - [Define to the name of a file containing a list of extra machine modes - for this architecture.]) - AC_DEFINE(EXTRA_CC_MODES, 1, - [Define if the target architecture needs extra machine modes to represent - the results of comparisons.]) -fi - -# auto-host.h is the file containing items generated by autoconf and is -# the first file included by config.h. -# If host=build, it is correct to have hconfig include auto-host.h -# as well. If host!=build, we are in error and need to do more -# work to find out the build config parameters. -if test x$host = x$build -then - build_auto=auto-host.h - FORBUILD=.. -else - # We create a subdir, then run autoconf in the subdir. - # To prevent recursion we set host and build for the new - # invocation of configure to the build for this invocation - # of configure. - tempdir=build.$$ - rm -rf $tempdir - mkdir $tempdir - cd $tempdir - case ${srcdir} in - /* | [A-Za-z]:[\\/]* ) realsrcdir=${srcdir};; - *) realsrcdir=../${srcdir};; - esac - saved_CFLAGS="${CFLAGS}" - CC="${CC_FOR_BUILD}" CFLAGS="${CFLAGS_FOR_BUILD}" \ - ${realsrcdir}/configure \ - --target=$target_alias --host=$build_alias --build=$build_alias - CFLAGS="${saved_CFLAGS}" - - # We just finished tests for the build machine, so rename - # the file auto-build.h in the gcc directory. - mv auto-host.h ../auto-build.h - cd .. - rm -rf $tempdir - build_auto=auto-build.h - FORBUILD=../$build_alias -fi -AC_SUBST(FORBUILD) - -tm_file="${tm_file} defaults.h" -host_xm_file="auto-host.h ansidecl.h ${host_xm_file} ${tm_file}" -build_xm_file="${build_auto} ansidecl.h ${build_xm_file} ${tm_file}" -xm_file="ansidecl.h ${xm_file} ${tm_file}" - -# Truncate the target if necessary -if test x$host_truncate_target != x; then - target=`echo $target | sed -e 's/\(..............\).*/\1/'` -fi - -# Get the version trigger filename from the toplevel -if test "${with_gcc_version_trigger+set}" = set; then - gcc_version_trigger=$with_gcc_version_trigger -else - gcc_version_trigger=${srcdir}/version.c -fi -changequote(,)dnl -gcc_version_full=`grep version_string ${gcc_version_trigger} | sed -e 's/.*"\([^"]*\)".*/\1/'` -gcc_version=`echo ${gcc_version_full} | sed -e 's/\([^ ]*\) .*/\1/'` - -# Compile in configure arguments. -if test -f configargs.h ; then - # Being re-configured. - gcc_config_arguments=`grep configuration_arguments configargs.h | sed -e 's/.*"\([^"]*\)".*/\1/'` - gcc_config_arguments="$gcc_config_arguments : (reconfigured) $TOPLEVEL_CONFIGURE_ARGUMENTS" -else - gcc_config_arguments="$TOPLEVEL_CONFIGURE_ARGUMENTS" -fi -cat > configargs.h <<EOF -/* Generated automatically. */ -static const char configuration_arguments[] = "$gcc_config_arguments"; -static const char thread_model[] = "$thread_file"; -EOF -changequote([,])dnl - -# Internationalization -PACKAGE=gcc -VERSION="$gcc_version" -AC_SUBST(PACKAGE) -AC_SUBST(VERSION) - -# Enable NLS support by default -AC_ARG_ENABLE(nls, - [ --enable-nls use Native Language Support (default)], - , enable_nls=yes) - -# if cross compiling, disable NLS support. -# It's not worth the trouble, at least for now. - -if test "${build}" != "${host}" && test "x$enable_nls" = "xyes"; then - AC_MSG_WARN(Disabling NLS support for canadian cross compiler.) - enable_nls=no -fi - -AM_GNU_GETTEXT - -# Windows32 Registry support for specifying GCC installation paths. -AC_ARG_ENABLE(win32-registry, -[ --disable-win32-registry - disable lookup of installation paths in the - Registry on Windows hosts - --enable-win32-registry enable registry lookup (default) - --enable-win32-registry=KEY - use KEY instead of GCC version as the last portion - of the registry key],,) -case $host_os in - win32 | pe | cygwin* | mingw32* | uwin*) -AC_MSG_CHECKING(whether windows registry support is requested) -if test "x$enable_win32_registry" != xno; then - AC_DEFINE(ENABLE_WIN32_REGISTRY, 1, -[Define to 1 if installation paths should be looked up in Windows32 - Registry. Ignored on non windows32 hosts.]) - AC_MSG_RESULT(yes) - AC_SEARCH_LIBS(RegOpenKeyExA, advapi32) -else - AC_MSG_RESULT(no) -fi - -# Check if user specified a different registry key. -case "x${enable_win32_registry}" in -x | xyes) - # default. - gcc_cv_win32_registry_key="$VERSION" - ;; -xno) - # no registry lookup. - gcc_cv_win32_registry_key='' - ;; -*) - # user-specified key. - gcc_cv_win32_registry_key="$enable_win32_registry" - ;; -esac - -if test "x$enable_win32_registry" != xno; then - AC_MSG_CHECKING(registry key on windows hosts) - AC_DEFINE_UNQUOTED(WIN32_REGISTRY_KEY, "$gcc_cv_win32_registry_key", - [Define to be the last portion of registry key on windows hosts.]) - AC_MSG_RESULT($gcc_cv_win32_registry_key) -fi -;; -esac - -# Get an absolute path to the GCC top-level source directory -holddir=`${PWDCMD-pwd}` -cd $srcdir -topdir=`${PWDCMD-pwd}` -cd $holddir - -# Conditionalize the makefile for this host machine. -# Make-host contains the concatenation of all host makefile fragments -# [there can be more than one]. This file is built by configure.frag. -host_overrides=Make-host -dep_host_xmake_file= -for f in .. ${host_xmake_file} -do - if test -f ${srcdir}/config/$f - then - dep_host_xmake_file="${dep_host_xmake_file} ${srcdir}/config/$f" - fi -done - -# Conditionalize the makefile for this target machine. -# Make-target contains the concatenation of all host makefile fragments -# [there can be more than one]. This file is built by configure.frag. -target_overrides=Make-target -dep_tmake_file= -for f in .. ${tmake_file} -do - if test -f ${srcdir}/config/$f - then - dep_tmake_file="${dep_tmake_file} ${srcdir}/config/$f" - fi -done - -# If the host doesn't support symlinks, modify CC in -# FLAGS_TO_PASS so CC="stage1/xgcc -Bstage1/" works. -# Otherwise, we can use "CC=$(CC)". -rm -f symtest.tem -if $symbolic_link $srcdir/gcc.c symtest.tem 2>/dev/null -then - cc_set_by_configure="\$(CC)" - quoted_cc_set_by_configure="\$(CC)" - stage_prefix_set_by_configure="\$(STAGE_PREFIX)" - quoted_stage_prefix_set_by_configure="\$(STAGE_PREFIX)" -else - rm -f symtest.tem - if cp -p $srcdir/gcc.c symtest.tem 2>/dev/null - then - symbolic_link="cp -p" - else - symbolic_link="cp" - fi - cc_set_by_configure="\`case '\$(CC)' in stage*) echo '\$(CC)' | sed -e 's|stage|../stage|g';; *) echo '\$(CC)';; esac\`" - quoted_cc_set_by_configure="\\\`case '\\\$(CC)' in stage*) echo '\\\$(CC)' | sed -e 's|stage|../stage|g';; *) echo '\\\$(CC)';; esac\\\`" - stage_prefix_set_by_configure="\`case '\$(STAGE_PREFIX)' in stage*) echo '\$(STAGE_PREFIX)' | sed -e 's|stage|../stage|g';; *) echo '\$(STAGE_PREFIX)';; esac\`" - quoted_stage_prefix_set_by_configure="\\\`case '\\\$(STAGE_PREFIX)' in stage*) echo '\\\$(STAGE_PREFIX)' | sed -e 's|stage|../stage|g';; *) echo '\\\$(STAGE_PREFIX)';; esac\\\`" -fi -rm -f symtest.tem - -out_object_file=`basename $out_file .c`.o - -tm_file_list= -for f in $tm_file; do - case $f in - ansidecl.h ) - tm_file_list="${tm_file_list} \$(srcdir)/../include/ansidecl.h" ;; - defaults.h ) - tm_file_list="${tm_file_list} \$(srcdir)/$f" ;; - *) tm_file_list="${tm_file_list} \$(srcdir)/config/$f" ;; - esac -done - -tm_p_file_list= -for f in $tm_p_file; do - tm_p_file_list="${tm_p_file_list} \$(srcdir)/config/$f" -done - -host_xm_file_list= -for f in $host_xm_file; do - case $f in - ansidecl.h ) - host_xm_file_list="${host_xm_file_list} \$(srcdir)/../include/ansidecl.h" ;; - auto-host.h ) - host_xm_file_list="${host_xm_file_list} $f" ;; - defaults.h ) - host_xm_file_list="${host_xm_file_list} \$(srcdir)/$f" ;; - *) host_xm_file_list="${host_xm_file_list} \$(srcdir)/config/$f" ;; - esac -done - -build_xm_file_list= -for f in $build_xm_file; do - case $f in - ansidecl.h ) - build_xm_file_list="${build_xm_file_list} \$(srcdir)/../include/ansidecl.h" ;; - auto-build.h | auto-host.h ) - build_xm_file_list="${build_xm_file_list} $f" ;; - defaults.h ) - host_xm_file_list="${host_xm_file_list} \$(srcdir)/$f" ;; - *) build_xm_file_list="${build_xm_file_list} \$(srcdir)/config/$f" ;; - esac -done - -# Define macro CROSS_COMPILE in compilation if this is a cross-compiler. -# Also use all.cross instead of all.internal and adjust SYSTEM_HEADER_DIR. -CROSS= AC_SUBST(CROSS) -ALL=all.internal AC_SUBST(ALL) -SYSTEM_HEADER_DIR='$(NATIVE_SYSTEM_HEADER_DIR)' AC_SUBST(SYSTEM_HEADER_DIR) -if test x$host != x$target -then - CROSS="-DCROSS_COMPILE" - ALL=all.cross - SYSTEM_HEADER_DIR='$(CROSS_SYSTEM_HEADER_DIR)' - case "$host","$target" in - i?86-*-*,x86_64-*-* \ - | powerpc*-*-*,powerpc64*-*-*) - CROSS="$CROSS -DNATIVE_CROSS" ;; - esac -fi - -# If this is a cross-compiler that does not -# have its own set of headers then define -# inhibit_libc - -# If this is using newlib, then define inhibit_libc in LIBGCC2_CFLAGS. -# This prevents libgcc2 from containing any code which requires libc -# support. -inhibit_libc= -if [test x$host != x$target] && [test x$with_headers = x]; then - inhibit_libc=-Dinhibit_libc -else - if [test x$with_newlib = xyes]; then - inhibit_libc=-Dinhibit_libc - fi -fi -AC_SUBST(inhibit_libc) - -# When building gcc with a cross-compiler, we need to adjust things so -# that the generator programs are still built with the native compiler. -# Also, we cannot run fixincludes or fix-header. -# Note that the terminology here is wrong; it should be BUILD_* throughout. -# FIXME. - -# These are the normal (build=host) settings: -BUILD_PREFIX= AC_SUBST(BUILD_PREFIX) -BUILD_PREFIX_1=ignore- AC_SUBST(BUILD_PREFIX_1) -HOST_CC='$(CC)' AC_SUBST(HOST_CC) -HOST_CFLAGS='$(ALL_CFLAGS)' AC_SUBST(HOST_CFLAGS) - -STMP_FIXINC=stmp-fixinc AC_SUBST(STMP_FIXINC) -STMP_FIXPROTO=stmp-fixproto AC_SUBST(STMP_FIXPROTO) - -# And these apply if build != host. -if test x$build != x$host -then - BUILD_PREFIX=build- - BUILD_PREFIX_1=build- - HOST_CC='$(CC_FOR_BUILD)' - HOST_CFLAGS='$(INTERNAL_CFLAGS) $(T_CFLAGS) $(CFLAGS_FOR_BUILD) $(XCFLAGS)' - - STMP_FIXINC= - STMP_FIXPROTO= -fi - -# Expand extra_headers to include complete path. -# This substitutes for lots of t-* files. -extra_headers_list= -if test "x$extra_headers" = x -then true -else - # Prepend ${srcdir}/config/${cpu_type}/ to every entry in extra_headers. - for file in $extra_headers; - do - extra_headers_list="${extra_headers_list} \$(srcdir)/config/${cpu_type}/${file}" - done -fi - -if test x$use_collect2 = xno; then - use_collect2= -fi - -# Add a definition of USE_COLLECT2 if system wants one. -if test x$use_collect2 != x -then - host_xm_defines="${host_xm_defines} USE_COLLECT2" - xm_defines="${xm_defines} USE_COLLECT2" -fi - -# If we have gas in the build tree, make a link to it. -if test -f ../gas/Makefile; then - rm -f as; $symbolic_link ../gas/as-new$host_exeext as$host_exeext 2>/dev/null -fi - -# If we have nm and objdump in the build tree, make a link to them. -if test -f ../binutils/Makefile; then - rm -f nm; $symbolic_link ../binutils/nm-new$host_exeext nm$host_exeext 2>/dev/null - rm -f objdump; $symbolic_link ../binutils/objdump$host_exeext objdump$host_exeext 2>/dev/null -fi - -# If we have ld in the build tree, make a link to it. -if test -f ../ld/Makefile; then - rm -f collect-ld; $symbolic_link ../ld/ld-new$host_exeext collect-ld$host_exeext 2>/dev/null -fi - -# Figure out what assembler we will be using. -AC_MSG_CHECKING(what assembler to use) -gcc_cv_as= -gcc_cv_gas_major_version= -gcc_cv_gas_minor_version= -gcc_cv_as_gas_srcdir=`echo $srcdir | sed -e 's,/gcc$,,'`/gas -gcc_cv_as_bfd_srcdir=`echo $srcdir | sed -e 's,/gcc$,,'`/bfd -if test -x "$DEFAULT_ASSEMBLER"; then - gcc_cv_as="$DEFAULT_ASSEMBLER" -elif test -x "$AS"; then - gcc_cv_as="$AS" -elif test -x as$host_exeext; then - # Build using assembler in the current directory. - gcc_cv_as=./as$host_exeext -elif test -f $gcc_cv_as_gas_srcdir/configure.in -a -f ../gas/Makefile; then - # Single tree build which includes gas. - for f in $gcc_cv_as_bfd_srcdir/configure $gcc_cv_as_gas_srcdir/configure $gcc_cv_as_gas_srcdir/configure.in $gcc_cv_as_gas_srcdir/Makefile.in - do -changequote(,)dnl - gcc_cv_gas_version=`grep '^VERSION=[0-9]*\.[0-9]*' $f` -changequote([,])dnl - if test x$gcc_cv_gas_version != x; then - break - fi - done -changequote(,)dnl - gcc_cv_gas_major_version=`expr "$gcc_cv_gas_version" : "VERSION=\([0-9]*\)"` - gcc_cv_gas_minor_version=`expr "$gcc_cv_gas_version" : "VERSION=[0-9]*\.\([0-9]*\)"` - gcc_cv_gas_patch_version=`expr "$gcc_cv_gas_version" : "VERSION=[0-9]*\.[0-9]*\.\([0-9]*\)"` -changequote([,])dnl -fi - -if test "x$gcc_cv_as" = x; then - # Search the same directories that the installed compiler will - # search. Else we may find the wrong assembler and lose. If we - # do not find a suitable assembler binary, then try the user's - # path. - # - # Also note we have to check MD_EXEC_PREFIX before checking the - # user's path. Unfortunately, there is no good way to get at the - # value of MD_EXEC_PREFIX here. So we do a brute force search - # through all the known MD_EXEC_PREFIX values. Ugh. This needs - # to be fixed as part of the make/configure rewrite too. - - if test "x$exec_prefix" = xNONE; then - if test "x$prefix" = xNONE; then - test_prefix=/usr/local - else - test_prefix=$prefix - fi - else - test_prefix=$exec_prefix - fi - - # If the loop below does not find an assembler, then use whatever - # one we can find in the users's path. - # user's path. - if test "x$program_prefix" != xNONE; then - gcc_cv_as=${program_prefix}as$host_exeext - else - gcc_cv_as=`echo as | sed ${program_transform_name}`$host_exeext - fi - - test_dirs="$test_prefix/lib/gcc-lib/$target_alias/$gcc_version \ - $test_prefix/lib/gcc-lib/$target_alias \ - /usr/lib/gcc/$target_alias/$gcc_version \ - /usr/lib/gcc/$target_alias \ - $test_prefix/$target_alias/bin/$target_alias/$gcc_version \ - $test_prefix/$target_alias/bin" - - if test x$host = x$target; then - test_dirs="$test_dirs \ - /usr/libexec \ - /usr/ccs/gcc \ - /usr/ccs/bin \ - /udk/usr/ccs/bin \ - /bsd43/usr/lib/cmplrs/cc \ - /usr/cross64/usr/bin \ - /usr/lib/cmplrs/cc \ - /sysv/usr/lib/cmplrs/cc \ - /svr4/usr/lib/cmplrs/cc \ - /usr/bin" - fi - - for dir in $test_dirs; do - if test -x $dir/as$host_exeext; then - gcc_cv_as=$dir/as$host_exeext - break; - fi - done -fi -if test x$gcc_cv_gas_major_version != x -a x$gcc_cv_gas_minor_version != x; then - AC_MSG_RESULT("newly built gas") -else - AC_MSG_RESULT($gcc_cv_as) -fi - -# Figure out what linker we will be using. -AC_MSG_CHECKING(what linker to use) -gcc_cv_ld= -gcc_cv_gld_major_version= -gcc_cv_gld_minor_version= -gcc_cv_ld_gld_srcdir=`echo $srcdir | sed -e 's,/gcc$,,'`/ld -gcc_cv_ld_bfd_srcdir=`echo $srcdir | sed -e 's,/gcc$,,'`/bfd -if test -x "$DEFAULT_LINKER"; then - gcc_cv_ld="$DEFAULT_LINKER" -elif test -x "$LD"; then - gcc_cv_ld="$LD" -elif test -x ld$host_exeext; then - # Build using linker in the current directory. - gcc_cv_ld=./ld$host_exeext -elif test -f $gcc_cv_ld_gld_srcdir/configure.in -a -f ../ld/Makefile; then - # Single tree build which includes ld. - for f in $gcc_cv_ld_bfd_srcdir/configure $gcc_cv_ld_gld_srcdir/configure $gcc_cv_ld_gld_srcdir/configure.in $gcc_cv_ld_gld_srcdir/Makefile.in - do -changequote(,)dnl - gcc_cv_gld_version=`grep '^VERSION=[0-9]*\.[0-9]*' $f` -changequote([,])dnl - if test x$gcc_cv_gld_version != x; then - break - fi - done -changequote(,)dnl - gcc_cv_gld_major_version=`expr "$gcc_cv_gld_version" : "VERSION=\([0-9]*\)"` - gcc_cv_gld_minor_version=`expr "$gcc_cv_gld_version" : "VERSION=[0-9]*\.\([0-9]*\)"` -changequote([,])dnl -fi - -if test "x$gcc_cv_ld" = x; then - # Search the same directories that the installed compiler will - # search. Else we may find the wrong linker and lose. If we - # do not find a suitable linker binary, then try the user's - # path. - # - # Also note we have to check MD_EXEC_PREFIX before checking the - # user's path. Unfortunately, there is no good way to get at the - # value of MD_EXEC_PREFIX here. So we do a brute force search - # through all the known MD_EXEC_PREFIX values. Ugh. This needs - # to be fixed as part of the make/configure rewrite too. - - if test "x$exec_prefix" = xNONE; then - if test "x$prefix" = xNONE; then - test_prefix=/usr/local - else - test_prefix=$prefix - fi - else - test_prefix=$exec_prefix - fi - - # If the loop below does not find an linker, then use whatever - # one we can find in the users's path. - # user's path. - if test "x$program_prefix" != xNONE; then - gcc_cv_ld=${program_prefix}ld$host_exeext - else - gcc_cv_ld=`echo ld | sed ${program_transform_name}`$host_exeext - fi - - test_dirs="$test_prefix/lib/gcc-lib/$target_alias/$gcc_version \ - $test_prefix/lib/gcc-lib/$target_alias \ - /usr/lib/gcc/$target_alias/$gcc_version \ - /usr/lib/gcc/$target_alias \ - $test_prefix/$target_alias/bin/$target_alias/$gcc_version \ - $test_prefix/$target_alias/bin" - - if test x$host = x$target; then - test_dirs="$test_dirs \ - /usr/libexec \ - /usr/ccs/gcc \ - /usr/ccs/bin \ - /udk/usr/ccs/bin \ - /bsd43/usr/lib/cmplrs/cc \ - /usr/cross64/usr/bin \ - /usr/lib/cmplrs/cc \ - /sysv/usr/lib/cmplrs/cc \ - /svr4/usr/lib/cmplrs/cc \ - /usr/bin" - fi - - for dir in $test_dirs; do - if test -x $dir/ld$host_exeext; then - gcc_cv_ld=$dir/ld$host_exeext - break; - fi - done -fi -if test x$gcc_cv_gld_major_version != x -a x$gcc_cv_gld_minor_version != x; then - AC_MSG_RESULT("newly built ld") -else - AC_MSG_RESULT($gcc_cv_ld) -fi - -# Figure out what nm we will be using. -AC_MSG_CHECKING(what nm to use) -if test -x nm$host_exeext; then - gcc_cv_nm=./nm$host_exeext -elif test "x$program_prefix" != xNONE; then - gcc_cv_nm=${program_prefix}nm$host_exeext -else - gcc_cv_nm=`echo nm | sed ${program_transform_name}`$host_exeext -fi -AC_MSG_RESULT($gcc_cv_nm) - -# Figure out what objdump we will be using. -AC_MSG_CHECKING(what objdump to use) -if test -x objdump$host_exeext; then - gcc_cv_objdump=./objdump$host_exeext -elif test "x$program_prefix" != xNONE; then - gcc_cv_objdump=${program_prefix}objdump$host_exeext -else - gcc_cv_objdump=`echo objdump | sed ${program_transform_name}`$host_exeext -fi -AC_MSG_RESULT($gcc_cv_objdump) - -# Figure out what assembler alignment features are present. -AC_MSG_CHECKING(assembler alignment features) -gcc_cv_as_alignment_features=none -if test x$gcc_cv_gas_major_version != x -a x$gcc_cv_gas_minor_version != x; then - # Gas version 2.6 and later support for .balign and .p2align. - # bytes to skip when using .p2align. - if test "$gcc_cv_gas_major_version" -eq 2 -a "$gcc_cv_gas_minor_version" -ge 6 -o "$gcc_cv_gas_major_version" -gt 2; then - gcc_cv_as_alignment_features=".balign and .p2align" - AC_DEFINE(HAVE_GAS_BALIGN_AND_P2ALIGN) - fi - # Gas version 2.8 and later support specifying the maximum - # bytes to skip when using .p2align. - if test "$gcc_cv_gas_major_version" -eq 2 -a "$gcc_cv_gas_minor_version" -ge 8 -o "$gcc_cv_gas_major_version" -gt 2; then - gcc_cv_as_alignment_features=".p2align including maximum skip" - AC_DEFINE(HAVE_GAS_MAX_SKIP_P2ALIGN) - fi -elif test x$gcc_cv_as != x; then - # Check if we have .balign and .p2align - echo ".balign 4" > conftest.s - echo ".p2align 2" >> conftest.s - if $gcc_cv_as -o conftest.o conftest.s > /dev/null 2>&1; then - gcc_cv_as_alignment_features=".balign and .p2align" - AC_DEFINE(HAVE_GAS_BALIGN_AND_P2ALIGN) - fi - rm -f conftest.s conftest.o - # Check if specifying the maximum bytes to skip when - # using .p2align is supported. - echo ".p2align 4,,7" > conftest.s - if $gcc_cv_as -o conftest.o conftest.s > /dev/null 2>&1; then - gcc_cv_as_alignment_features=".p2align including maximum skip" - AC_DEFINE(HAVE_GAS_MAX_SKIP_P2ALIGN) - fi - rm -f conftest.s conftest.o -fi -AC_MSG_RESULT($gcc_cv_as_alignment_features) - -AC_MSG_CHECKING(assembler subsection support) -gcc_cv_as_subsections=no -if test x$gcc_cv_gas_major_version != x -a x$gcc_cv_gas_minor_version != x; then - if test "$gcc_cv_gas_major_version" -eq 2 -a "$gcc_cv_gas_minor_version" -ge 9 -o "$gcc_cv_gas_major_version" -gt 2 && grep 'obj_format = elf' ../gas/Makefile > /dev/null; then - gcc_cv_as_subsections="working .subsection -1" - fi -elif test x$gcc_cv_as != x; then - # Check if we have .subsection - echo ".subsection 1" > conftest.s - if $gcc_cv_as -o conftest.o conftest.s > /dev/null 2>&1; then - gcc_cv_as_subsections=".subsection" - if test x$gcc_cv_nm != x; then - cat > conftest.s <<EOF -conftest_label1: .word 0 -.subsection -1 -conftest_label2: .word 0 -.previous -EOF - if $gcc_cv_as -o conftest.o conftest.s > /dev/null 2>&1; then - $gcc_cv_nm conftest.o | grep conftest_label1 > conftest.nm1 - $gcc_cv_nm conftest.o | grep conftest_label2 | sed -e 's/label2/label1/' > conftest.nm2 - if cmp conftest.nm1 conftest.nm2 > /dev/null 2>&1; then - : - else - gcc_cv_as_subsections="working .subsection -1" - fi - fi - fi - fi - rm -f conftest.s conftest.o conftest.nm1 conftest.nm2 -fi -if test x"$gcc_cv_as_subsections" = x"working .subsection -1"; then - AC_DEFINE(HAVE_GAS_SUBSECTION_ORDERING, 1, -[Define if your assembler supports .subsection and .subsection -1 starts - emitting at the beginning of your section.]) -fi -AC_MSG_RESULT($gcc_cv_as_subsections) - -AC_MSG_CHECKING(assembler weak support) -gcc_cv_as_weak=no -if test x$gcc_cv_gas_major_version != x -a x$gcc_cv_gas_minor_version != x; then - if test "$gcc_cv_gas_major_version" -eq 2 -a "$gcc_cv_gas_minor_version" -ge 2 -o "$gcc_cv_gas_major_version" -gt 2; then - gcc_cv_as_weak="yes" - fi -elif test x$gcc_cv_as != x; then - # Check if we have .weak - echo " .weak foobar" > conftest.s - if $gcc_cv_as -o conftest.o conftest.s > /dev/null 2>&1; then - gcc_cv_as_weak="yes" - fi - rm -f conftest.s conftest.o conftest.nm1 conftest.nm2 -fi -if test x"$gcc_cv_as_weak" = xyes; then - AC_DEFINE(HAVE_GAS_WEAK, 1, [Define if your assembler supports .weak.]) -fi -AC_MSG_RESULT($gcc_cv_as_weak) - -AC_MSG_CHECKING(assembler hidden support) -gcc_cv_as_hidden=no -if test x$gcc_cv_gas_major_version != x -a x$gcc_cv_gas_minor_version != x; then - if test "$gcc_cv_gas_major_version" -eq 2 \ - -a "$gcc_cv_gas_minor_version" -eq 12 \ - -a "$gcc_cv_gas_patch_version" -ge 1 \ - -o "$gcc_cv_gas_major_version" -eq 2 \ - -a "$gcc_cv_gas_minor_version" -gt 12 \ - -o "$gcc_cv_gas_major_version" -gt 2 \ - && grep 'obj_format = elf' ../gas/Makefile > /dev/null; then - gcc_cv_as_hidden="yes" - fi -elif test x$gcc_cv_as != x; then - # Check if we have .hidden - echo " .hidden foobar" > conftest.s - echo "foobar:" >> conftest.s - if $gcc_cv_as -o conftest.o conftest.s > /dev/null 2>&1; then - gcc_cv_as_hidden="yes" - fi - rm -f conftest.s conftest.o conftest.nm1 conftest.nm2 - - # GNU LD versions before 2.12.1 have buggy support for STV_HIDDEN. - # This is irritatingly difficult to feature test for. Look for - # the date string after the version number. - ld_ver=`$gcc_cv_ld --version 2>/dev/null | head -1` - if echo "$ld_ver" | grep GNU > /dev/null; then -changequote(,)dnl - ld_vers=`echo $ld_ver | sed -n 's,^.*[ ]\([0-9][0-9]*\.[0-9][0-9]*\(\|\.[0-9][0-9]*\(\|\.[0-9][0-9]*\)\)\)\([ ].*\|\)$,\1,p'` - ld_date=`echo $ld_ver | sed -n 's,^.*\([2-9][0-9][0-9][0-9]\)[-]*\([01][0-9]\)[-]*\([0-3][0-9]\).*$,\1\2\3,p'` - if test 0"$ld_date" -lt 20020404; then - if test -n "$ld_date"; then - # If there was date string, but was earlier than 2002-04-04, fail - gcc_cv_as_hidden="no" - elif test -z "$ld_vers"; then - # If there was no date string nor ld version number, something is wrong - gcc_cv_as_hidden="no" - else - ld_vers_major=`expr "$ld_vers" : '\([0-9]*\)'` - ld_vers_minor=`expr "$ld_vers" : '[0-9]*\.\([0-9]*\)'` - ld_vers_patch=`expr "$ld_vers" : '[0-9]*\.[0-9]*\.\([0-9]*\)'` - test -z "$ld_vers_patch" && ld_vers_patch=0 - if test "$ld_vers_major" -lt 2; then - gcc_cv_as_hidden="no" - elif test "$ld_vers_major" -eq 2 -a "$ld_vers_minor" -lt 12; then - gcc_cv_as_hidden="no" - elif test "$ld_vers_major" -eq 2 -a "$ld_vers_minor" -eq 12 \ - -a "$ld_vers_patch" -eq 0; then - gcc_cv_as_hidden="no" - fi - fi - fi -changequote([,])dnl - else - # non-GNU linkers don't seem to support .hidden yet - gcc_cv_as_hidden=no - fi -fi -if test x"$gcc_cv_as_hidden" = xyes; then - AC_DEFINE(HAVE_GAS_HIDDEN, 1, - [Define if your assembler supports .hidden.]) -fi -AC_MSG_RESULT($gcc_cv_as_hidden) -libgcc_visibility=$gcc_cv_as_hidden -AC_SUBST(libgcc_visibility) - -AC_MSG_CHECKING(assembler leb128 support) -gcc_cv_as_leb128=no -if test x$gcc_cv_gas_major_version != x -a x$gcc_cv_gas_minor_version != x; then - if test "$gcc_cv_gas_major_version" -eq 2 -a "$gcc_cv_gas_minor_version" -ge 11 -o "$gcc_cv_gas_major_version" -gt 2 && grep 'obj_format = elf' ../gas/Makefile > /dev/null; then - gcc_cv_as_leb128="yes" - fi -elif test x$gcc_cv_as != x; then - # Check if we have .[us]leb128, and support symbol arithmetic with it. - cat > conftest.s <<EOF - .data - .uleb128 L2 - L1 -L1: - .uleb128 1280 - .sleb128 -1010 -L2: -EOF - if $gcc_cv_as -o conftest.o conftest.s > /dev/null 2>&1; then - gcc_cv_as_leb128="yes" - - # GAS versions before 2.11 do not support uleb128, - # despite appearing to. - # ??? There exists an elf-specific test that will crash - # the assembler. Perhaps it's better to figure out whether - # arbitrary sections are supported and try the test. - as_ver=`$gcc_cv_as --version 2>/dev/null | head -1` - if echo "$as_ver" | grep GNU > /dev/null; then -changequote(,)dnl - as_ver=`echo $as_ver | sed -e 's/GNU assembler \([0-9.][0-9.]*\).*/\1/'` - as_major=`echo $as_ver | sed 's/\..*//'` - as_minor=`echo $as_ver | sed 's/[^.]*\.\([0-9]*\).*/\1/'` -changequote([,])dnl - if test $as_major -eq 2 -a $as_minor -lt 11; then - gcc_cv_as_leb128="no" - fi - fi - fi - rm -f conftest.s conftest.o conftest.nm1 conftest.nm2 -fi -if test x"$gcc_cv_as_leb128" = xyes; then - AC_DEFINE(HAVE_AS_LEB128, 1, - [Define if your assembler supports .uleb128.]) -fi -AC_MSG_RESULT($gcc_cv_as_leb128) - -AC_MSG_CHECKING(assembler eh_frame optimization) -gcc_cv_as_eh_frame=no -if test x$gcc_cv_gas_major_version != x -a x$gcc_cv_gas_minor_version != x; then - if test "$gcc_cv_gas_major_version" -eq 2 -a "$gcc_cv_gas_minor_version" -ge 12 -o "$gcc_cv_gas_major_version" -gt 2 && grep 'obj_format = elf' ../gas/Makefile > /dev/null; then - gcc_cv_as_eh_frame="yes" - fi -elif test x$gcc_cv_as != x; then - # Check if this is GAS. - as_ver=`$gcc_cv_as --version < /dev/null 2> /dev/null | head -1` - rm -f a.out 2> /dev/null - if echo "$as_ver" | grep GNU > /dev/null; then - # Versions up to and including 2.11.0 may mis-optimize - # .eh_frame data. Try something. - cat > conftest.s <<EOF - .text -.LFB1: - .4byte 0 -.L1: - .4byte 0 -.LFE1: - .section .eh_frame,"aw",@progbits -__FRAME_BEGIN__: - .4byte .LECIE1-.LSCIE1 -.LSCIE1: - .4byte 0x0 - .byte 0x1 - .ascii "z\0" - .byte 0x1 - .byte 0x78 - .byte 0x1a - .byte 0x0 - .byte 0x4 - .4byte 1 - .p2align 1 -.LECIE1: -.LSFDE1: - .4byte .LEFDE1-.LASFDE1 -.LASFDE1: - .4byte .LASFDE1-__FRAME_BEGIN__ - .4byte .LFB1 - .4byte .LFE1-.LFB1 - .byte 0x4 - .4byte .LFE1-.LFB1 - .byte 0x4 - .4byte .L1-.LFB1 -.LEFDE1: -EOF - cat > conftest.lit <<EOF - 0000 10000000 00000000 017a0001 781a0004 .........z..x... - 0010 01000000 12000000 18000000 00000000 ................ - 0020 08000000 04080000 0044 .........D -EOF - cat > conftest.big <<EOF - 0000 00000010 00000000 017a0001 781a0004 .........z..x... - 0010 00000001 00000012 00000018 00000000 ................ - 0020 00000008 04000000 0844 .........D -EOF - # If the assembler didn't choke, and we can objdump, - # and we got the correct data, then succeed. - if $gcc_cv_as -o conftest.o conftest.s > /dev/null 2>&1 \ - && $gcc_cv_objdump -s -j .eh_frame conftest.o 2>/dev/null \ - | tail -3 > conftest.got \ - && { cmp conftest.lit conftest.got > /dev/null 2>&1 \ - || cmp conftest.big conftest.got > /dev/null 2>&1; } - then - gcc_cv_as_eh_frame="yes" - else - gcc_cv_as_eh_frame="bad" - if $gcc_cv_as -o conftest.o --traditional-format /dev/null; then - AC_DEFINE(USE_AS_TRADITIONAL_FORMAT, 1, - [Define if your assembler mis-optimizes .eh_frame data.]) - fi - fi - fi - rm -f conftest.* -fi -AC_MSG_RESULT($gcc_cv_as_eh_frame) - -AC_MSG_CHECKING(assembler section merging support) -gcc_cv_as_shf_merge=no -if test x$gcc_cv_gas_major_version != x -a x$gcc_cv_gas_minor_version != x; then - if test "$gcc_cv_gas_major_version" -eq 2 -a "$gcc_cv_gas_minor_version" -ge 12 -o "$gcc_cv_gas_major_version" -gt 2 && grep 'obj_format = elf' ../gas/Makefile > /dev/null; then - gcc_cv_as_shf_merge=yes - fi -elif test x$gcc_cv_as != x; then - # Check if we support SHF_MERGE sections - echo '.section .rodata.str, "aMS", @progbits, 1' > conftest.s - if $gcc_cv_as --fatal-warnings -o conftest.o conftest.s > /dev/null 2>&1; then - gcc_cv_as_shf_merge=yes - fi - rm -f conftest.s conftest.o -fi -if test x"$gcc_cv_as_shf_merge" = xyes; then - AC_DEFINE(HAVE_GAS_SHF_MERGE, 1, -[Define if your assembler supports marking sections with SHF_MERGE flag.]) -fi -AC_MSG_RESULT($gcc_cv_as_shf_merge) - -AC_MSG_CHECKING(assembler thread-local storage support) -gcc_cv_as_tls=no -conftest_s= -tls_first_major= -tls_first_minor= -case "$target" in -changequote(,)dnl - alpha*-*-*) - conftest_s=' - .section ".tdata","awT",@progbits -foo: .long 25 - .text - ldq $27,__tls_get_addr($29) !literal!1 - lda $16,foo($29) !tlsgd!1 - jsr $26,($27),__tls_get_addr !lituse_tlsgd!1 - ldq $27,__tls_get_addr($29) !literal!2 - lda $16,foo($29) !tlsldm!2 - jsr $26,($27),__tls_get_addr !lituse_tlsldm!2 - ldq $1,foo($29) !gotdtprel - ldah $2,foo($29) !dtprelhi - lda $3,foo($2) !dtprello - lda $4,foo($29) !dtprel - ldq $1,foo($29) !gottprel - ldah $2,foo($29) !tprelhi - lda $3,foo($2) !tprello - lda $4,foo($29) !tprel' - tls_first_major=2 - tls_first_minor=13 - ;; - i[34567]86-*-*) -changequote([,])dnl - conftest_s=' - .section ".tdata","awT",@progbits -foo: .long 25 - .text - movl %gs:0, %eax - leal foo@TLSGD(,%ebx,1), %eax - leal foo@TLSLDM(%ebx), %eax - leal foo@DTPOFF(%eax), %edx - movl foo@GOTTPOFF(%ebx), %eax - subl foo@GOTTPOFF(%ebx), %eax - addl foo@GOTNTPOFF(%ebx), %eax - movl foo@INDNTPOFF, %eax - movl $foo@TPOFF, %eax - subl $foo@TPOFF, %eax - leal foo@NTPOFF(%ecx), %eax' - tls_first_major=2 - tls_first_minor=14 - ;; - x86_64-*-*) - conftest_s=' - .section ".tdata","awT",@progbits -foo: .long 25 - .text - movq %fs:0, %rax - leaq foo@TLSGD(%rip), %rdi - leaq foo@TLSLD(%rip), %rdi - leaq foo@DTPOFF(%rax), %rdx - movq foo@GOTTPOFF(%rip), %rax - movq $foo@TPOFF, %rax' - tls_first_major=2 - tls_first_minor=14 - ;; - ia64-*-*) - conftest_s=' - .section ".tdata","awT",@progbits -foo: data8 25 - .text - addl r16 = @ltoff(@dtpmod(foo#)), gp - addl r17 = @ltoff(@dtprel(foo#)), gp - addl r18 = @ltoff(@tprel(foo#)), gp - addl r19 = @dtprel(foo#), gp - adds r21 = @dtprel(foo#), r13 - movl r23 = @dtprel(foo#) - addl r20 = @tprel(foo#), gp - adds r22 = @tprel(foo#), r13 - movl r24 = @tprel(foo#)' - tls_first_major=2 - tls_first_minor=13 - ;; - s390-*-*) - conftest_s=' - .section ".tdata","awT",@progbits -foo: .long 25 - .text - .long foo@TLSGD - .long foo@TLSLDM - .long foo@DTPOFF - .long foo@NTPOFF - .long foo@GOTNTPOFF - .long foo@INDNTPOFF - l %r1,foo@GOTNTPOFF(%r12) - l %r1,0(%r1):tls_load:foo - bas %r14,0(%r1,%r13):tls_gdcall:foo - bas %r14,0(%r1,%r13):tls_ldcall:foo' - tls_first_major=2 - tls_first_minor=14 - ;; - s390x-*-*) - conftest_s=' - .section ".tdata","awT",@progbits -foo: .long 25 - .text - .quad foo@TLSGD - .quad foo@TLSLDM - .quad foo@DTPOFF - .quad foo@NTPOFF - .quad foo@GOTNTPOFF - lg %r1,foo@GOTNTPOFF(%r12) - larl %r1,foo@INDNTPOFF - brasl %r14,__tls_get_offset@PLT:tls_gdcall:foo - brasl %r14,__tls_get_offset@PLT:tls_ldcall:foo' - tls_first_major=2 - tls_first_minor=14 - ;; -esac -if test -z "$tls_first_major"; then - : -elif test x$gcc_cv_gas_major_version != x -a x$gcc_cv_gas_minor_version != x -then - if test "$gcc_cv_gas_major_version" -eq "$tls_first_major" \ - -a "$gcc_cv_gas_minor_version" -ge "$tls_first_minor" \ - -o "$gcc_cv_gas_major_version" -gt "$tls_first_major"; then - gcc_cv_as_tls=yes - fi -elif test x$gcc_cv_as != x; then - echo "$conftest_s" > conftest.s - if $gcc_cv_as --fatal-warnings -o conftest.o conftest.s > /dev/null 2>&1 - then - gcc_cv_as_tls=yes - fi - rm -f conftest.s conftest.o -fi -if test "$gcc_cv_as_tls" = yes; then - AC_DEFINE(HAVE_AS_TLS, 1, - [Define if your assembler supports thread-local storage.]) -fi -AC_MSG_RESULT($gcc_cv_as_tls) - -case "$target" in - # All TARGET_ABI_OSF targets. - alpha*-*-osf* | alpha*-*-linux* | alpha*-*-*bsd*) - AC_CACHE_CHECK([assembler supports explicit relocations], - gcc_cv_as_explicit_relocs, [ - gcc_cv_as_explicit_relocs=unknown - if test x$gcc_cv_gas_major_version != x \ - -a x$gcc_cv_gas_minor_version != x - then - if test "$gcc_cv_gas_major_version" -eq 2 \ - -a "$gcc_cv_gas_minor_version" -ge 12 \ - -o "$gcc_cv_gas_major_version" -gt 2; then - gcc_cv_as_explicit_relocs=yes - fi - elif test x$gcc_cv_as != x; then - cat > conftest.s << 'EOF' - .set nomacro - .text - extbl $3, $2, $3 !lituse_bytoff!1 - ldq $2, a($29) !literal!1 - ldq $4, b($29) !literal!2 - ldq_u $3, 0($2) !lituse_base!1 - ldq $27, f($29) !literal!5 - jsr $26, ($27), f !lituse_jsr!5 - ldah $29, 0($26) !gpdisp!3 - lda $0, c($29) !gprel - ldah $1, d($29) !gprelhigh - lda $1, d($1) !gprellow - lda $29, 0($29) !gpdisp!3 -EOF - if $gcc_cv_as -o conftest.o conftest.s > /dev/null 2>&1; then - gcc_cv_as_explicit_relocs=yes - else - gcc_cv_as_explicit_relocs=no - fi - rm -f conftest.s conftest.o - fi - ]) - if test "x$gcc_cv_as_explicit_relocs" = xyes; then - AC_DEFINE(HAVE_AS_EXPLICIT_RELOCS, 1, - [Define if your assembler supports explicit relocations.]) - fi - ;; - sparc*-*-*) - AC_CACHE_CHECK([assembler .register pseudo-op support], - gcc_cv_as_register_pseudo_op, [ - gcc_cv_as_register_pseudo_op=unknown - if test x$gcc_cv_as != x; then - # Check if we have .register - echo ".register %g2, #scratch" > conftest.s - if $gcc_cv_as -o conftest.o conftest.s > /dev/null 2>&1; then - gcc_cv_as_register_pseudo_op=yes - else - gcc_cv_as_register_pseudo_op=no - fi - rm -f conftest.s conftest.o - fi - ]) - if test "x$gcc_cv_as_register_pseudo_op" = xyes; then - AC_DEFINE(HAVE_AS_REGISTER_PSEUDO_OP, 1, - [Define if your assembler supports .register.]) - fi - - AC_CACHE_CHECK([assembler supports -relax], - gcc_cv_as_relax_opt, [ - gcc_cv_as_relax_opt=unknown - if test x$gcc_cv_as != x; then - # Check if gas supports -relax - echo ".text" > conftest.s - if $gcc_cv_as -relax -o conftest.o conftest.s > /dev/null 2>&1; then - gcc_cv_as_relax_opt=yes - else - gcc_cv_as_relax_opt=no - fi - rm -f conftest.s conftest.o - fi - ]) - if test "x$gcc_cv_as_relax_opt" = xyes; then - AC_DEFINE(HAVE_AS_RELAX_OPTION, 1, - [Define if your assembler supports -relax option.]) - fi - - AC_CACHE_CHECK([assembler and linker support unaligned pc related relocs], - gcc_cv_as_sparc_ua_pcrel, [ - gcc_cv_as_sparc_ua_pcrel=unknown - if test x$gcc_cv_as != x -a x$gcc_cv_ld != x; then - gcc_cv_as_sparc_ua_pcrel=no - echo ".text; foo: nop; .data; .align 4; .byte 0; .uaword %r_disp32(foo)" > conftest.s - if $gcc_cv_as -K PIC -o conftest.o conftest.s > /dev/null 2>&1 \ - && $gcc_cv_ld -o conftest conftest.o -G > /dev/null 2>&1; then - gcc_cv_as_sparc_ua_pcrel=yes - fi - rm -f conftest.s conftest.o conftest - fi - ]) - if test "x$gcc_cv_as_sparc_ua_pcrel" = xyes; then - AC_DEFINE(HAVE_AS_SPARC_UA_PCREL, 1, - [Define if your assembler and linker support unaligned PC relative relocs.]) - fi - - AC_CACHE_CHECK([assembler and linker support unaligned pc related relocs against hidden symbols], - gcc_cv_as_sparc_ua_pcrel_hidden, [ - if test "x$gcc_cv_as_sparc_ua_pcrel" = xyes; then - gcc_cv_as_sparc_ua_pcrel_hidden=unknown - if test x$gcc_cv_objdump != x; then - gcc_cv_as_sparc_ua_pcrel_hidden=no - echo ".data; .align 4; .byte 0x31; .uaword %r_disp32(foo)" > conftest.s - echo ".byte 0x32, 0x33, 0x34; .global foo; .hidden foo" >> conftest.s - echo "foo: .skip 4" >> conftest.s - if $gcc_cv_as -K PIC -o conftest.o conftest.s > /dev/null 2>&1 \ - && $gcc_cv_ld -o conftest conftest.o -G > /dev/null 2>&1 \ - && $gcc_cv_objdump -s -j .data conftest 2> /dev/null \ - | grep ' 31000000 07323334' > /dev/null 2>&1; then - if $gcc_cv_objdump -R conftest 2> /dev/null \ - | grep 'DISP32' > /dev/null 2>&1; then - : - else - gcc_cv_as_sparc_ua_pcrel_hidden=yes - fi - fi - fi - rm -f conftest.s conftest.o conftest - else - gcc_cv_as_sparc_ua_pcrel_hidden="$gcc_cv_as_sparc_ua_pcrel" - fi - ]) - if test "x$gcc_cv_as_sparc_ua_pcrel_hidden" = xyes; then - AC_DEFINE(HAVE_AS_SPARC_UA_PCREL_HIDDEN, 1, - [Define if your assembler and linker support unaligned PC relative relocs against hidden symbols.]) - fi - - AC_CACHE_CHECK([for assembler offsetable %lo() support], - gcc_cv_as_offsetable_lo10, [ - gcc_cv_as_offsetable_lo10=unknown - if test "x$gcc_cv_as" != x; then - # Check if assembler has offsetable %lo() - echo "or %g1, %lo(ab) + 12, %g1" > conftest.s - echo "or %g1, %lo(ab + 12), %g1" > conftest1.s - if $gcc_cv_as -xarch=v9 -o conftest.o conftest.s \ - > /dev/null 2>&1 && - $gcc_cv_as -xarch=v9 -o conftest1.o conftest1.s \ - > /dev/null 2>&1; then - if cmp conftest.o conftest1.o > /dev/null 2>&1; then - gcc_cv_as_offsetable_lo10=no - else - gcc_cv_as_offsetable_lo10=yes - fi - else - gcc_cv_as_offsetable_lo10=no - fi - rm -f conftest.s conftest.o conftest1.s conftest1.o - fi - ]) - if test "x$gcc_cv_as_offsetable_lo10" = xyes; then - AC_DEFINE(HAVE_AS_OFFSETABLE_LO10, 1, - [Define if your assembler supports offsetable %lo().]) - fi - - ;; - -changequote(,)dnl - i[34567]86-*-* | x86_64-*-*) -changequote([,])dnl - AC_MSG_CHECKING(assembler instructions) - gcc_cv_as_instructions= - if test x$gcc_cv_gas_major_version != x -a x$gcc_cv_gas_minor_version != x; then - if test "$gcc_cv_gas_major_version" -eq 2 -a "$gcc_cv_gas_minor_version" -ge 9 -o "$gcc_cv_gas_major_version" -gt 2; then - gcc_cv_as_instructions="filds fists" - fi - elif test x$gcc_cv_as != x; then - set "filds fists" "filds mem; fists mem" - while test $# -gt 0 - do - echo "$2" > conftest.s - if $gcc_cv_as -o conftest.o conftest.s > /dev/null 2>&1; then - gcc_cv_as_instructions=${gcc_cv_as_instructions}$1" " - fi - shift 2 - done - rm -f conftest.s conftest.o - fi - if test x"$gcc_cv_as_instructions" != x; then - AC_DEFINE_UNQUOTED(HAVE_GAS_`echo "$gcc_cv_as_instructions" | sed -e 's/ $//' | tr '[a-z ]' '[A-Z_]'`) - fi - AC_MSG_RESULT($gcc_cv_as_instructions) - - AC_MSG_CHECKING(cmov syntax) - gcc_cv_as_ix86_cmov_sun_syntax=no - if test x$gcc_cv_as != x; then - echo 'cmovl.l %edx, %eax' > conftest.s - if $gcc_cv_as -o conftest.o conftest.s > /dev/null 2>&1; then - gcc_cv_as_ix86_cmov_sun_syntax=yes - fi - rm -f conftest.s conftest.o - fi - if test "x$gcc_cv_as_ix86_cmov_sun_syntax" = xyes; then - AC_DEFINE(HAVE_AS_IX86_CMOV_SUN_SYNTAX, 1, - [Define if your assembler supports the Sun syntax for cmov.]) - fi - AC_MSG_RESULT($gcc_cv_as_ix86_cmov_sun_syntax) - - AC_MSG_CHECKING(assembler GOTOFF in data directives) - gcc_cv_as_gotoff_in_data=no - if test x$gcc_cv_gas_major_version != x -a x$gcc_cv_gas_minor_version != x - then - if test "$gcc_cv_gas_major_version" -eq 2 \ - -a "$gcc_cv_gas_minor_version" -ge 11 \ - -o "$gcc_cv_gas_major_version" -gt 2; then - gcc_cv_as_gotoff_in_data=yes - fi - elif test x$gcc_cv_as != x; then - cat > conftest.s <<EOF - .text -.L0: - nop - .data - .long .L0@GOTOFF -EOF - if $gcc_cv_as -o conftest.o conftest.s > /dev/null 2>&1; then - gcc_cv_as_gotoff_in_data=yes - fi - fi - AC_DEFINE_UNQUOTED(HAVE_AS_GOTOFF_IN_DATA, - [`if test $gcc_cv_as_gotoff_in_data = yes; then echo 1; else echo 0; fi`], - [Define true if the assembler supports '.long foo@GOTOFF'.]) - AC_MSG_RESULT($gcc_cv_as_gotoff_in_data) - ;; - - ia64*-*-*) - AC_CACHE_CHECK([assembler supports ltoffx and ldxmov], - gcc_cv_as_ltoffx_ldxmov_relocs, [ - gcc_cv_as_ltoffx_ldxmov_relocs=unknown - if test x$gcc_cv_gas_major_version != x \ - -a x$gcc_cv_gas_minor_version != x - then - if test "$gcc_cv_gas_major_version" -eq 2 \ - -a "$gcc_cv_gas_minor_version" -ge 14 \ - -o "$gcc_cv_gas_major_version" -gt 2; then - gcc_cv_as_ltoffx_ldxmov_relocs=yes - fi - elif test x$gcc_cv_as != x; then - cat > conftest.s << 'EOF' -changequote(,)dnl - .text - addl r15 = @ltoffx(x#), gp - ;; - ld8.mov r16 = [r15], x# -EOF -changequote([,])dnl - if $gcc_cv_as -o conftest.o conftest.s > /dev/null 2>&1; then - gcc_cv_as_ltoffx_ldxmov_relocs=yes - else - gcc_cv_as_ltoffx_ldxmov_relocs=no - fi - rm -f conftest.s conftest.o - fi - ]) - if test "x$gcc_cv_as_ltoffx_ldxmov_relocs" = xyes; then - AC_DEFINE(HAVE_AS_LTOFFX_LDXMOV_RELOCS, 1, - [Define if your assembler supports ltoffx and ldxmov relocations.]) - fi - ;; -esac - -AC_MSG_CHECKING(assembler dwarf2 debug_line support) -gcc_cv_as_dwarf2_debug_line=no -# ??? Not all targets support dwarf2 debug_line, even within a version -# of gas. Moreover, we need to emit a valid instruction to trigger any -# info to the output file. So, as supported targets are added to gas 2.11, -# add some instruction here to (also) show we expect this might work. -# ??? Once 2.11 is released, probably need to add first known working -# version to the per-target configury. -case "$target" in - i?86*-*-* | mips*-*-* | alpha*-*-* | powerpc*-*-* | sparc*-*-* | m68*-*-* \ - | x86_64*-*-* | hppa*-*-* | arm*-*-* | strongarm*-*-* | xscale*-*-*) - insn="nop" - ;; - ia64*-*-*) - insn="nop 0" - ;; - esac -if test x$gcc_cv_gas_major_version != x -a x$gcc_cv_gas_minor_version != x; -then - if test "$gcc_cv_gas_major_version" -eq 2 \ - -a "$gcc_cv_gas_minor_version" -ge 11 \ - -o "$gcc_cv_gas_major_version" -gt 2 \ - && grep 'obj_format = elf' ../gas/Makefile > /dev/null \ - && test x"$insn" != x ; then - gcc_cv_as_dwarf2_debug_line="yes" - fi -elif test x$gcc_cv_as != x -a x"$insn" != x ; then - echo ' .file 1 "conftest.s"' > conftest.s - echo ' .loc 1 3 0' >> conftest.s - echo " $insn" >> conftest.s - # ??? This fails with non-gnu grep. - if $gcc_cv_as -o conftest.o conftest.s > /dev/null 2>&1 \ - && grep debug_line conftest.o > /dev/null 2>&1 ; then - # The .debug_line file table must be in the exact order that - # we specified the files, since these indices are also used - # by DW_AT_decl_file. Approximate this test by testing if - # the assembler bitches if the same index is assigned twice. - echo ' .file 1 "foo.s"' > conftest.s - echo ' .file 1 "bar.s"' >> conftest.s - if $gcc_cv_as -o conftest.o conftest.s > /dev/null 2>&1 - then - gcc_cv_as_dwarf2_debug_line="no" - else - gcc_cv_as_dwarf2_debug_line="yes" - fi - fi - rm -f conftest.s conftest.o conftest.nm1 conftest.nm2 -fi -if test x"$gcc_cv_as_dwarf2_debug_line" = xyes; then - AC_DEFINE(HAVE_AS_DWARF2_DEBUG_LINE, 1, -[Define if your assembler supports dwarf2 .file/.loc directives, - and preserves file table indices exactly as given.]) -fi -AC_MSG_RESULT($gcc_cv_as_dwarf2_debug_line) - -AC_MSG_CHECKING(assembler --gdwarf2 support) -gcc_cv_as_gdwarf2_flag=no -if test x$gcc_cv_gas_major_version != x -a x$gcc_cv_gas_minor_version != x; -then - if test "$gcc_cv_gas_major_version" -eq 2 \ - -a "$gcc_cv_gas_minor_version" -ge 11 \ - -o "$gcc_cv_gas_major_version" -gt 2 \ - && grep 'obj_format = elf' ../gas/Makefile > /dev/null \ - && test x"$insn" != x ; then - gcc_cv_as_gdwarf2_flag="yes" - fi -elif test x$gcc_cv_as != x -a x"$insn" != x ; then - echo '' > conftest.s - # ??? This fails with non-gnu grep. - if $gcc_cv_as --gdwarf2 -o conftest.o conftest.s > /dev/null 2>&1 - then - gcc_cv_as_gdwarf2_flag="yes" - fi - rm -f conftest.s conftest.o -fi -if test x"$gcc_cv_as_gdwarf2_flag" = xyes; then - AC_DEFINE(HAVE_AS_GDWARF2_DEBUG_FLAG, 1, -[Define if your assembler supports the --gdwarf2 option.]) -fi -AC_MSG_RESULT($gcc_cv_as_gdwarf2_flag) - -AC_MSG_CHECKING(assembler --gstabs support) -gcc_cv_as_gstabs_flag=no -if test x$gcc_cv_gas_major_version != x -a x$gcc_cv_gas_minor_version != x; -then - if test "$gcc_cv_gas_major_version" -eq 2 \ - -a "$gcc_cv_gas_minor_version" -ge 11 \ - -o "$gcc_cv_gas_major_version" -gt 2 \ - && grep 'obj_format = elf' ../gas/Makefile > /dev/null \ - && test x"$insn" != x ; then - gcc_cv_as_gstabs_flag="yes" - fi -elif test x$gcc_cv_as != x -a x"$insn" != x ; then - echo '' > conftest.s - # ??? This fails with non-gnu grep. - if $gcc_cv_as --gstabs -o conftest.o conftest.s > /dev/null 2>&1 ; then - gcc_cv_as_gstabs_flag="yes" - # The native Solaris 9/Intel assembler doesn't understand --gstabs - # and warns about it, but still exits successfully. So check for - # this. - if $gcc_cv_as --gstabs -o conftest.o conftest.s 2>&1 | \ - grep -i warning > /dev/null ; then - gcc_cv_as_gstabs_flag="no" - fi - fi - rm -f conftest.s conftest.o -fi -if test x"$gcc_cv_as_gstabs_flag" = xyes; then - AC_DEFINE(HAVE_AS_GSTABS_DEBUG_FLAG, 1, -[Define if your assembler supports the --gstabs option.]) -fi -AC_MSG_RESULT($gcc_cv_as_gstabs_flag) - -AC_MSG_CHECKING(linker read-only and read-write section mixing) -gcc_cv_ld_ro_rw_mix=unknown -if test x$gcc_cv_gld_major_version != x -a x$gcc_cv_gld_minor_version != x; then - if test "$gcc_cv_gld_major_version" -eq 2 -a "$gcc_cv_gld_minor_version" -ge 10 -o "$gcc_cv_gld_major_version" -gt 2 && grep 'EMUL = elf' ../ld/Makefile > /dev/null; then - gcc_cv_ld_ro_rw_mix=read-write - fi -elif test x$gcc_cv_as != x -a x$gcc_cv_ld != x -a x$gcc_cv_objdump != x ; then - echo '.section myfoosect, "a"' > conftest1.s - echo '.section myfoosect, "aw"' > conftest2.s - echo '.byte 1' >> conftest2.s - echo '.section myfoosect, "a"' > conftest3.s - echo '.byte 0' >> conftest3.s - if $gcc_cv_as -o conftest1.o conftest1.s > /dev/null 2>&1 \ - && $gcc_cv_as -o conftest2.o conftest2.s > /dev/null 2>&1 \ - && $gcc_cv_as -o conftest3.o conftest3.s > /dev/null 2>&1 \ - && $gcc_cv_ld -shared -o conftest1.so conftest1.o \ - conftest2.o conftest3.o > /dev/null 2>&1; then - gcc_cv_ld_ro_rw_mix=`$gcc_cv_objdump -h conftest1.so \ - | sed -e '/myfoosect/!d' -e N` - if echo "$gcc_cv_ld_ro_rw_mix" | grep CONTENTS > /dev/null; then - if echo "$gcc_cv_ld_ro_rw_mix" | grep READONLY > /dev/null; then - gcc_cv_ld_ro_rw_mix=read-only - else - gcc_cv_ld_ro_rw_mix=read-write - fi - fi - fi -changequote(,)dnl - rm -f conftest.* conftest[123].* -changequote([,])dnl -fi -if test x$gcc_cv_ld_ro_rw_mix = xread-write; then - AC_DEFINE(HAVE_LD_RO_RW_SECTION_MIXING, 1, - [Define if your linker links a mix of read-only - and read-write sections into a read-write section.]) -fi -AC_MSG_RESULT($gcc_cv_ld_ro_rw_mix) - -AC_MSG_CHECKING(linker PT_GNU_EH_FRAME support) -gcc_cv_ld_eh_frame_hdr=no -if test x$gcc_cv_gld_major_version != x -a x$gcc_cv_gld_minor_version != x; then - if test "$gcc_cv_gld_major_version" -eq 2 -a "$gcc_cv_gld_minor_version" -ge 12 -o "$gcc_cv_gld_major_version" -gt 2 && grep 'EMUL = elf' ../ld/Makefile > /dev/null; then - gcc_cv_ld_eh_frame_hdr=yes - fi -elif test x$gcc_cv_ld != x; then - # Check if linker supports --eh-frame-hdr option - if $gcc_cv_ld --help 2>/dev/null | grep eh-frame-hdr > /dev/null; then - gcc_cv_ld_eh_frame_hdr=yes - fi -fi -if test x"$gcc_cv_ld_eh_frame_hdr" = xyes; then - AC_DEFINE(HAVE_LD_EH_FRAME_HDR, 1, -[Define if your linker supports --eh-frame-hdr option.]) -fi -AC_MSG_RESULT($gcc_cv_ld_eh_frame_hdr) - -# Miscellaneous target-specific checks. -case "$target" in - mips*-*-*) - AC_MSG_CHECKING(whether libgloss uses STARTUP directives consistently) - gcc_cv_mips_libgloss_startup=no - gcc_cv_libgloss_srcdir=`echo $srcdir | sed -e 's,/gcc$,,'`/libgloss - if test "x$exec_prefix" = xNONE; then - if test "x$prefix" = xNONE; then - test_prefix=/usr/local - else - test_prefix=$prefix - fi - else - test_prefix=$exec_prefix - fi - for f in $gcc_cv_libgloss_srcdir/mips/idt.ld $test_prefix/$target_alias/lib/idt.ld - do - if grep '^STARTUP' $f > /dev/null 2>&1; then - gcc_cv_mips_libgloss_startup=yes - break - fi - done - if test x"$gcc_cv_mips_libgloss_startup" = xyes; then - AC_DEFINE(HAVE_MIPS_LIBGLOSS_STARTUP_DIRECTIVES, 1, - [Define if your MIPS libgloss linker scripts consistently include STARTUP directives.]) - fi - AC_MSG_RESULT($gcc_cv_mips_libgloss_startup) - ;; -esac - -if test "$prefix" != "/usr" && test "x$prefix" != "x$local_prefix" ; then - AC_DEFINE_UNQUOTED(PREFIX_INCLUDE_DIR, "$prefix/include") -fi - -# Figure out what language subdirectories are present. -# Look if the user specified --enable-languages="..."; if not, use -# the environment variable $LANGUAGES if defined. $LANGUAGES might -# go away some day. -# NB: embedded tabs in this IF block -- do not untabify -if test x"${enable_languages+set}" != xset; then - if test x"${LANGUAGES+set}" = xset; then - enable_languages="${LANGUAGES}" - AC_MSG_WARN([setting LANGUAGES is deprecated, use --enable-languages instead]) - - else - enable_languages=all - fi -else - if test x"${enable_languages}" = x \ - || test x"${enable_languages}" = xyes; - then - AC_MSG_ERROR([--enable-languages needs at least one language argument]) - fi -fi -enable_languages=`echo "${enable_languages}" | sed -e 's/[[ ,]][[ ,]]*/,/g' -e 's/,$//'` - -# First scan to see if an enabled language requires some other language. -# We assume that a given config-lang.in will list all the language -# front ends it requires, even if some are required indirectly. -for lang in ${srcdir}/*/config-lang.in .. -do - case $lang in - ..) - ;; - # The odd quoting in the next line works around - # an apparent bug in bash 1.12 on linux. -changequote(,)dnl - ${srcdir}/[*]/config-lang.in) - ;; - *) - lang_alias=`sed -n -e 's,^language=['"'"'"'"]\(.*\)["'"'"'"'].*$,\1,p' -e 's,^language=\([^ ]*\).*$,\1,p' $lang` - this_lang_requires=`sed -n -e 's,^lang_requires=['"'"'"'"]\(.*\)["'"'"'"'].*$,\1,p' -e 's,^lang_requires=\([^ ]*\).*$,\1,p' $lang` - for other in $this_lang_requires - do - case ,${enable_languages}, in - *,$other,*) - ;; - *,all,*) - ;; - *,$lang_alias,*) - enable_languages="$enable_languages,$other" - ;; - esac - done - ;; -changequote([,])dnl - esac -done - -expected_languages=`echo ,${enable_languages}, | sed -e 's:,: :g' -e 's: *: :g' -e 's: *: :g' -e 's:^ ::' -e 's: $::'` -found_languages= -subdirs= -for lang in ${srcdir}/*/config-lang.in .. -do - case $lang in - ..) ;; - # The odd quoting in the next line works around - # an apparent bug in bash 1.12 on linux. -changequote(,)dnl - ${srcdir}/[*]/config-lang.in) ;; - *) - lang_alias=`sed -n -e 's,^language=['"'"'"'"]\(.*\)["'"'"'"'].*$,\1,p' -e 's,^language=\([^ ]*\).*$,\1,p' $lang` - this_lang_libs=`sed -n -e 's,^target_libs=['"'"'"'"]\(.*\)["'"'"'"'].*$,\1,p' -e 's,^target_libs=\([^ ]*\).*$,\1,p' $lang` - build_by_default=`sed -n -e 's,^build_by_default=['"'"'"'"]\(.*\)["'"'"'"'].*$,\1,p' -e 's,^build_by_default=\([^ ]*\).*$,\1,p' $lang` - if test "x$lang_alias" = x - then - echo "$lang doesn't set \$language." 1>&2 - exit 1 - fi - case ${build_by_default},${enable_languages}, in - *,$lang_alias,*) add_this_lang=yes ;; - no,*) add_this_lang=no ;; - *,all,*) add_this_lang=yes ;; - *) add_this_lang=no ;; - esac - found_languages="${found_languages} ${lang_alias}" - if test x"${add_this_lang}" = xyes; then - case $lang in - ${srcdir}/ada/config-lang.in) - if test x$have_gnat = xyes ; then - subdirs="$subdirs `echo $lang | sed -e 's,^.*/\([^/]*\)/config-lang.in$,\1,'`" - fi - ;; - *) - subdirs="$subdirs `echo $lang | sed -e 's,^.*/\([^/]*\)/config-lang.in$,\1,'`" - ;; - esac - fi - ;; -changequote([,])dnl - esac -done - -missing_languages= -for expected_language in ${expected_languages} .. -do - if test "${expected_language}" != ..; then - missing_language="${expected_language}" - if test "${expected_language}" = "c" \ - || test "${expected_language}" = "all"; then - missing_language= - fi - for found_language in ${found_languages} .. - do - if test "${found_language}" != ..; then - if test "${expected_language}" = "${found_language}"; then - missing_language= - fi - fi - done - if test "x${missing_language}" != x; then - missing_languages="${missing_languages} ${missing_language}" - fi - fi -done - -if test "x$missing_languages" != x; then - AC_MSG_ERROR([ -The following requested languages were not found:${missing_languages} -The following languages were available: c${found_languages}]) -fi - -# Make gthr-default.h if we have a thread file. -gthread_flags= -if test $thread_file != single; then - rm -f gthr-default.h - echo "#include \"gthr-${thread_file}.h\"" > gthr-default.h - gthread_flags=-DHAVE_GTHR_DEFAULT -fi -AC_SUBST(gthread_flags) - -# Find out what GC implementation we want, or may, use. -AC_ARG_WITH(gc, -[ --with-gc={simple,page} choose the garbage collection mechanism to use - with the compiler], -[case "$withval" in - simple | page) - GGC=ggc-$withval - ;; - *) - AC_MSG_ERROR([$withval is an invalid option to --with-gc]) - ;; -esac], -[GGC=ggc-page]) -AC_SUBST(GGC) -echo "Using $GGC for garbage collection." - -# Use the system's zlib library. -zlibdir=-L../zlib -zlibinc="-I\$(srcdir)/../zlib" -AC_ARG_WITH(system-zlib, -[ --with-system-zlib use installed libz], -zlibdir= -zlibinc= -) -AC_SUBST(zlibdir) -AC_SUBST(zlibinc) - -dnl Very limited version of automake's enable-maintainer-mode - -AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles]) - dnl maintainer-mode is disabled by default - AC_ARG_ENABLE(maintainer-mode, -[ --enable-maintainer-mode - enable make rules and dependencies not useful - (and sometimes confusing) to the casual installer], - maintainer_mode=$enableval, - maintainer_mode=no) - -AC_MSG_RESULT($maintainer_mode) - -if test "$maintainer_mode" = "yes"; then - MAINT='' -else - MAINT='#' -fi -AC_SUBST(MAINT)dnl - -# Make empty files to contain the specs and options for each language. -# Then add #include lines to for a compiler that has specs and/or options. - -lang_specs_files= -lang_options_files= -lang_tree_files= -for subdir in . $subdirs -do - if test -f $srcdir/$subdir/lang-specs.h; then - lang_specs_files="$lang_specs_files $srcdir/$subdir/lang-specs.h" - fi - if test -f $srcdir/$subdir/lang-options.h; then - lang_options_files="$lang_options_files $srcdir/$subdir/lang-options.h" - fi - if test -f $srcdir/$subdir/$subdir-tree.def; then - lang_tree_files="$lang_tree_files $srcdir/$subdir/$subdir-tree.def" - fi -done - -# These (without "all_") are set in each config-lang.in. -# `language' must be a single word so is spelled singularly. -all_languages= -all_boot_languages= -all_compilers= -all_stagestuff= -all_outputs='Makefile intl/Makefile fixinc/Makefile gccbug mklibgcc mkheaders' -# List of language makefile fragments. -all_lang_makefiles= -# Files for gengtype -all_gtfiles="$target_gtfiles" -# Files for gengtype with language -all_gtfiles_files_langs= -all_gtfiles_files_files= - -# Add the language fragments. -# Languages are added via two mechanisms. Some information must be -# recorded in makefile variables, these are defined in config-lang.in. -# We accumulate them and plug them into the main Makefile. -# The other mechanism is a set of hooks for each of the main targets -# like `clean', `install', etc. - -language_fragments="Make-lang" -language_hooks="Make-hooks" - -for s in .. $subdirs -do - if test $s != ".." - then - language= - boot_language= - compilers= - stagestuff= - outputs= - gtfiles= - . ${srcdir}/$s/config-lang.in - if test "x$language" = x - then - echo "${srcdir}/$s/config-lang.in doesn't set \$language." 1>&2 - exit 1 - fi - all_lang_makefiles="$all_lang_makefiles ${srcdir}/$s/Make-lang.in" - if test -f ${srcdir}/$s/Makefile.in - then all_lang_makefiles="$all_lang_makefiles ${srcdir}/$s/Makefile.in" - fi - all_languages="$all_languages $language" - if test "x$boot_language" = xyes - then - all_boot_languages="$all_boot_languages $language" - fi - all_compilers="$all_compilers $compilers" - all_stagestuff="$all_stagestuff $stagestuff" - all_outputs="$all_outputs $outputs" - all_gtfiles="$all_gtfiles $gtfiles" - for f in .. $gtfiles - do - if test $f != ".." - then - all_gtfiles_files_langs="$all_gtfiles_files_langs ${s} " - all_gtfiles_files_files="$all_gtfiles_files_files ${f} " - fi - done - fi -done - -# Pick up gtfiles for c -gtfiles= -s="c" -. ${srcdir}/c-config-lang.in -all_gtfiles="$all_gtfiles $gtfiles" -for f in .. $gtfiles -do - if test $f != ".." - then - all_gtfiles_files_langs="$all_gtfiles_files_langs ${s} " - all_gtfiles_files_files="$all_gtfiles_files_files ${f} " - fi -done - -check_languages= -for language in .. $all_languages -do - if test $language != ".." - then - check_languages="$check_languages check-$language" - fi -done - -# Since we can't use `::' targets, we link each language in -# with a set of hooks, reached indirectly via lang.${target}. - -rm -f Make-hooks -touch Make-hooks -target_list="all.build all.cross start.encap rest.encap \ - info dvi generated-manpages \ - install-normal install-common install-info install-man \ - uninstall \ - mostlyclean clean distclean extraclean maintainer-clean \ - stage1 stage2 stage3 stage4" -for t in $target_list -do - x= - for lang in .. $all_languages - do - if test $lang != ".."; then - x="$x $lang.$t" - fi - done - echo "lang.$t: $x" >> Make-hooks -done - -# Create .gdbinit. - -echo "dir ." > .gdbinit -echo "dir ${srcdir}" >> .gdbinit -if test x$gdb_needs_out_file_path = xyes -then - echo "dir ${srcdir}/config/"`dirname ${out_file}` >> .gdbinit -fi -if test "x$subdirs" != x; then - for s in $subdirs - do - echo "dir ${srcdir}/$s" >> .gdbinit - done -fi -echo "source ${srcdir}/gdbinit.in" >> .gdbinit - -# Define variables host_canonical and build_canonical -# because some Cygnus local changes in the Makefile depend on them. -build_canonical=${build} -host_canonical=${host} -target_subdir= -if test "${host}" != "${target}" ; then - target_subdir=${target_alias}/ -fi -AC_SUBST(build_canonical) -AC_SUBST(host_canonical) -AC_SUBST(target_subdir) - -# If $(exec_prefix) exists and is not the same as $(prefix), then compute an -# absolute path for gcc_tooldir based on inserting the number of up-directory -# movements required to get from $(exec_prefix) to $(prefix) into the basic -# $(libsubdir)/@(unlibsubdir) based path. -# Don't set gcc_tooldir to tooldir since that's only passed in by the toplevel -# make and thus we'd get different behavior depending on where we built the -# sources. -if test x$exec_prefix = xNONE -o x$exec_prefix = x$prefix; then - gcc_tooldir='$(libsubdir)/$(unlibsubdir)/../$(target_alias)' -else -changequote(<<, >>)dnl -# An explanation of the sed strings: -# -e 's|^\$(prefix)||' matches and eliminates 'prefix' from 'exec_prefix' -# -e 's|/$||' match a trailing forward slash and eliminates it -# -e 's|^[^/]|/|' forces the string to start with a forward slash (*) -# -e 's|/[^/]*|../|g' replaces each occurrence of /<directory> with ../ -# -# (*) Note this pattern overwrites the first character of the string -# with a forward slash if one is not already present. This is not a -# problem because the exact names of the sub-directories concerned is -# unimportant, just the number of them matters. -# -# The practical upshot of these patterns is like this: -# -# prefix exec_prefix result -# ------ ----------- ------ -# /foo /foo/bar ../ -# /foo/ /foo/bar ../ -# /foo /foo/bar/ ../ -# /foo/ /foo/bar/ ../ -# /foo /foo/bar/ugg ../../ -# - dollar='$$' - gcc_tooldir="\$(libsubdir)/\$(unlibsubdir)/\`echo \$(exec_prefix) | sed -e 's|^\$(prefix)||' -e 's|/\$(dollar)||' -e 's|^[^/]|/|' -e 's|/[^/]*|../|g'\`\$(target_alias)" -changequote([, ])dnl -fi -AC_SUBST(gcc_tooldir) -AC_SUBST(dollar) - -# Find a directory in which to install a shared libgcc. - -AC_ARG_ENABLE(version-specific-runtime-libs, -[ --enable-version-specific-runtime-libs - specify that runtime libraries should be - installed in a compiler-specific directory]) - -AC_ARG_WITH(slibdir, -[ --with-slibdir=DIR shared libraries in DIR [LIBDIR]], -slibdir="$with_slibdir", -if test "${enable_version_specific_runtime_libs+set}" = set; then - slibdir='$(libsubdir)' -elif test "$host" != "$target"; then - slibdir='$(build_tooldir)/lib' -else - slibdir='$(libdir)' -fi) -AC_SUBST(slibdir) - -objdir=`${PWDCMD-pwd}` -AC_SUBST(objdir) - -# Process the language and host/target makefile fragments. -${CONFIG_SHELL-/bin/sh} $srcdir/configure.frag $srcdir "$subdirs" "$dep_host_xmake_file" "$dep_tmake_file" - -# Substitute configuration variables -AC_SUBST(subdirs) -AC_SUBST(srcdir) -AC_SUBST(all_boot_languages) -AC_SUBST(all_compilers) -AC_SUBST(all_gtfiles) -AC_SUBST(all_gtfiles_files_langs) -AC_SUBST(all_gtfiles_files_files) -AC_SUBST(all_lang_makefiles) -AC_SUBST(all_languages) -AC_SUBST(all_stagestuff) -AC_SUBST(build_exeext) -AC_SUBST(build_install_headers_dir) -AC_SUBST(build_xm_file_list) -AC_SUBST(build_xm_file) -AC_SUBST(build_xm_defines) -AC_SUBST(check_languages) -AC_SUBST(cc_set_by_configure) -AC_SUBST(quoted_cc_set_by_configure) -AC_SUBST(cpp_install_dir) -AC_SUBST(dep_host_xmake_file) -AC_SUBST(dep_tmake_file) -AC_SUBST(extra_headers_list) -AC_SUBST(extra_objs) -AC_SUBST(extra_parts) -AC_SUBST(extra_passes) -AC_SUBST(extra_programs) -AC_SUBST(float_h_file) -AC_SUBST(gcc_config_arguments) -AC_SUBST(gcc_gxx_include_dir) -AC_SUBST(libstdcxx_incdir) -AC_SUBST(gcc_version) -AC_SUBST(gcc_version_full) -AC_SUBST(gcc_version_trigger) -AC_SUBST(host_exeext) -AC_SUBST(host_extra_gcc_objs) -AC_SUBST(host_xm_file_list) -AC_SUBST(host_xm_file) -AC_SUBST(host_xm_defines) -AC_SUBST(install) -AC_SUBST(lang_options_files) -AC_SUBST(lang_specs_files) -AC_SUBST(lang_tree_files) -AC_SUBST(local_prefix) -AC_SUBST(md_file) -AC_SUBST(objc_boehm_gc) -AC_SUBST(out_file) -AC_SUBST(out_object_file) -AC_SUBST(stage_prefix_set_by_configure) -AC_SUBST(quoted_stage_prefix_set_by_configure) -AC_SUBST(symbolic_link) -AC_SUBST(thread_file) -AC_SUBST(tm_file_list) -AC_SUBST(tm_file) -AC_SUBST(tm_defines) -AC_SUBST(tm_p_file_list) -AC_SUBST(tm_p_file) -AC_SUBST(xm_file) -AC_SUBST(xm_defines) -AC_SUBST(target_alias) -AC_SUBST(c_target_objs) -AC_SUBST(cxx_target_objs) -AC_SUBST(target_cpu_default) - -AC_SUBST_FILE(target_overrides) -AC_SUBST_FILE(host_overrides) -AC_SUBST_FILE(language_fragments) -AC_SUBST_FILE(language_hooks) - -# Echo that links are built -if test x$host = x$target -then - str1="native " -else - str1="cross-" - str2=" from $host" -fi - -if test x$host != x$build -then - str3=" on a $build system" -fi - -if test "x$str2" != x || test "x$str3" != x -then - str4= -fi - -echo "Links are now set up to build a ${str1}compiler for ${target}$str4" 1>&2 - -if test "x$str2" != x || test "x$str3" != x -then - echo " ${str2}${str3}." 1>&2 -fi - -# Truncate the target if necessary -if test x$host_truncate_target != x; then - target=`echo $target | sed -e 's/\(..............\).*/\1/'` -fi - -# Configure the subdirectories -# AC_CONFIG_SUBDIRS($subdirs) - -# Create the Makefile -# and configure language subdirectories -AC_OUTPUT($all_outputs, -[ -case x$CONFIG_HEADERS in -xauto-host.h:config.in) -echo > cstamp-h ;; -esac -# If the host supports symlinks, point stage[1234] at ../stage[1234] so -# bootstrapping and the installation procedure can still use -# CC="stage1/xgcc -Bstage1/". If the host doesn't support symlinks, -# FLAGS_TO_PASS has been modified to solve the problem there. -# This is virtually a duplicate of what happens in configure.lang; we do -# an extra check to make sure this only happens if ln -s can be used. -if test "$symbolic_link" = "ln -s"; then - for d in .. ${subdirs} fixinc ; do - if test $d != ..; then - STARTDIR=`${PWDCMD-pwd}` - cd $d - for t in stage1 stage2 stage3 stage4 include - do - rm -f $t - $symbolic_link ../$t $t 2>/dev/null - done - cd $STARTDIR - fi - done -else true ; fi -# Avoid having to add intl to our include paths. -if test -f intl/libintl.h; then - echo creating libintl.h - echo '#include "intl/libintl.h"' >libintl.h -fi -], -[subdirs='$subdirs' -symbolic_link='$symbolic_link' -]) diff --git a/contrib/gcc/cp/lang-options.h b/contrib/gcc/cp/lang-options.h deleted file mode 100644 index d4748be..0000000 --- a/contrib/gcc/cp/lang-options.h +++ /dev/null @@ -1,159 +0,0 @@ -/* Definitions for switches for C++. - Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000 - 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_LANG_NAME ("C++") - -/* This is the contribution to the `documented_lang_options' array in - toplev.c for g++. */ - - { "-faccess-control", "" }, - { "-fno-access-control", - N_("Do not obey access control semantics") }, - { "-falt-external-templates", - N_("Change when template instances are emitted") }, - { "-fno-alt-external-templates", "" }, - { "-fansi-overloading", "" }, - { "-fno-ansi-overloading", "" }, - { "-fcheck-new", - N_("Check the return value of new") }, - { "-fno-check-new", "" }, - { "-fconserve-space", - N_("Reduce size of object files") }, - { "-fno-conserve-space", "" }, - { "-fconst-strings", "" }, - { "-fno-const-strings", - N_("Make string literals `char[]' instead of `const char[]'") }, - { "-fdefault-inline", "" }, - { "-fdump-translation-unit-", - N_("Dump the entire translation unit to a file") }, - { "-fno-default-inline", - N_("Do not inline member functions by default") }, - { "-frtti", "" }, - { "-fno-rtti", - N_("Do not generate run time type descriptor information") }, - { "-felide-constructors", "" }, - { "-fno-elide-constructors", "" }, - { "-fenforce-eh-specs", "" }, - { "-fno-enforce-eh-specs", - N_("Do not generate code to check exception specifications") }, - { "-fexternal-templates", "" }, - { "-fno-external-templates", "" }, - { "-ffor-scope", "" }, - { "-fno-for-scope", - N_("Scope of for-init-statement vars extends outside") }, - { "-fgnu-keywords", "" }, - { "-fno-gnu-keywords", - N_("Do not recognize GNU defined keywords") }, - { "-fhandle-exceptions", "" }, - { "-fno-handle-exceptions", "" }, - { "-fhuge-objects", - N_("Enable support for huge objects") }, - { "-fno-huge-objects", "" }, - { "-fimplement-inlines", "" }, - { "-fno-implement-inlines", - N_("Export functions even if they can be inlined") }, - { "-fimplicit-templates", "" }, - { "-fno-implicit-templates", - N_("Only emit explicit template instantiations") }, - { "-fimplicit-inline-templates", "" }, - { "-fno-implicit-inline-templates", - N_("Only emit explicit instantiations of inline templates") }, - { "-finit-priority", "" }, - { "-fno-init-priority", "" }, - { "-fmemoize-lookups", "" }, - { "-fno-memoize-lookups", "" }, - { "-fms-extensions", - N_("Don't pedwarn about uses of Microsoft extensions") }, - { "-fno-ms-extensions", "" }, - { "-foperator-names", - N_("Recognize and/bitand/bitor/compl/not/or/xor") }, - { "-fno-operator-names", "" }, - { "-foptional-diags", "" }, - { "-fno-optional-diags", - N_("Disable optional diagnostics") }, - { "-fpermissive", - N_("Downgrade conformance errors to warnings") }, - { "-fno-permissive", "" }, - { "-frepo", - N_("Enable automatic template instantiation") }, - { "-fno-repo", "" }, - { "-fsave-memoized", "" }, - { "-fno-save-memoized", "" }, - { "-fstats", - N_("Display statistics accumulated during compilation") }, - { "-fno-stats", "" }, - { "-ftemplate-depth-", - N_("Specify maximum template instantiation depth") }, - { "-fuse-cxa-atexit", - N_("Use __cxa_atexit to register destructors") }, - { "-fno-use-cxa-atexit", "" }, - { "-fvtable-gc", - N_("Discard unused virtual functions") }, - { "-fno-vtable-gc", "" }, - { "-fvtable-thunks", - N_("Implement vtables using thunks") }, - { "-fno-vtable-thunks", "" }, - { "-fweak", - N_("Emit common-like symbols as weak symbols") }, - { "-fno-weak", "" }, - { "-fxref", - N_("Emit cross referencing information") }, - { "-fno-xref", "" }, - - { "-Wreturn-type", - N_("Warn about inconsistent return types") }, - { "-Wno-return-type", "" }, - { "-Woverloaded-virtual", - N_("Warn about overloaded virtual function names") }, - { "-Wno-overloaded-virtual", "" }, - { "-Wctor-dtor-privacy", "" }, - { "-Wno-ctor-dtor-privacy", - N_("Don't warn when all ctors/dtors are private") }, - { "-Wnon-virtual-dtor", - N_("Warn about non virtual destructors") }, - { "-Wno-non-virtual-dtor", "" }, - { "-Wextern-inline", - N_("Warn when a function is declared extern, then inline") }, - { "-Wno-extern-inline", "" }, - { "-Wreorder", - N_("Warn when the compiler reorders code") }, - { "-Wno-reorder", "" }, - { "-Wsynth", - N_("Warn when synthesis behavior differs from Cfront") }, - { "-Wno-synth", "" }, - { "-Wpmf-conversions", "" }, - { "-Wno-pmf-conversions", - N_("Don't warn when type converting pointers to member functions") }, - { "-Weffc++", - N_("Warn about violations of Effective C++ style rules") }, - { "-Wno-effc++", "" }, - { "-Wsign-promo", - N_("Warn when overload promotes from unsigned to signed") }, - { "-Wno-sign-promo", "" }, - { "-Wold-style-cast", - N_("Warn if a C style cast is used in a program") }, - { "-Wno-old-style-cast", "" }, - { "-Wnon-template-friend", "" }, - { "-Wno-non-template-friend", - N_("Don't warn when non-templatized friend functions are declared within a template") }, - { "-Wdeprecated", "" }, - { "-Wno-deprecated", - N_("Don't announce deprecation of compiler features") }, diff --git a/contrib/gcc/cp/parse.y b/contrib/gcc/cp/parse.y deleted file mode 100644 index 157a210..0000000 --- a/contrib/gcc/cp/parse.y +++ /dev/null @@ -1,4237 +0,0 @@ -/* YACC parser for C++ syntax. - Copyright (C) 1988, 1989, 1993, 1994, 1995, 1996, 1997, 1998, - 1999, 2000, 2001, 2002 Free Software Foundation, Inc. - Hacked by Michael Tiemann (tiemann@cygnus.com) - -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. */ - - -/* This grammar is based on the GNU CC grammar. */ - -/* Note: Bison automatically applies a default action of "$$ = $1" for - all derivations; this is applied before the explicit action, if one - is given. Keep this in mind when reading the actions. */ - -%{ -#include "config.h" - -#include "system.h" - -#include "tree.h" -#include "input.h" -#include "flags.h" -#include "cp-tree.h" -#include "decl.h" -#include "lex.h" -#include "c-pragma.h" /* For YYDEBUG definition. */ -#include "output.h" -#include "except.h" -#include "toplev.h" -#include "ggc.h" - -/* Like YYERROR but do call yyerror. */ -#define YYERROR1 { yyerror ("syntax error"); YYERROR; } - -/* Like the default stack expander, except (1) use realloc when possible, - (2) impose no hard maxiumum on stack size, (3) REALLY do not use alloca. - - Irritatingly, YYSTYPE is defined after this %{ %} block, so we cannot - give malloced_yyvs its proper type. This is ok since all we need from - it is to be able to free it. */ - -static short *malloced_yyss; -static void *malloced_yyvs; -static int class_template_ok_as_expr; - -#define yyoverflow(MSG, SS, SSSIZE, VS, VSSIZE, YYSSZ) \ -do { \ - size_t newsize; \ - short *newss; \ - YYSTYPE *newvs; \ - newsize = *(YYSSZ) *= 2; \ - if (malloced_yyss) \ - { \ - newss = (short *) \ - really_call_realloc (*(SS), newsize * sizeof (short)); \ - newvs = (YYSTYPE *) \ - really_call_realloc (*(VS), newsize * sizeof (YYSTYPE)); \ - } \ - else \ - { \ - newss = (short *) really_call_malloc (newsize * sizeof (short)); \ - newvs = (YYSTYPE *) really_call_malloc (newsize * sizeof (YYSTYPE)); \ - if (newss) \ - memcpy (newss, *(SS), (SSSIZE)); \ - if (newvs) \ - memcpy (newvs, *(VS), (VSSIZE)); \ - } \ - if (!newss || !newvs) \ - { \ - yyerror (MSG); \ - return 2; \ - } \ - *(SS) = newss; \ - *(VS) = newvs; \ - malloced_yyss = newss; \ - malloced_yyvs = (void *) newvs; \ -} while (0) -#define OP0(NODE) (TREE_OPERAND (NODE, 0)) -#define OP1(NODE) (TREE_OPERAND (NODE, 1)) - -/* Contains the statement keyword (if/while/do) to include in an - error message if the user supplies an empty conditional expression. */ -static const char *cond_stmt_keyword; - -/* List of types and structure classes of the current declaration. */ -static GTY(()) tree current_declspecs; - -/* List of prefix attributes in effect. - Prefix attributes are parsed by the reserved_declspecs and declmods - rules. They create a list that contains *both* declspecs and attrs. */ -/* ??? It is not clear yet that all cases where an attribute can now appear in - a declspec list have been updated. */ -static GTY(()) tree prefix_attributes; - -/* When defining an enumeration, this is the type of the enumeration. */ -static GTY(()) tree current_enum_type; - -/* When parsing a conversion operator name, this is the scope of the - operator itself. */ -static GTY(()) tree saved_scopes; - -static tree empty_parms PARAMS ((void)); -static tree parse_decl0 PARAMS ((tree, tree, tree, tree, int)); -static tree parse_decl PARAMS ((tree, tree, int)); -static void parse_end_decl PARAMS ((tree, tree, tree)); -static tree parse_field0 PARAMS ((tree, tree, tree, tree, tree, tree)); -static tree parse_field PARAMS ((tree, tree, tree, tree)); -static tree parse_bitfield0 PARAMS ((tree, tree, tree, tree, tree)); -static tree parse_bitfield PARAMS ((tree, tree, tree)); -static tree parse_method PARAMS ((tree, tree, tree)); -static void frob_specs PARAMS ((tree, tree)); -static void check_class_key PARAMS ((tree, tree)); -static tree parse_scoped_id PARAMS ((tree)); -static tree parse_xref_tag (tree, tree, int); -static tree parse_handle_class_head (tree, tree, tree, int, int *); -static void parse_decl_instantiation (tree, tree, tree); -static int parse_begin_function_definition (tree, tree); -static tree parse_finish_call_expr (tree, tree, int); - -/* Cons up an empty parameter list. */ -static inline tree -empty_parms () -{ - tree parms; - -#ifndef NO_IMPLICIT_EXTERN_C - if (in_system_header && current_class_type == NULL - && current_lang_name == lang_name_c) - parms = NULL_TREE; - else -#endif - parms = void_list_node; - return parms; -} - -/* Record the decl-specifiers, attributes and type lookups from the - decl-specifier-seq in a declaration. */ - -static void -frob_specs (specs_attrs, lookups) - tree specs_attrs, lookups; -{ - save_type_access_control (lookups); - split_specs_attrs (specs_attrs, ¤t_declspecs, &prefix_attributes); - if (current_declspecs - && TREE_CODE (current_declspecs) != TREE_LIST) - current_declspecs = build_tree_list (NULL_TREE, current_declspecs); - if (have_extern_spec) - { - /* We have to indicate that there is an "extern", but that it - was part of a language specifier. For instance, - - extern "C" typedef int (*Ptr) (); - - is well formed. */ - current_declspecs = tree_cons (error_mark_node, - get_identifier ("extern"), - current_declspecs); - have_extern_spec = false; - } -} - -static tree -parse_decl (declarator, attributes, initialized) - tree declarator, attributes; - int initialized; -{ - return start_decl (declarator, current_declspecs, initialized, - attributes, prefix_attributes); -} - -static tree -parse_decl0 (declarator, specs_attrs, lookups, attributes, initialized) - tree declarator, specs_attrs, lookups, attributes; - int initialized; -{ - frob_specs (specs_attrs, lookups); - return parse_decl (declarator, attributes, initialized); -} - -static void -parse_end_decl (decl, init, asmspec) - tree decl, init, asmspec; -{ - /* If decl is NULL_TREE, then this was a variable declaration using - () syntax for the initializer, so we handled it in grokdeclarator. */ - if (decl) - decl_type_access_control (decl); - cp_finish_decl (decl, init, asmspec, init ? LOOKUP_ONLYCONVERTING : 0); -} - -static tree -parse_field (declarator, attributes, asmspec, init) - tree declarator, attributes, asmspec, init; -{ - tree d = grokfield (declarator, current_declspecs, init, asmspec, - chainon (attributes, prefix_attributes)); - decl_type_access_control (d); - return d; -} - -static tree -parse_field0 (declarator, specs_attrs, lookups, attributes, asmspec, init) - tree declarator, specs_attrs, lookups, attributes, asmspec, init; -{ - frob_specs (specs_attrs, lookups); - return parse_field (declarator, attributes, asmspec, init); -} - -static tree -parse_bitfield (declarator, attributes, width) - tree declarator, attributes, width; -{ - tree d = grokbitfield (declarator, current_declspecs, width); - cplus_decl_attributes (&d, chainon (attributes, prefix_attributes), 0); - decl_type_access_control (d); - return d; -} - -static tree -parse_bitfield0 (declarator, specs_attrs, lookups, attributes, width) - tree declarator, specs_attrs, lookups, attributes, width; -{ - frob_specs (specs_attrs, lookups); - return parse_bitfield (declarator, attributes, width); -} - -static tree -parse_method (declarator, specs_attrs, lookups) - tree declarator, specs_attrs, lookups; -{ - tree d; - frob_specs (specs_attrs, lookups); - d = start_method (current_declspecs, declarator, prefix_attributes); - decl_type_access_control (d); - return d; -} - -static void -check_class_key (key, aggr) - tree key; - tree aggr; -{ - if (TREE_CODE (key) == TREE_LIST) - key = TREE_VALUE (key); - if ((key == union_type_node) != (TREE_CODE (aggr) == UNION_TYPE)) - pedwarn ("`%s' tag used in naming `%#T'", - key == union_type_node ? "union" - : key == record_type_node ? "struct" : "class", aggr); -} - -%} - -%start program - -%union { GTY(()) - long itype; - tree ttype; - char *strtype; - enum tree_code code; - flagged_type_tree ftype; - struct unparsed_text *pi; -} - -/* All identifiers that are not reserved words - and are not declared typedefs in the current block */ -%token IDENTIFIER - -/* All identifiers that are declared typedefs in the current block. - In some contexts, they are treated just like IDENTIFIER, - but they can also serve as typespecs in declarations. */ -%token tTYPENAME -%token SELFNAME - -/* A template function. */ -%token PFUNCNAME - -/* Reserved words that specify storage class. - yylval contains an IDENTIFIER_NODE which indicates which one. */ -%token SCSPEC - -/* Reserved words that specify type. - yylval contains an IDENTIFIER_NODE which indicates which one. */ -%token TYPESPEC - -/* Reserved words that qualify type: "const" or "volatile". - yylval contains an IDENTIFIER_NODE which indicates which one. */ -%token CV_QUALIFIER - -/* Character or numeric constants. - yylval is the node for the constant. */ -%token CONSTANT - -/* __func__, __FUNCTION__ or __PRETTY_FUNCTION__. - yylval contains an IDENTIFIER_NODE which indicates which one. */ -%token <ttype> VAR_FUNC_NAME - -/* String constants in raw form. - yylval is a STRING_CST node. */ -%token STRING - -/* "...", used for functions with variable arglists. */ -%token ELLIPSIS - -/* the reserved words */ -/* SCO include files test "ASM", so use something else. */ -%token SIZEOF ENUM /* STRUCT UNION */ IF ELSE WHILE DO FOR SWITCH CASE DEFAULT -%token BREAK CONTINUE RETURN_KEYWORD GOTO ASM_KEYWORD TYPEOF ALIGNOF -%token SIGOF -%token ATTRIBUTE EXTENSION LABEL -%token REALPART IMAGPART VA_ARG - -/* the reserved words... C++ extensions */ -%token <ttype> AGGR -%token <ttype> VISSPEC -%token DELETE NEW THIS OPERATOR CXX_TRUE CXX_FALSE -%token NAMESPACE TYPENAME_KEYWORD USING -%token LEFT_RIGHT TEMPLATE -%token TYPEID DYNAMIC_CAST STATIC_CAST REINTERPRET_CAST CONST_CAST -%token SCOPE EXPORT - -/* Define the operator tokens and their precedences. - The value is an integer because, if used, it is the tree code - to use in the expression made from the operator. */ - -%left EMPTY /* used to resolve s/r with epsilon */ - -%left error - -/* Add precedence rules to solve dangling else s/r conflict */ -%nonassoc IF -%nonassoc ELSE - -%left IDENTIFIER PFUNCNAME tTYPENAME SELFNAME PTYPENAME SCSPEC TYPESPEC CV_QUALIFIER ENUM AGGR ELLIPSIS TYPEOF SIGOF OPERATOR NSNAME TYPENAME_KEYWORD ATTRIBUTE - -%left '{' ',' ';' - -%nonassoc THROW -%right <code> ':' -%right <code> ASSIGN '=' -%right <code> '?' -%left <code> OROR -%left <code> ANDAND -%left <code> '|' -%left <code> '^' -%left <code> '&' -%left <code> MIN_MAX -%left <code> EQCOMPARE -%left <code> ARITHCOMPARE '<' '>' -%left <code> LSHIFT RSHIFT -%left <code> '+' '-' -%left <code> '*' '/' '%' -%left <code> POINTSAT_STAR DOT_STAR -%right <code> UNARY PLUSPLUS MINUSMINUS '~' -%left HYPERUNARY -%left <ttype> LEFT_RIGHT -%left <code> POINTSAT '.' '(' '[' - -%right SCOPE /* C++ extension */ -%nonassoc NEW DELETE TRY CATCH - -%type <code> unop - -%type <ttype> identifier IDENTIFIER tTYPENAME CONSTANT expr nonnull_exprlist -%type <ttype> PFUNCNAME maybe_identifier -%type <ttype> paren_expr_or_null nontrivial_exprlist SELFNAME -%type <ttype> expr_no_commas expr_no_comma_rangle -%type <ttype> cast_expr unary_expr primary STRING -%type <ttype> reserved_declspecs boolean_literal -%type <ttype> reserved_typespecquals -%type <ttype> SCSPEC TYPESPEC CV_QUALIFIER maybe_cv_qualifier -%type <ttype> init initlist maybeasm maybe_init defarg defarg1 -%type <ttype> asm_operands nonnull_asm_operands asm_operand asm_clobbers -%type <ttype> maybe_attribute attributes attribute attribute_list attrib -%type <ttype> any_word unoperator - -%type <itype> save_lineno -%type <ttype> simple_stmt simple_if - -%type <ttype> declarator notype_declarator after_type_declarator -%type <ttype> notype_declarator_intern absdcl_intern -%type <ttype> after_type_declarator_intern -%type <ttype> direct_notype_declarator direct_after_type_declarator -%type <itype> components notype_components -%type <ttype> component_decl component_decl_1 -%type <ttype> component_declarator component_declarator0 -%type <ttype> notype_component_declarator notype_component_declarator0 -%type <ttype> after_type_component_declarator after_type_component_declarator0 -%type <ttype> absdcl cv_qualifiers -%type <ttype> direct_abstract_declarator conversion_declarator -%type <ttype> new_declarator direct_new_declarator -%type <ttype> xexpr parmlist parms bad_parm -%type <ttype> identifiers_or_typenames -%type <ttype> fcast_or_absdcl regcast_or_absdcl -%type <ttype> expr_or_declarator expr_or_declarator_intern -%type <ttype> complex_notype_declarator -%type <ttype> notype_unqualified_id unqualified_id qualified_id -%type <ttype> template_id do_id object_template_id notype_template_declarator -%type <ttype> overqualified_id notype_qualified_id any_id -%type <ttype> complex_direct_notype_declarator functional_cast -%type <ttype> complex_parmlist parms_comma -%type <ttype> namespace_qualifier namespace_using_decl - -%type <ftype> type_id new_type_id typed_typespecs typespec typed_declspecs -%type <ftype> typed_declspecs1 type_specifier_seq nonempty_cv_qualifiers -%type <ftype> structsp typespecqual_reserved parm named_parm full_parm -%type <ftype> declmods - -%type <itype> extension - -/* C++ extensions */ -%token <ttype> PTYPENAME -%token <ttype> EXTERN_LANG_STRING ALL -%token <ttype> PRE_PARSED_CLASS_DECL DEFARG DEFARG_MARKER -%token <pi> PRE_PARSED_FUNCTION_DECL -%type <ttype> component_constructor_declarator -%type <ttype> fn_def2 return_id constructor_declarator -%type <ttype> begin_function_body_ -%type <ttype> class_head class_head_apparent_template -%type <ftype> class_head_decl class_head_defn -%type <ttype> base_class_list -%type <ttype> base_class_access_list -%type <ttype> base_class maybe_base_class_list base_class_1 -%type <ttype> exception_specification_opt ansi_raise_identifier ansi_raise_identifiers -%type <ttype> operator_name -%type <ttype> object aggr -%type <itype> new delete -/* %type <ttype> primary_no_id */ -%type <ttype> maybe_parmlist -%type <ttype> begin_member_init member_init -%type <ftype> member_init_list -%type <ttype> template_parm_header template_spec_header template_header -%type <ttype> template_parm_list template_parm -%type <ttype> template_type_parm template_template_parm -%type <code> template_close_bracket -%type <ttype> apparent_template_type -%type <ttype> template_type template_arg_list template_arg_list_opt -%type <ttype> template_arg template_arg_1 -%type <ttype> condition xcond paren_cond_or_null -%type <ttype> type_name nested_name_specifier nested_type ptr_to_mem -%type <ttype> complete_type_name notype_identifier nonnested_type -%type <ttype> complex_type_name nested_name_specifier_1 -%type <ttype> new_initializer new_placement -%type <ttype> using_decl -%type <ttype> typename_sub typename_sub0 typename_sub1 typename_sub2 -%type <ttype> explicit_template_type -/* in order to recognize aggr tags as defining and thus shadowing. */ -%token TYPENAME_DEFN IDENTIFIER_DEFN PTYPENAME_DEFN -%type <ttype> identifier_defn IDENTIFIER_DEFN TYPENAME_DEFN PTYPENAME_DEFN -%type <ttype> handler_args -%type <ttype> self_template_type finish_template_type_ - -%token NSNAME -%type <ttype> NSNAME - -/* Used in lex.c for parsing pragmas. */ -%token END_OF_LINE - -/* lex.c and pt.c depend on this being the last token. Define - any new tokens before this one! */ -%token END_OF_SAVED_INPUT - -%{ -/* Tell yyparse how to print a token's value, if yydebug is set. */ -#define YYPRINT(FILE,YYCHAR,YYLVAL) yyprint(FILE,YYCHAR,YYLVAL) -extern void yyprint PARAMS ((FILE *, int, YYSTYPE)); -%} - -%% -program: - /* empty */ - { finish_translation_unit (); } - | extdefs - { finish_translation_unit (); } - ; - -/* the reason for the strange actions in this rule - is so that notype_initdecls when reached via datadef - can find a valid list of type and sc specs in $0. */ - -extdefs: - { $<ttype>$ = NULL_TREE; } - lang_extdef - { $<ttype>$ = NULL_TREE; ggc_collect (); } - | extdefs lang_extdef - { $<ttype>$ = NULL_TREE; ggc_collect (); } - ; - -extdefs_opt: - extdefs - | /* empty */ - ; - -.hush_warning: - { have_extern_spec = true; - $<ttype>$ = NULL_TREE; } - ; -.warning_ok: - { have_extern_spec = false; } - ; - -extension: - EXTENSION - { $$ = pedantic; - pedantic = 0; } - ; - -asm_keyword: - ASM_KEYWORD - ; - -lang_extdef: - { if (pending_lang_change) do_pending_lang_change(); - type_lookups = NULL_TREE; } - extdef - { if (! toplevel_bindings_p ()) - pop_everything (); } - ; - -extdef: - fndef eat_saved_input - { do_pending_inlines (); } - | datadef - { do_pending_inlines (); } - - | EXPORT - { warning ("keyword `export' not implemented, and will be ignored"); } - template_def - { do_pending_inlines (); } - | template_def - { do_pending_inlines (); } - | asm_keyword '(' STRING ')' ';' - { assemble_asm ($3); } - | extern_lang_string '{' extdefs_opt '}' - { pop_lang_context (); } - | extern_lang_string .hush_warning fndef .warning_ok eat_saved_input - { do_pending_inlines (); pop_lang_context (); } - | extern_lang_string .hush_warning datadef .warning_ok - { do_pending_inlines (); pop_lang_context (); } - | NAMESPACE identifier '{' - { push_namespace ($2); } - extdefs_opt '}' - { pop_namespace (); } - | NAMESPACE '{' - { push_namespace (NULL_TREE); } - extdefs_opt '}' - { pop_namespace (); } - | namespace_alias - | using_decl ';' - { do_toplevel_using_decl ($1); } - | using_directive - | extension extdef - { pedantic = $1; } - ; - -namespace_alias: - NAMESPACE identifier '=' - { begin_only_namespace_names (); } - any_id ';' - { - end_only_namespace_names (); - if (lastiddecl) - $5 = lastiddecl; - do_namespace_alias ($2, $5); - } - ; - -using_decl: - USING qualified_id - { $$ = $2; } - | USING global_scope qualified_id - { $$ = $3; } - | USING global_scope unqualified_id - { $$ = $3; } - ; - -namespace_using_decl: - USING namespace_qualifier identifier - { $$ = build_nt (SCOPE_REF, $2, $3); } - | USING global_scope identifier - { $$ = build_nt (SCOPE_REF, global_namespace, $3); } - | USING global_scope namespace_qualifier identifier - { $$ = build_nt (SCOPE_REF, $3, $4); } - ; - -using_directive: - USING NAMESPACE - { begin_only_namespace_names (); } - any_id ';' - { - end_only_namespace_names (); - /* If no declaration was found, the using-directive is - invalid. Since that was not reported, we need the - identifier for the error message. */ - if (TREE_CODE ($4) == IDENTIFIER_NODE && lastiddecl) - $4 = lastiddecl; - do_using_directive ($4); - } - ; - -namespace_qualifier: - NSNAME SCOPE - { - if (TREE_CODE ($$) == IDENTIFIER_NODE) - $$ = lastiddecl; - got_scope = $$; - } - | namespace_qualifier NSNAME SCOPE - { - $$ = $2; - if (TREE_CODE ($$) == IDENTIFIER_NODE) - $$ = lastiddecl; - got_scope = $$; - } - ; - -any_id: - unqualified_id - | qualified_id - | global_scope qualified_id - { $$ = $2; } - | global_scope unqualified_id - { $$ = $2; } - ; - -extern_lang_string: - EXTERN_LANG_STRING - { push_lang_context ($1); } - | extern_lang_string EXTERN_LANG_STRING - { if (current_lang_name != $2) - error ("use of linkage spec `%D' is different from previous spec `%D'", $2, current_lang_name); - pop_lang_context (); push_lang_context ($2); } - ; - -template_parm_header: - TEMPLATE '<' - { begin_template_parm_list (); } - template_parm_list '>' - { $$ = end_template_parm_list ($4); } - ; - -template_spec_header: - TEMPLATE '<' '>' - { begin_specialization(); - $$ = NULL_TREE; } - ; - -template_header: - template_parm_header - | template_spec_header - ; - -template_parm_list: - template_parm - { $$ = process_template_parm (NULL_TREE, $1); } - | template_parm_list ',' template_parm - { $$ = process_template_parm ($1, $3); } - ; - -maybe_identifier: - identifier - { $$ = $1; } - | /* empty */ - { $$ = NULL_TREE; } - ; - -template_type_parm: - aggr maybe_identifier - { $$ = finish_template_type_parm ($1, $2); } - | TYPENAME_KEYWORD maybe_identifier - { $$ = finish_template_type_parm (class_type_node, $2); } - ; - -template_template_parm: - template_parm_header aggr maybe_identifier - { $$ = finish_template_template_parm ($2, $3); } - ; - -template_parm: - /* The following rules introduce a new reduce/reduce - conflict on the ',' and '>' input tokens: they are valid - prefixes for a `structsp', which means they could match a - nameless parameter. See 14.6, paragraph 3. - By putting them before the `parm' rule, we get - their match before considering them nameless parameter - declarations. */ - template_type_parm - { $$ = build_tree_list (NULL_TREE, $1); } - | template_type_parm '=' type_id - { $$ = build_tree_list (groktypename ($3.t), $1); } - | parm - { $$ = build_tree_list (NULL_TREE, $1.t); } - | parm '=' expr_no_comma_rangle - { $$ = build_tree_list ($3, $1.t); } - | template_template_parm - { $$ = build_tree_list (NULL_TREE, $1); } - | template_template_parm '=' template_arg - { - $3 = check_template_template_default_arg ($3); - $$ = build_tree_list ($3, $1); - } - ; - -template_def: - template_header template_extdef - { finish_template_decl ($1); } - | template_header error %prec EMPTY - { finish_template_decl ($1); } - ; - -template_extdef: - fndef eat_saved_input - { do_pending_inlines (); } - | template_datadef - { do_pending_inlines (); } - | template_def - { do_pending_inlines (); } - | extern_lang_string .hush_warning fndef .warning_ok eat_saved_input - { do_pending_inlines (); - pop_lang_context (); } - | extern_lang_string .hush_warning template_datadef .warning_ok - { do_pending_inlines (); - pop_lang_context (); } - | extension template_extdef - { pedantic = $1; } - ; - -template_datadef: - nomods_initdecls ';' - | declmods notype_initdecls ';' - {} - | typed_declspecs initdecls ';' - { note_list_got_semicolon ($1.t); } - | structsp ';' - { - if ($1.t != error_mark_node) - { - maybe_process_partial_specialization ($1.t); - note_got_semicolon ($1.t); - } - } - ; - -datadef: - nomods_initdecls ';' - | declmods notype_initdecls ';' - {} - | typed_declspecs initdecls ';' - { note_list_got_semicolon ($1.t); } - | declmods ';' - { pedwarn ("empty declaration"); } - | explicit_instantiation ';' - | typed_declspecs ';' - { - tree t, attrs; - split_specs_attrs ($1.t, &t, &attrs); - shadow_tag (t); - note_list_got_semicolon ($1.t); - } - | error ';' - | error '}' - | error END_OF_SAVED_INPUT - { end_input (); } - | ';' - | bad_decl - ; - -ctor_initializer_opt: - nodecls - | base_init - ; - -maybe_return_init: - /* empty */ - | return_init - | return_init ';' - ; - -eat_saved_input: - /* empty */ - | END_OF_SAVED_INPUT - ; - -/* The outermost block of a function really begins before the - mem-initializer-list, so we open one there and suppress the one that - actually corresponds to the curly braces. */ -function_body: - begin_function_body_ ctor_initializer_opt save_lineno '{' - { $<ttype>$ = begin_compound_stmt (/*has_no_scope=*/1); } - compstmtend - { - STMT_LINENO ($<ttype>5) = $3; - finish_compound_stmt (/*has_no_scope=*/1, $<ttype>5); - finish_function_body ($1); - } - ; - -fndef: - fn.def1 maybe_return_init function_body - { expand_body (finish_function (0)); } - | fn.def1 maybe_return_init function_try_block - { expand_body (finish_function (0)); } - | fn.def1 maybe_return_init error - { } - ; - -constructor_declarator: - nested_name_specifier SELFNAME '(' - { $$ = begin_constructor_declarator ($1, $2); } - parmlist ')' cv_qualifiers exception_specification_opt - { $$ = make_call_declarator ($<ttype>4, $5, $7, $8); } - | nested_name_specifier SELFNAME LEFT_RIGHT cv_qualifiers exception_specification_opt - { $$ = begin_constructor_declarator ($1, $2); - $$ = make_call_declarator ($$, empty_parms (), $4, $5); - } - | global_scope nested_name_specifier SELFNAME '(' - { $$ = begin_constructor_declarator ($2, $3); } - parmlist ')' cv_qualifiers exception_specification_opt - { $$ = make_call_declarator ($<ttype>5, $6, $8, $9); } - | global_scope nested_name_specifier SELFNAME LEFT_RIGHT cv_qualifiers exception_specification_opt - { $$ = begin_constructor_declarator ($2, $3); - $$ = make_call_declarator ($$, empty_parms (), $5, $6); - } - | nested_name_specifier self_template_type '(' - { $$ = begin_constructor_declarator ($1, $2); } - parmlist ')' cv_qualifiers exception_specification_opt - { $$ = make_call_declarator ($<ttype>4, $5, $7, $8); } - | nested_name_specifier self_template_type LEFT_RIGHT cv_qualifiers exception_specification_opt - { $$ = begin_constructor_declarator ($1, $2); - $$ = make_call_declarator ($$, empty_parms (), $4, $5); - } - | global_scope nested_name_specifier self_template_type '(' - { $$ = begin_constructor_declarator ($2, $3); } - parmlist ')' cv_qualifiers exception_specification_opt - { $$ = make_call_declarator ($<ttype>5, $6, $8, $9); } - | global_scope nested_name_specifier self_template_type LEFT_RIGHT cv_qualifiers exception_specification_opt - { $$ = begin_constructor_declarator ($2, $3); - $$ = make_call_declarator ($$, empty_parms (), $5, $6); - } - ; - -fn.def1: - typed_declspecs declarator - { check_for_new_type ("return type", $1); - if (!parse_begin_function_definition ($1.t, $2)) - YYERROR1; } - | declmods notype_declarator - { if (!parse_begin_function_definition ($1.t, $2)) - YYERROR1; } - | notype_declarator - { if (!parse_begin_function_definition (NULL_TREE, $1)) - YYERROR1; } - | declmods constructor_declarator - { if (!parse_begin_function_definition ($1.t, $2)) - YYERROR1; } - | constructor_declarator - { if (!parse_begin_function_definition (NULL_TREE, $1)) - YYERROR1; } - ; - -/* ANSI allows optional parentheses around constructor class names. - See ISO/IEC 14882:1998(E) 12.1. */ - -component_constructor_declarator: - SELFNAME '(' parmlist ')' cv_qualifiers exception_specification_opt - { $$ = make_call_declarator ($1, $3, $5, $6); } - | '(' SELFNAME ')' '(' parmlist ')' cv_qualifiers - exception_specification_opt - { $$ = make_call_declarator ($2, $5, $7, $8); } - | SELFNAME LEFT_RIGHT cv_qualifiers exception_specification_opt - { $$ = make_call_declarator ($1, empty_parms (), $3, $4); } - | '(' SELFNAME ')' LEFT_RIGHT cv_qualifiers exception_specification_opt - { $$ = make_call_declarator ($2, empty_parms (), $5, $6); } - | self_template_type '(' parmlist ')' cv_qualifiers exception_specification_opt - { $$ = make_call_declarator ($1, $3, $5, $6); } - | self_template_type LEFT_RIGHT cv_qualifiers exception_specification_opt - { $$ = make_call_declarator ($1, empty_parms (), $3, $4); } - ; - -/* more C++ complexity. See component_decl for a comment on the - reduce/reduce conflict introduced by these rules. */ -fn_def2: - declmods component_constructor_declarator - { $$ = parse_method ($2, $1.t, $1.lookups); - rest_of_mdef: - if (! $$) - YYERROR1; - if (yychar == YYEMPTY) - yychar = YYLEX; - snarf_method ($$); } - | component_constructor_declarator - { $$ = parse_method ($1, NULL_TREE, NULL_TREE); - goto rest_of_mdef; } - | typed_declspecs declarator - { $$ = parse_method ($2, $1.t, $1.lookups); goto rest_of_mdef;} - | declmods notype_declarator - { $$ = parse_method ($2, $1.t, $1.lookups); goto rest_of_mdef;} - | notype_declarator - { $$ = parse_method ($1, NULL_TREE, NULL_TREE); - goto rest_of_mdef; } - | declmods constructor_declarator - { $$ = parse_method ($2, $1.t, $1.lookups); goto rest_of_mdef;} - | constructor_declarator - { $$ = parse_method ($1, NULL_TREE, NULL_TREE); - goto rest_of_mdef; } - ; - -return_id: - RETURN_KEYWORD IDENTIFIER - { - $$ = $2; - } - ; - -return_init: - return_id maybe_init - { finish_named_return_value ($<ttype>$, $2); } - | return_id '(' nonnull_exprlist ')' - { finish_named_return_value ($<ttype>$, $3); } - | return_id LEFT_RIGHT - { finish_named_return_value ($<ttype>$, NULL_TREE); } - ; - -base_init: - ':' { begin_mem_initializers (); } member_init_list - { - if ($3.new_type_flag == 0) - error ("no base or member initializers given following ':'"); - finish_mem_initializers ($3.t); - } - ; - -begin_function_body_: - /* empty */ - { - $$ = begin_function_body (); - } - ; - -member_init_list: - /* empty */ - { - $$.new_type_flag = 0; - $$.t = NULL_TREE; - } - | member_init - { - $$.new_type_flag = 1; - $$.t = $1; - } - | member_init_list ',' member_init - { - if ($3) - { - $$.new_type_flag = 1; - TREE_CHAIN ($3) = $1.t; - $$.t = $3; - } - else - $$ = $1; - } - | member_init_list error - ; - -begin_member_init: - /* empty */ - { - if (current_class_name) - pedwarn ("anachronistic old style base class initializer"); - $$ = expand_member_init (NULL_TREE); - in_base_initializer = $$ && !DECL_P ($$); - } - | notype_identifier - { $$ = expand_member_init ($1); - in_base_initializer = $$ && !DECL_P ($$); } - | nonnested_type - { $$ = expand_member_init ($1); - in_base_initializer = $$ && !DECL_P ($$); } - | typename_sub - { $$ = expand_member_init ($1); - in_base_initializer = $$ && !DECL_P ($$); } - ; - -member_init: - begin_member_init '(' nonnull_exprlist ')' - { in_base_initializer = 0; - $$ = $1 ? build_tree_list ($1, $3) : NULL_TREE; } - | begin_member_init LEFT_RIGHT - { in_base_initializer = 0; - $$ = $1 ? build_tree_list ($1, void_type_node) : NULL_TREE; } - | error - { in_base_initializer = 0; - $$ = NULL_TREE; } - ; - -identifier: - IDENTIFIER - | tTYPENAME - | SELFNAME - | PTYPENAME - | NSNAME - ; - -notype_identifier: - IDENTIFIER - | PTYPENAME - | NSNAME %prec EMPTY - ; - -identifier_defn: - IDENTIFIER_DEFN - | TYPENAME_DEFN - | PTYPENAME_DEFN - ; - -explicit_instantiation: - TEMPLATE begin_explicit_instantiation typespec ';' - { do_type_instantiation ($3.t, NULL_TREE, 1); - yyungetc (';', 1); } - end_explicit_instantiation - | TEMPLATE begin_explicit_instantiation typed_declspecs declarator - { tree specs = strip_attrs ($3.t); - parse_decl_instantiation (specs, $4, NULL_TREE); } - end_explicit_instantiation - | TEMPLATE begin_explicit_instantiation notype_declarator - { parse_decl_instantiation (NULL_TREE, $3, NULL_TREE); } - end_explicit_instantiation - | TEMPLATE begin_explicit_instantiation constructor_declarator - { parse_decl_instantiation (NULL_TREE, $3, NULL_TREE); } - end_explicit_instantiation - | SCSPEC TEMPLATE begin_explicit_instantiation typespec ';' - { do_type_instantiation ($4.t, $1, 1); - yyungetc (';', 1); } - end_explicit_instantiation - {} - | SCSPEC TEMPLATE begin_explicit_instantiation typed_declspecs - declarator - { tree specs = strip_attrs ($4.t); - parse_decl_instantiation (specs, $5, $1); } - end_explicit_instantiation - {} - | SCSPEC TEMPLATE begin_explicit_instantiation notype_declarator - { parse_decl_instantiation (NULL_TREE, $4, $1); } - end_explicit_instantiation - {} - | SCSPEC TEMPLATE begin_explicit_instantiation constructor_declarator - { parse_decl_instantiation (NULL_TREE, $4, $1); } - end_explicit_instantiation - {} - ; - -begin_explicit_instantiation: - { begin_explicit_instantiation(); } - ; - -end_explicit_instantiation: - { end_explicit_instantiation(); } - ; - -/* The TYPENAME expansions are to deal with use of a template class name as - a template within the class itself, where the template decl is hidden by - a type decl. Got all that? */ - -template_type: - PTYPENAME '<' template_arg_list_opt template_close_bracket - finish_template_type_ - { $$ = $5; } - | tTYPENAME '<' template_arg_list_opt template_close_bracket - finish_template_type_ - { $$ = $5; } - | self_template_type - ; - -apparent_template_type: - template_type - | identifier '<' template_arg_list_opt '>' - finish_template_type_ - { $$ = $5; } - ; - -self_template_type: - SELFNAME '<' template_arg_list_opt template_close_bracket - finish_template_type_ - { $$ = $5; } - ; - -finish_template_type_: - { - if (yychar == YYEMPTY) - yychar = YYLEX; - - $$ = finish_template_type ($<ttype>-3, $<ttype>-1, - yychar == SCOPE); - } - ; - -template_close_bracket: - '>' - | RSHIFT - { - /* Handle `Class<Class<Type>>' without space in the `>>' */ - pedwarn ("`>>' should be `> >' in template class name"); - yyungetc ('>', 1); - } - ; - -template_arg_list_opt: - /* empty */ - { $$ = NULL_TREE; } - | template_arg_list - ; - -template_arg_list: - template_arg - { $$ = build_tree_list (NULL_TREE, $$); } - | template_arg_list ',' template_arg - { $$ = chainon ($$, build_tree_list (NULL_TREE, $3)); } - ; - -template_arg: - { ++class_template_ok_as_expr; } - template_arg_1 - { - --class_template_ok_as_expr; - $$ = $2; - } - ; - -template_arg_1: - type_id - { $$ = groktypename ($1.t); } - | PTYPENAME - { - $$ = lastiddecl; - if (DECL_TEMPLATE_TEMPLATE_PARM_P ($$)) - $$ = TREE_TYPE ($$); - } - | global_scope PTYPENAME - { - $$ = lastiddecl; - if (DECL_TEMPLATE_TEMPLATE_PARM_P ($$)) - $$ = TREE_TYPE ($$); - } - | expr_no_comma_rangle - | nested_name_specifier TEMPLATE identifier - { - if (!processing_template_decl) - { - error ("use of template qualifier outside template"); - $$ = error_mark_node; - } - else - $$ = make_unbound_class_template ($1, $3, tf_error | tf_parsing); - } - ; - -unop: - '-' - { $$ = NEGATE_EXPR; } - | '+' - { $$ = CONVERT_EXPR; } - | PLUSPLUS - { $$ = PREINCREMENT_EXPR; } - | MINUSMINUS - { $$ = PREDECREMENT_EXPR; } - | '!' - { $$ = TRUTH_NOT_EXPR; } - ; - -expr: - nontrivial_exprlist - { $$ = build_x_compound_expr ($$); } - | expr_no_commas - ; - -paren_expr_or_null: - LEFT_RIGHT - { error ("ISO C++ forbids an empty condition for `%s'", - cond_stmt_keyword); - $$ = integer_zero_node; } - | '(' expr ')' - { $$ = $2; } - ; - -paren_cond_or_null: - LEFT_RIGHT - { error ("ISO C++ forbids an empty condition for `%s'", - cond_stmt_keyword); - $$ = integer_zero_node; } - | '(' condition ')' - { $$ = $2; } - ; - -xcond: - /* empty */ - { $$ = NULL_TREE; } - | condition - | error - { $$ = NULL_TREE; } - ; - -condition: - type_specifier_seq declarator maybeasm maybe_attribute '=' - { { - tree d; - for (d = getdecls (); d; d = TREE_CHAIN (d)) - if (TREE_CODE (d) == TYPE_DECL) { - tree s = TREE_TYPE (d); - if (TREE_CODE (s) == RECORD_TYPE) - error ("definition of class `%T' in condition", s); - else if (TREE_CODE (s) == ENUMERAL_TYPE) - error ("definition of enum `%T' in condition", s); - } - } - current_declspecs = $1.t; - $<ttype>$ = parse_decl ($<ttype>2, $4, 1); - } - init - { - parse_end_decl ($<ttype>6, $7, $4); - $$ = convert_from_reference ($<ttype>6); - if (TREE_CODE (TREE_TYPE ($$)) == ARRAY_TYPE) - error ("definition of array `%#D' in condition", $$); - } - | expr - ; - -compstmtend: - '}' - | maybe_label_decls stmts '}' - | maybe_label_decls stmts error '}' - | maybe_label_decls error '}' - ; - -nontrivial_exprlist: - expr_no_commas ',' expr_no_commas - { $$ = tree_cons (NULL_TREE, $$, - build_tree_list (NULL_TREE, $3)); } - | expr_no_commas ',' error - { $$ = tree_cons (NULL_TREE, $$, - build_tree_list (NULL_TREE, error_mark_node)); } - | nontrivial_exprlist ',' expr_no_commas - { chainon ($$, build_tree_list (NULL_TREE, $3)); } - | nontrivial_exprlist ',' error - { chainon ($$, build_tree_list (NULL_TREE, error_mark_node)); } - ; - -nonnull_exprlist: - expr_no_commas - { $$ = build_tree_list (NULL_TREE, $$); } - | nontrivial_exprlist - ; - -unary_expr: - primary %prec UNARY - { $$ = $1; } - /* __extension__ turns off -pedantic for following primary. */ - | extension cast_expr %prec UNARY - { $$ = $2; - pedantic = $1; } - | '*' cast_expr %prec UNARY - { $$ = build_x_indirect_ref ($2, "unary *"); } - | '&' cast_expr %prec UNARY - { $$ = build_x_unary_op (ADDR_EXPR, $2); } - | '~' cast_expr - { $$ = build_x_unary_op (BIT_NOT_EXPR, $2); } - | unop cast_expr %prec UNARY - { $$ = finish_unary_op_expr ($1, $2); } - /* Refer to the address of a label as a pointer. */ - | ANDAND identifier - { $$ = finish_label_address_expr ($2); } - | sizeof unary_expr %prec UNARY - { $$ = finish_sizeof ($2); - skip_evaluation--; } - | sizeof '(' type_id ')' %prec HYPERUNARY - { $$ = finish_sizeof (groktypename ($3.t)); - check_for_new_type ("sizeof", $3); - skip_evaluation--; } - | alignof unary_expr %prec UNARY - { $$ = finish_alignof ($2); - skip_evaluation--; } - | alignof '(' type_id ')' %prec HYPERUNARY - { $$ = finish_alignof (groktypename ($3.t)); - check_for_new_type ("alignof", $3); - skip_evaluation--; } - - /* The %prec EMPTY's here are required by the = init initializer - syntax extension; see below. */ - | new new_type_id %prec EMPTY - { $$ = build_new (NULL_TREE, $2.t, NULL_TREE, $1); - check_for_new_type ("new", $2); } - | new new_type_id new_initializer - { $$ = build_new (NULL_TREE, $2.t, $3, $1); - check_for_new_type ("new", $2); } - | new new_placement new_type_id %prec EMPTY - { $$ = build_new ($2, $3.t, NULL_TREE, $1); - check_for_new_type ("new", $3); } - | new new_placement new_type_id new_initializer - { $$ = build_new ($2, $3.t, $4, $1); - check_for_new_type ("new", $3); } - | new '(' type_id ')' - %prec EMPTY - { $$ = build_new (NULL_TREE, groktypename($3.t), - NULL_TREE, $1); - check_for_new_type ("new", $3); } - | new '(' type_id ')' new_initializer - { $$ = build_new (NULL_TREE, groktypename($3.t), $5, $1); - check_for_new_type ("new", $3); } - | new new_placement '(' type_id ')' %prec EMPTY - { $$ = build_new ($2, groktypename($4.t), NULL_TREE, $1); - check_for_new_type ("new", $4); } - | new new_placement '(' type_id ')' new_initializer - { $$ = build_new ($2, groktypename($4.t), $6, $1); - check_for_new_type ("new", $4); } - - | delete cast_expr %prec UNARY - { $$ = delete_sanity ($2, NULL_TREE, 0, $1); } - | delete '[' ']' cast_expr %prec UNARY - { $$ = delete_sanity ($4, NULL_TREE, 1, $1); - if (yychar == YYEMPTY) - yychar = YYLEX; } - | delete '[' expr ']' cast_expr %prec UNARY - { $$ = delete_sanity ($5, $3, 2, $1); - if (yychar == YYEMPTY) - yychar = YYLEX; } - | REALPART cast_expr %prec UNARY - { $$ = build_x_unary_op (REALPART_EXPR, $2); } - | IMAGPART cast_expr %prec UNARY - { $$ = build_x_unary_op (IMAGPART_EXPR, $2); } - ; - -new_placement: - '(' nonnull_exprlist ')' - { $$ = $2; } - | '{' nonnull_exprlist '}' - { pedwarn ("old style placement syntax, use () instead"); - $$ = $2; } - ; - -new_initializer: - '(' nonnull_exprlist ')' - { $$ = $2; } - | LEFT_RIGHT - { $$ = void_zero_node; } - | '(' typespec ')' - { - error ("`%T' is not a valid expression", $2.t); - $$ = error_mark_node; - } - | '=' init - { - /* This was previously allowed as an extension, but - was removed in G++ 3.3. */ - error ("initialization of new expression with `='"); - $$ = error_mark_node; - } - ; - -/* This is necessary to postpone reduction of `int ((int)(int)(int))'. */ -regcast_or_absdcl: - '(' type_id ')' %prec EMPTY - { $2.t = finish_parmlist (build_tree_list (NULL_TREE, $2.t), 0); - $$ = make_call_declarator (NULL_TREE, $2.t, NULL_TREE, NULL_TREE); - check_for_new_type ("cast", $2); } - | regcast_or_absdcl '(' type_id ')' %prec EMPTY - { $3.t = finish_parmlist (build_tree_list (NULL_TREE, $3.t), 0); - $$ = make_call_declarator ($$, $3.t, NULL_TREE, NULL_TREE); - check_for_new_type ("cast", $3); } - ; - -cast_expr: - unary_expr - | regcast_or_absdcl unary_expr %prec UNARY - { $$ = reparse_absdcl_as_casts ($$, $2); } - | regcast_or_absdcl '{' initlist maybecomma '}' %prec UNARY - { - tree init = build_nt (CONSTRUCTOR, NULL_TREE, - nreverse ($3)); - if (pedantic) - pedwarn ("ISO C++ forbids compound literals"); - /* Indicate that this was a C99 compound literal. */ - TREE_HAS_CONSTRUCTOR (init) = 1; - - $$ = reparse_absdcl_as_casts ($$, init); - } - ; - -expr_no_commas: - cast_expr - /* Handle general members. */ - | expr_no_commas POINTSAT_STAR expr_no_commas - { $$ = build_x_binary_op (MEMBER_REF, $$, $3); } - | expr_no_commas DOT_STAR expr_no_commas - { $$ = build_m_component_ref ($$, $3); } - | expr_no_commas '+' expr_no_commas - { $$ = build_x_binary_op ($2, $$, $3); } - | expr_no_commas '-' expr_no_commas - { $$ = build_x_binary_op ($2, $$, $3); } - | expr_no_commas '*' expr_no_commas - { $$ = build_x_binary_op ($2, $$, $3); } - | expr_no_commas '/' expr_no_commas - { $$ = build_x_binary_op ($2, $$, $3); } - | expr_no_commas '%' expr_no_commas - { $$ = build_x_binary_op ($2, $$, $3); } - | expr_no_commas LSHIFT expr_no_commas - { $$ = build_x_binary_op ($2, $$, $3); } - | expr_no_commas RSHIFT expr_no_commas - { $$ = build_x_binary_op ($2, $$, $3); } - | expr_no_commas ARITHCOMPARE expr_no_commas - { $$ = build_x_binary_op ($2, $$, $3); } - | expr_no_commas '<' expr_no_commas - { $$ = build_x_binary_op (LT_EXPR, $$, $3); } - | expr_no_commas '>' expr_no_commas - { $$ = build_x_binary_op (GT_EXPR, $$, $3); } - | expr_no_commas EQCOMPARE expr_no_commas - { $$ = build_x_binary_op ($2, $$, $3); } - | expr_no_commas MIN_MAX expr_no_commas - { $$ = build_x_binary_op ($2, $$, $3); } - | expr_no_commas '&' expr_no_commas - { $$ = build_x_binary_op ($2, $$, $3); } - | expr_no_commas '|' expr_no_commas - { $$ = build_x_binary_op ($2, $$, $3); } - | expr_no_commas '^' expr_no_commas - { $$ = build_x_binary_op ($2, $$, $3); } - | expr_no_commas ANDAND expr_no_commas - { $$ = build_x_binary_op (TRUTH_ANDIF_EXPR, $$, $3); } - | expr_no_commas OROR expr_no_commas - { $$ = build_x_binary_op (TRUTH_ORIF_EXPR, $$, $3); } - | expr_no_commas '?' xexpr ':' expr_no_commas - { $$ = build_x_conditional_expr ($$, $3, $5); } - | expr_no_commas '=' expr_no_commas - { $$ = build_x_modify_expr ($$, NOP_EXPR, $3); - if ($$ != error_mark_node) - C_SET_EXP_ORIGINAL_CODE ($$, MODIFY_EXPR); } - | expr_no_commas ASSIGN expr_no_commas - { $$ = build_x_modify_expr ($$, $2, $3); } - | THROW - { $$ = build_throw (NULL_TREE); } - | THROW expr_no_commas - { $$ = build_throw ($2); } - ; - -expr_no_comma_rangle: - cast_expr - /* Handle general members. */ - | expr_no_comma_rangle POINTSAT_STAR expr_no_comma_rangle - { $$ = build_x_binary_op (MEMBER_REF, $$, $3); } - | expr_no_comma_rangle DOT_STAR expr_no_comma_rangle - { $$ = build_m_component_ref ($$, $3); } - | expr_no_comma_rangle '+' expr_no_comma_rangle - { $$ = build_x_binary_op ($2, $$, $3); } - | expr_no_comma_rangle '-' expr_no_comma_rangle - { $$ = build_x_binary_op ($2, $$, $3); } - | expr_no_comma_rangle '*' expr_no_comma_rangle - { $$ = build_x_binary_op ($2, $$, $3); } - | expr_no_comma_rangle '/' expr_no_comma_rangle - { $$ = build_x_binary_op ($2, $$, $3); } - | expr_no_comma_rangle '%' expr_no_comma_rangle - { $$ = build_x_binary_op ($2, $$, $3); } - | expr_no_comma_rangle LSHIFT expr_no_comma_rangle - { $$ = build_x_binary_op ($2, $$, $3); } - | expr_no_comma_rangle RSHIFT expr_no_comma_rangle - { $$ = build_x_binary_op ($2, $$, $3); } - | expr_no_comma_rangle ARITHCOMPARE expr_no_comma_rangle - { $$ = build_x_binary_op ($2, $$, $3); } - | expr_no_comma_rangle '<' expr_no_comma_rangle - { $$ = build_x_binary_op (LT_EXPR, $$, $3); } - | expr_no_comma_rangle EQCOMPARE expr_no_comma_rangle - { $$ = build_x_binary_op ($2, $$, $3); } - | expr_no_comma_rangle MIN_MAX expr_no_comma_rangle - { $$ = build_x_binary_op ($2, $$, $3); } - | expr_no_comma_rangle '&' expr_no_comma_rangle - { $$ = build_x_binary_op ($2, $$, $3); } - | expr_no_comma_rangle '|' expr_no_comma_rangle - { $$ = build_x_binary_op ($2, $$, $3); } - | expr_no_comma_rangle '^' expr_no_comma_rangle - { $$ = build_x_binary_op ($2, $$, $3); } - | expr_no_comma_rangle ANDAND expr_no_comma_rangle - { $$ = build_x_binary_op (TRUTH_ANDIF_EXPR, $$, $3); } - | expr_no_comma_rangle OROR expr_no_comma_rangle - { $$ = build_x_binary_op (TRUTH_ORIF_EXPR, $$, $3); } - | expr_no_comma_rangle '?' xexpr ':' expr_no_comma_rangle - { $$ = build_x_conditional_expr ($$, $3, $5); } - | expr_no_comma_rangle '=' expr_no_comma_rangle - { $$ = build_x_modify_expr ($$, NOP_EXPR, $3); - if ($$ != error_mark_node) - C_SET_EXP_ORIGINAL_CODE ($$, MODIFY_EXPR); } - | expr_no_comma_rangle ASSIGN expr_no_comma_rangle - { $$ = build_x_modify_expr ($$, $2, $3); } - | THROW - { $$ = build_throw (NULL_TREE); } - | THROW expr_no_comma_rangle - { $$ = build_throw ($2); } - ; - -notype_unqualified_id: - '~' see_typename identifier - { $$ = build_nt (BIT_NOT_EXPR, $3); } - | '~' see_typename template_type - { $$ = build_nt (BIT_NOT_EXPR, $3); } - | template_id - | operator_name - | IDENTIFIER - | PTYPENAME - | NSNAME %prec EMPTY - ; - -do_id: - { - /* If lastiddecl is a BASELINK we're in an - expression like S::f<int>, so don't - do_identifier; we only do that for unqualified - identifiers. */ - if (!lastiddecl || !BASELINK_P (lastiddecl)) - $$ = do_identifier ($<ttype>-1, 3, NULL_TREE); - else - $$ = $<ttype>-1; - } - ; - -template_id: - PFUNCNAME '<' do_id template_arg_list_opt template_close_bracket - { - tree template_name = $3; - if (TREE_CODE (template_name) == COMPONENT_REF) - template_name = TREE_OPERAND (template_name, 1); - $$ = lookup_template_function (template_name, $4); - } - | operator_name '<' do_id template_arg_list_opt template_close_bracket - { - tree template_name = $3; - if (TREE_CODE (template_name) == COMPONENT_REF) - template_name = TREE_OPERAND (template_name, 1); - $$ = lookup_template_function (template_name, $4); - } - ; - -object_template_id: - TEMPLATE identifier '<' template_arg_list_opt template_close_bracket - { $$ = lookup_template_function ($2, $4); } - | TEMPLATE PFUNCNAME '<' template_arg_list_opt template_close_bracket - { $$ = lookup_template_function ($2, $4); } - | TEMPLATE operator_name '<' template_arg_list_opt - template_close_bracket - { $$ = lookup_template_function ($2, $4); } - ; - -unqualified_id: - notype_unqualified_id - | tTYPENAME - | SELFNAME - ; - -expr_or_declarator_intern: - expr_or_declarator - | attributes expr_or_declarator - { - /* Provide support for '(' attributes '*' declarator ')' - etc */ - $$ = tree_cons ($1, $2, NULL_TREE); - } - ; - -expr_or_declarator: - notype_unqualified_id - | '*' expr_or_declarator_intern %prec UNARY - { $$ = build_nt (INDIRECT_REF, $2); } - | '&' expr_or_declarator_intern %prec UNARY - { $$ = build_nt (ADDR_EXPR, $2); } - | '(' expr_or_declarator_intern ')' - { $$ = $2; } - ; - -notype_template_declarator: - IDENTIFIER '<' template_arg_list_opt template_close_bracket - { $$ = lookup_template_function ($1, $3); } - | NSNAME '<' template_arg_list template_close_bracket - { $$ = lookup_template_function ($1, $3); } - ; - -direct_notype_declarator: - complex_direct_notype_declarator - /* This precedence declaration is to prefer this reduce - to the Koenig lookup shift in primary, below. I hate yacc. */ - | notype_unqualified_id %prec '(' - | notype_template_declarator - | '(' expr_or_declarator_intern ')' - { $$ = finish_decl_parsing ($2); } - ; - -primary: - notype_unqualified_id - { - if (TREE_CODE ($1) == BIT_NOT_EXPR) - $$ = build_x_unary_op (BIT_NOT_EXPR, TREE_OPERAND ($1, 0)); - else - $$ = finish_id_expr ($1); - } - | CONSTANT - | boolean_literal - | STRING - { - $$ = fix_string_type ($$); - /* fix_string_type doesn't set up TYPE_MAIN_VARIANT of - a const array the way we want, so fix it. */ - if (flag_const_strings) - TREE_TYPE ($$) = build_cplus_array_type - (TREE_TYPE (TREE_TYPE ($$)), - TYPE_DOMAIN (TREE_TYPE ($$))); - } - | VAR_FUNC_NAME - { $$ = finish_fname ($1); } - | '(' expr ')' - { $$ = finish_parenthesized_expr ($2); } - | '(' expr_or_declarator_intern ')' - { $2 = reparse_decl_as_expr (NULL_TREE, $2); - $$ = finish_parenthesized_expr ($2); } - | '(' error ')' - { $$ = error_mark_node; } - | '(' - { if (!at_function_scope_p ()) - { - error ("braced-group within expression allowed only inside a function"); - YYERROR; - } - if (pedantic) - pedwarn ("ISO C++ forbids braced-groups within expressions"); - $<ttype>$ = begin_stmt_expr (); - } - compstmt_or_stmtexpr ')' - { $$ = finish_stmt_expr ($<ttype>2); } - /* Koenig lookup support - We could store lastiddecl in $1 to avoid another lookup, - but that would result in many additional reduce/reduce conflicts. */ - | notype_unqualified_id '(' nonnull_exprlist ')' - { $$ = parse_finish_call_expr ($1, $3, 1); } - | notype_unqualified_id LEFT_RIGHT - { $$ = parse_finish_call_expr ($1, NULL_TREE, 1); } - | primary '(' nonnull_exprlist ')' - { $$ = parse_finish_call_expr ($1, $3, 0); } - | primary LEFT_RIGHT - { $$ = parse_finish_call_expr ($1, NULL_TREE, 0); } - | VA_ARG '(' expr_no_commas ',' type_id ')' - { $$ = build_x_va_arg ($3, groktypename ($5.t)); - check_for_new_type ("__builtin_va_arg", $5); } - | primary '[' expr ']' - { $$ = grok_array_decl ($$, $3); } - | primary PLUSPLUS - { $$ = finish_increment_expr ($1, POSTINCREMENT_EXPR); } - | primary MINUSMINUS - { $$ = finish_increment_expr ($1, POSTDECREMENT_EXPR); } - /* C++ extensions */ - | THIS - { $$ = finish_this_expr (); } - | CV_QUALIFIER '(' nonnull_exprlist ')' - { - /* This is a C cast in C++'s `functional' notation - using the "implicit int" extension so that: - `const (3)' is equivalent to `const int (3)'. */ - tree type; - - type = hash_tree_cons (NULL_TREE, $1, NULL_TREE); - type = groktypename (build_tree_list (type, NULL_TREE)); - $$ = build_functional_cast (type, $3); - } - | functional_cast - | DYNAMIC_CAST '<' type_id '>' '(' expr ')' - { tree type = groktypename ($3.t); - check_for_new_type ("dynamic_cast", $3); - $$ = build_dynamic_cast (type, $6); } - | STATIC_CAST '<' type_id '>' '(' expr ')' - { tree type = groktypename ($3.t); - check_for_new_type ("static_cast", $3); - $$ = build_static_cast (type, $6); } - | REINTERPRET_CAST '<' type_id '>' '(' expr ')' - { tree type = groktypename ($3.t); - check_for_new_type ("reinterpret_cast", $3); - $$ = build_reinterpret_cast (type, $6); } - | CONST_CAST '<' type_id '>' '(' expr ')' - { tree type = groktypename ($3.t); - check_for_new_type ("const_cast", $3); - $$ = build_const_cast (type, $6); } - | TYPEID '(' expr ')' - { $$ = build_typeid ($3); } - | TYPEID '(' type_id ')' - { tree type = groktypename ($3.t); - check_for_new_type ("typeid", $3); - $$ = get_typeid (type); } - | global_scope IDENTIFIER - { $$ = parse_scoped_id ($2); } - | global_scope template_id - { $$ = $2; } - | global_scope operator_name - { - got_scope = NULL_TREE; - if (TREE_CODE ($2) == IDENTIFIER_NODE) - $$ = parse_scoped_id ($2); - else - $$ = $2; - } - | overqualified_id %prec HYPERUNARY - { $$ = build_offset_ref (OP0 ($$), OP1 ($$)); - if (!class_template_ok_as_expr - && DECL_CLASS_TEMPLATE_P ($$)) - { - error ("invalid use of template `%D'", $$); - $$ = error_mark_node; - } - } - | overqualified_id '(' nonnull_exprlist ')' - { $$ = parse_finish_call_expr ($1, $3, 0); } - | overqualified_id LEFT_RIGHT - { $$ = parse_finish_call_expr ($1, NULL_TREE, 0); } - | object object_template_id %prec UNARY - { $$ = finish_class_member_access_expr ($$, $2); } - | object object_template_id '(' nonnull_exprlist ')' - { $$ = finish_object_call_expr ($2, $1, $4); } - | object object_template_id LEFT_RIGHT - { $$ = finish_object_call_expr ($2, $1, NULL_TREE); } - | object unqualified_id %prec UNARY - { $$ = finish_class_member_access_expr ($$, $2); } - | object overqualified_id %prec UNARY - { $$ = finish_class_member_access_expr ($1, $2); } - | object unqualified_id '(' nonnull_exprlist ')' - { $$ = finish_object_call_expr ($2, $1, $4); } - | object unqualified_id LEFT_RIGHT - { $$ = finish_object_call_expr ($2, $1, NULL_TREE); } - | object overqualified_id '(' nonnull_exprlist ')' - { $$ = finish_qualified_object_call_expr ($2, $1, $4); } - | object overqualified_id LEFT_RIGHT - { $$ = finish_qualified_object_call_expr ($2, $1, NULL_TREE); } - /* p->int::~int() is valid -- 12.4 */ - | object '~' TYPESPEC LEFT_RIGHT - { $$ = finish_pseudo_destructor_call_expr ($1, NULL_TREE, $3); } - | object TYPESPEC SCOPE '~' TYPESPEC LEFT_RIGHT - { $$ = finish_pseudo_destructor_call_expr ($1, $2, $5); } - | object error - { - $$ = error_mark_node; - } - ; - -/* Not needed for now. - -primary_no_id: - '(' expr ')' - { $$ = $2; } - | '(' error ')' - { $$ = error_mark_node; } - | '(' - { if (current_function_decl == 0) - { - error ("braced-group within expression allowed only inside a function"); - YYERROR; - } - $<ttype>$ = expand_start_stmt_expr (); } - compstmt_or_stmtexpr ')' - { if (pedantic) - pedwarn ("ISO C++ forbids braced-groups within expressions"); - $$ = expand_end_stmt_expr ($<ttype>2); } - | primary_no_id '(' nonnull_exprlist ')' - { $$ = build_x_function_call ($$, $3, current_class_ref); } - | primary_no_id LEFT_RIGHT - { $$ = build_x_function_call ($$, NULL_TREE, current_class_ref); } - | primary_no_id '[' expr ']' - { goto do_array; } - | primary_no_id PLUSPLUS - { $$ = build_x_unary_op (POSTINCREMENT_EXPR, $$); } - | primary_no_id MINUSMINUS - { $$ = build_x_unary_op (POSTDECREMENT_EXPR, $$); } - | SCOPE IDENTIFIER - { goto do_scoped_id; } - | SCOPE operator_name - { if (TREE_CODE ($2) == IDENTIFIER_NODE) - goto do_scoped_id; - goto do_scoped_operator; - } - ; -*/ - -new: - NEW - { $$ = 0; } - | global_scope NEW - { got_scope = NULL_TREE; $$ = 1; } - ; - -delete: - DELETE - { $$ = 0; } - | global_scope delete - { got_scope = NULL_TREE; $$ = 1; } - ; - -boolean_literal: - CXX_TRUE - { $$ = boolean_true_node; } - | CXX_FALSE - { $$ = boolean_false_node; } - ; - -nodecls: - /* empty */ - { - if (DECL_CONSTRUCTOR_P (current_function_decl)) - finish_mem_initializers (NULL_TREE); - } - ; - -object: - primary '.' - { got_object = TREE_TYPE ($$); } - | primary POINTSAT - { - $$ = build_x_arrow ($$); - got_object = TREE_TYPE ($$); - } - ; - -decl: - typespec initdecls ';' - { - if ($1.t && IS_AGGR_TYPE_CODE (TREE_CODE ($1.t))) - note_got_semicolon ($1.t); - } - | typed_declspecs initdecls ';' - { - note_list_got_semicolon ($1.t); - } - | declmods notype_initdecls ';' - {} - | typed_declspecs ';' - { - shadow_tag ($1.t); - note_list_got_semicolon ($1.t); - } - | declmods ';' - { warning ("empty declaration"); } - | extension decl - { pedantic = $1; } - ; - -/* Any kind of declarator (thus, all declarators allowed - after an explicit typespec). */ - -declarator: - after_type_declarator %prec EMPTY - | notype_declarator %prec EMPTY - ; - -/* This is necessary to postpone reduction of `int()()()()'. */ -fcast_or_absdcl: - LEFT_RIGHT %prec EMPTY - { $$ = make_call_declarator (NULL_TREE, empty_parms (), - NULL_TREE, NULL_TREE); } - | fcast_or_absdcl LEFT_RIGHT %prec EMPTY - { $$ = make_call_declarator ($$, empty_parms (), NULL_TREE, - NULL_TREE); } - ; - -/* ISO type-id (8.1) */ -type_id: - typed_typespecs absdcl - { $$.t = build_tree_list ($1.t, $2); - $$.new_type_flag = $1.new_type_flag; } - | nonempty_cv_qualifiers absdcl - { $$.t = build_tree_list ($1.t, $2); - $$.new_type_flag = $1.new_type_flag; } - | typespec absdcl - { $$.t = build_tree_list (build_tree_list (NULL_TREE, $1.t), - $2); - $$.new_type_flag = $1.new_type_flag; } - | typed_typespecs %prec EMPTY - { $$.t = build_tree_list ($1.t, NULL_TREE); - $$.new_type_flag = $1.new_type_flag; } - | nonempty_cv_qualifiers %prec EMPTY - { $$.t = build_tree_list ($1.t, NULL_TREE); - $$.new_type_flag = $1.new_type_flag; } - ; - -/* Declspecs which contain at least one type specifier or typedef name. - (Just `const' or `volatile' is not enough.) - A typedef'd name following these is taken as a name to be declared. - In the result, declspecs have a non-NULL TREE_VALUE, attributes do not. */ - -typed_declspecs: - typed_typespecs %prec EMPTY - { $$.lookups = type_lookups; } - | typed_declspecs1 - { $$.lookups = type_lookups; } - ; - -typed_declspecs1: - declmods typespec - { $$.t = tree_cons (NULL_TREE, $2.t, $1.t); - $$.new_type_flag = $2.new_type_flag; } - | typespec reserved_declspecs %prec HYPERUNARY - { $$.t = tree_cons (NULL_TREE, $1.t, $2); - $$.new_type_flag = $1.new_type_flag; } - | typespec reserved_typespecquals reserved_declspecs - { $$.t = tree_cons (NULL_TREE, $1.t, chainon ($2, $3)); - $$.new_type_flag = $1.new_type_flag; } - | declmods typespec reserved_declspecs - { $$.t = tree_cons (NULL_TREE, $2.t, chainon ($3, $1.t)); - $$.new_type_flag = $2.new_type_flag; } - | declmods typespec reserved_typespecquals - { $$.t = tree_cons (NULL_TREE, $2.t, chainon ($3, $1.t)); - $$.new_type_flag = $2.new_type_flag; } - | declmods typespec reserved_typespecquals reserved_declspecs - { $$.t = tree_cons (NULL_TREE, $2.t, - chainon ($3, chainon ($4, $1.t))); - $$.new_type_flag = $2.new_type_flag; } - ; - -reserved_declspecs: - SCSPEC - { if (extra_warnings) - warning ("`%s' is not at beginning of declaration", - IDENTIFIER_POINTER ($$)); - $$ = build_tree_list (NULL_TREE, $$); } - | reserved_declspecs typespecqual_reserved - { $$ = tree_cons (NULL_TREE, $2.t, $$); } - | reserved_declspecs SCSPEC - { if (extra_warnings) - warning ("`%s' is not at beginning of declaration", - IDENTIFIER_POINTER ($2)); - $$ = tree_cons (NULL_TREE, $2, $$); } - ; - -/* List of just storage classes and type modifiers. - A declaration can start with just this, but then it cannot be used - to redeclare a typedef-name. - In the result, declspecs have a non-NULL TREE_VALUE, attributes do not. */ - -/* We use hash_tree_cons for lists of typeless declspecs so that they end - up on a persistent obstack. Otherwise, they could appear at the - beginning of something like - - static const struct { int foo () { } } b; - - and would be discarded after we finish compiling foo. We don't need to - worry once we see a type. */ - -declmods: - nonempty_cv_qualifiers %prec EMPTY - { $$.lookups = NULL_TREE; TREE_STATIC ($$.t) = 1; } - | SCSPEC - { - $$.t = hash_tree_cons (NULL_TREE, $1, NULL_TREE); - $$.new_type_flag = 0; $$.lookups = NULL_TREE; - } - | declmods CV_QUALIFIER - { - $$.t = hash_tree_cons (NULL_TREE, $2, $1.t); - TREE_STATIC ($$.t) = 1; - } - | declmods SCSPEC - { - if (extra_warnings && TREE_STATIC ($$.t)) - warning ("`%s' is not at beginning of declaration", - IDENTIFIER_POINTER ($2)); - $$.t = hash_tree_cons (NULL_TREE, $2, $1.t); - TREE_STATIC ($$.t) = TREE_STATIC ($1.t); - } - | declmods attributes - { $$.t = hash_tree_cons ($2, NULL_TREE, $1.t); } - ; - -/* Used instead of declspecs where storage classes are not allowed - (that is, for typenames and structure components). - - C++ can takes storage classes for structure components. - Don't accept a typedef-name if anything but a modifier precedes it. */ - -typed_typespecs: - typespec %prec EMPTY - { $$.t = build_tree_list (NULL_TREE, $1.t); - $$.new_type_flag = $1.new_type_flag; } - | nonempty_cv_qualifiers typespec - { $$.t = tree_cons (NULL_TREE, $2.t, $1.t); - $$.new_type_flag = $2.new_type_flag; } - | typespec reserved_typespecquals - { $$.t = tree_cons (NULL_TREE, $1.t, $2); - $$.new_type_flag = $1.new_type_flag; } - | nonempty_cv_qualifiers typespec reserved_typespecquals - { $$.t = tree_cons (NULL_TREE, $2.t, chainon ($3, $1.t)); - $$.new_type_flag = $2.new_type_flag; } - ; - -reserved_typespecquals: - typespecqual_reserved - { $$ = build_tree_list (NULL_TREE, $1.t); } - | reserved_typespecquals typespecqual_reserved - { $$ = tree_cons (NULL_TREE, $2.t, $1); } - | reserved_typespecquals attributes - { $$ = tree_cons ($2, NULL_TREE, $1); } - | attributes %prec EMPTY - { $$ = tree_cons ($1, NULL_TREE, NULL_TREE); } - ; - -sizeof: - SIZEOF { skip_evaluation++; } - ; - -alignof: - ALIGNOF { skip_evaluation++; } - ; - -typeof: - TYPEOF { skip_evaluation++; } - ; - -/* A typespec (but not a type qualifier). - Once we have seen one of these in a declaration, - if a typedef name appears then it is being redeclared. */ - -typespec: - structsp - { $$.lookups = NULL_TREE; } - | TYPESPEC %prec EMPTY - { $$.t = $1; $$.new_type_flag = 0; $$.lookups = NULL_TREE; } - | complete_type_name - { $$.t = $1; $$.new_type_flag = 0; $$.lookups = NULL_TREE; } - | typeof '(' expr ')' - { $$.t = finish_typeof ($3); - $$.new_type_flag = 0; $$.lookups = NULL_TREE; - skip_evaluation--; } - | typeof '(' type_id ')' - { $$.t = groktypename ($3.t); - $$.new_type_flag = 0; $$.lookups = NULL_TREE; - skip_evaluation--; } - | SIGOF '(' expr ')' - { tree type = TREE_TYPE ($3); - - $$.new_type_flag = 0; $$.lookups = NULL_TREE; - if (IS_AGGR_TYPE (type)) - { - sorry ("sigof type specifier"); - $$.t = type; - } - else - { - error ("`sigof' applied to non-aggregate expression"); - $$.t = error_mark_node; - } - } - | SIGOF '(' type_id ')' - { tree type = groktypename ($3.t); - - $$.new_type_flag = 0; $$.lookups = NULL_TREE; - if (IS_AGGR_TYPE (type)) - { - sorry ("sigof type specifier"); - $$.t = type; - } - else - { - error("`sigof' applied to non-aggregate type"); - $$.t = error_mark_node; - } - } - ; - -/* A typespec that is a reserved word, or a type qualifier. */ - -typespecqual_reserved: - TYPESPEC - { $$.t = $1; $$.new_type_flag = 0; } - | CV_QUALIFIER - { $$.t = $1; $$.new_type_flag = 0; } - | structsp - ; - -initdecls: - initdcl0 - | initdecls ',' initdcl - { check_multiple_declarators (); } - ; - -notype_initdecls: - notype_initdcl0 - | notype_initdecls ',' initdcl - { check_multiple_declarators (); } - ; - -nomods_initdecls: - nomods_initdcl0 - | nomods_initdecls ',' initdcl - { check_multiple_declarators (); } - ; - -maybeasm: - /* empty */ - { $$ = NULL_TREE; } - | asm_keyword '(' STRING ')' - { $$ = $3; } - ; - -initdcl: - declarator maybeasm maybe_attribute '=' - { $<ttype>$ = parse_decl ($<ttype>1, $3, 1); } - init -/* Note how the declaration of the variable is in effect while its init is parsed! */ - { parse_end_decl ($<ttype>5, $6, $2); } - | declarator maybeasm maybe_attribute - { - $<ttype>$ = parse_decl ($<ttype>1, $3, 0); - parse_end_decl ($<ttype>$, NULL_TREE, $2); - } - ; - - /* This rule assumes a certain configuration of the parser stack. - In particular, $0, the element directly before the beginning of - this rule on the stack, must be a maybeasm. $-1 must be a - declarator or notype_declarator. And $-2 must be some declmods - or declspecs. We can't move the maybeasm into this rule because - we need that reduce so we prefer fn.def1 when appropriate. */ -initdcl0_innards: - maybe_attribute '=' - { $<ttype>$ = parse_decl0 ($<ttype>-1, $<ftype>-2.t, - $<ftype>-2.lookups, $1, 1); } - /* Note how the declaration of the variable is in effect - while its init is parsed! */ - init - { parse_end_decl ($<ttype>3, $4, $<ttype>0); } - | maybe_attribute - { tree d = parse_decl0 ($<ttype>-1, $<ftype>-2.t, - $<ftype>-2.lookups, $1, 0); - parse_end_decl (d, NULL_TREE, $<ttype>0); } - ; - -initdcl0: - declarator maybeasm initdcl0_innards - {} - ; - -notype_initdcl0: - notype_declarator maybeasm initdcl0_innards - {} - ; - -nomods_initdcl0: - notype_declarator maybeasm - { /* Set things up as initdcl0_innards expects. */ - $<ttype>$ = $2; - $2 = $1; - $<ftype>1.t = NULL_TREE; - $<ftype>1.lookups = NULL_TREE; } - initdcl0_innards - {} - | constructor_declarator maybeasm maybe_attribute - { tree d = parse_decl0 ($1, NULL_TREE, NULL_TREE, $3, 0); - parse_end_decl (d, NULL_TREE, $2); } - ; - -/* the * rules are dummies to accept the Apollo extended syntax - so that the header files compile. */ -maybe_attribute: - /* empty */ - { $$ = NULL_TREE; } - | attributes - { $$ = $1; } - ; - -attributes: - attribute - { $$ = $1; } - | attributes attribute - { $$ = chainon ($1, $2); } - ; - -attribute: - ATTRIBUTE '(' '(' attribute_list ')' ')' - { $$ = $4; } - ; - -attribute_list: - attrib - { $$ = $1; } - | attribute_list ',' attrib - { $$ = chainon ($1, $3); } - ; - -attrib: - /* empty */ - { $$ = NULL_TREE; } - | any_word - { $$ = build_tree_list ($1, NULL_TREE); } - | any_word '(' IDENTIFIER ')' - { $$ = build_tree_list ($1, build_tree_list (NULL_TREE, $3)); } - | any_word '(' IDENTIFIER ',' nonnull_exprlist ')' - { $$ = build_tree_list ($1, tree_cons (NULL_TREE, $3, $5)); } - | any_word '(' nonnull_exprlist ')' - { $$ = build_tree_list ($1, $3); } - ; - -/* This still leaves out most reserved keywords, - shouldn't we include them? */ - -any_word: - identifier - | SCSPEC - | TYPESPEC - | CV_QUALIFIER - ; - -/* A nonempty list of identifiers, including typenames. */ -identifiers_or_typenames: - identifier - { $$ = build_tree_list (NULL_TREE, $1); } - | identifiers_or_typenames ',' identifier - { $$ = chainon ($1, build_tree_list (NULL_TREE, $3)); } - ; - -maybe_init: - /* empty */ %prec EMPTY - { $$ = NULL_TREE; } - | '=' init - { $$ = $2; } - ; - -/* If we are processing a template, we don't want to expand this - initializer yet. */ - -init: - expr_no_commas %prec '=' - | '{' '}' - { $$ = build_nt (CONSTRUCTOR, NULL_TREE, NULL_TREE); - TREE_HAS_CONSTRUCTOR ($$) = 1; } - | '{' initlist '}' - { $$ = build_nt (CONSTRUCTOR, NULL_TREE, nreverse ($2)); - TREE_HAS_CONSTRUCTOR ($$) = 1; } - | '{' initlist ',' '}' - { $$ = build_nt (CONSTRUCTOR, NULL_TREE, nreverse ($2)); - TREE_HAS_CONSTRUCTOR ($$) = 1; } - | error - { $$ = NULL_TREE; } - ; - -/* This chain is built in reverse order, - and put in forward order where initlist is used. */ -initlist: - init - { $$ = build_tree_list (NULL_TREE, $$); } - | initlist ',' init - { $$ = tree_cons (NULL_TREE, $3, $$); } - /* These are for labeled elements. */ - | '[' expr_no_commas ']' init - { $$ = build_tree_list ($2, $4); } - | identifier ':' init - { $$ = build_tree_list ($$, $3); } - | initlist ',' identifier ':' init - { $$ = tree_cons ($3, $5, $$); } - ; - -pending_inline: - PRE_PARSED_FUNCTION_DECL maybe_return_init function_body - { - expand_body (finish_function (2)); - process_next_inline ($1); - } - | PRE_PARSED_FUNCTION_DECL maybe_return_init function_try_block - { - expand_body (finish_function (2)); - process_next_inline ($1); - } - | PRE_PARSED_FUNCTION_DECL maybe_return_init error - { - finish_function (2); - process_next_inline ($1); } - ; - -pending_inlines: - /* empty */ - | pending_inlines pending_inline eat_saved_input - ; - -/* A regurgitated default argument. The value of DEFARG_MARKER will be - the TREE_LIST node for the parameter in question. */ -defarg_again: - DEFARG_MARKER expr_no_commas END_OF_SAVED_INPUT - { replace_defarg ($1, $2); } - | DEFARG_MARKER error END_OF_SAVED_INPUT - { replace_defarg ($1, error_mark_node); } - ; - -pending_defargs: - /* empty */ %prec EMPTY - | pending_defargs defarg_again - { do_pending_defargs (); } - | pending_defargs error - { do_pending_defargs (); } - ; - -structsp: - ENUM identifier '{' - { $<ttype>$ = current_enum_type; - current_enum_type = start_enum ($2); } - enumlist_opt '}' - { $$.t = current_enum_type; - finish_enum (current_enum_type); - $$.new_type_flag = 1; - current_enum_type = $<ttype>4; - check_for_missing_semicolon ($$.t); } - | ENUM '{' - { $<ttype>$ = current_enum_type; - current_enum_type = start_enum (make_anon_name ()); } - enumlist_opt '}' - { $$.t = current_enum_type; - finish_enum (current_enum_type); - $$.new_type_flag = 1; - current_enum_type = $<ttype>3; - check_for_missing_semicolon ($$.t); } - | ENUM identifier - { $$.t = parse_xref_tag (enum_type_node, $2, 1); - $$.new_type_flag = 0; } - | ENUM complex_type_name - { $$.t = parse_xref_tag (enum_type_node, $2, 1); - $$.new_type_flag = 0; } - | TYPENAME_KEYWORD typename_sub - { $$.t = $2; - $$.new_type_flag = 0; - if (!processing_template_decl) - pedwarn ("using `typename' outside of template"); } - /* C++ extensions, merged with C to avoid shift/reduce conflicts */ - | class_head_defn maybe_base_class_list '{' - { - if ($2 && $1.t != error_mark_node) - { - tree type = TREE_TYPE ($1.t); - - if (TREE_CODE (type) == TYPENAME_TYPE) - { - if (IMPLICIT_TYPENAME_P (type)) - /* In a definition of a member class template, - we will get here with an implicit typename, - a TYPENAME_TYPE with a type. */ - type = TREE_TYPE (type); - else - { - error ("qualified name does not name a class"); - type = error_mark_node; - } - } - maybe_process_partial_specialization (type); - xref_basetypes (type, $2); - } - $1.t = begin_class_definition (TREE_TYPE ($1.t)); - check_class_key (current_aggr, $1.t); - current_aggr = NULL_TREE; } - opt.component_decl_list '}' maybe_attribute - { - int semi; - tree t; - - if (yychar == YYEMPTY) - yychar = YYLEX; - semi = yychar == ';'; - - t = finish_class_definition ($1.t, $7, semi, $1.new_type_flag); - $<ttype>$ = t; - - /* restore current_aggr */ - current_aggr = TREE_CODE (t) != RECORD_TYPE - ? union_type_node - : CLASSTYPE_DECLARED_CLASS (t) - ? class_type_node : record_type_node; - } - pending_defargs - { - done_pending_defargs (); - begin_inline_definitions (); - } - pending_inlines - { - $$.t = $<ttype>8; - $$.new_type_flag = 1; - } - | class_head_decl - { - $$.t = TREE_TYPE ($1.t); - $$.new_type_flag = $1.new_type_flag; - check_class_key (current_aggr, $$.t); - } - ; - -maybecomma: - /* empty */ - | ',' - ; - -maybecomma_warn: - /* empty */ - | ',' - { if (pedantic && !in_system_header) - pedwarn ("comma at end of enumerator list"); } - ; - -aggr: - AGGR - | aggr SCSPEC - { error ("storage class specifier `%s' not allowed after struct or class", IDENTIFIER_POINTER ($2)); } - | aggr TYPESPEC - { error ("type specifier `%s' not allowed after struct or class", IDENTIFIER_POINTER ($2)); } - | aggr CV_QUALIFIER - { error ("type qualifier `%s' not allowed after struct or class", IDENTIFIER_POINTER ($2)); } - | aggr AGGR - { error ("no body nor ';' separates two class, struct or union declarations"); } - | aggr attributes - { $$ = build_tree_list ($2, $1); } - ; - -class_head: - aggr identifier - { - current_aggr = $1; - $$ = build_tree_list (NULL_TREE, $2); - } - | aggr nested_name_specifier identifier - { - current_aggr = $1; - $$ = build_tree_list ($2, $3); - } - | aggr global_scope nested_name_specifier identifier - { - current_aggr = $1; - $$ = build_tree_list ($3, $4); - } - | aggr global_scope identifier - { - current_aggr = $1; - $$ = build_tree_list (global_namespace, $3); - } - ; - -class_head_apparent_template: - aggr apparent_template_type - { - current_aggr = $1; - $$ = $2; - } - | aggr nested_name_specifier apparent_template_type - { - current_aggr = $1; - $$ = $3; - } - | aggr global_scope nested_name_specifier apparent_template_type - { - current_aggr = $1; - $$ = $4; - } - ; - -class_head_decl: - class_head %prec EMPTY - { - $$.t = parse_handle_class_head (current_aggr, - TREE_PURPOSE ($1), - TREE_VALUE ($1), - 0, &$$.new_type_flag); - } - | aggr identifier_defn %prec EMPTY - { - current_aggr = $1; - $$.t = TYPE_MAIN_DECL (parse_xref_tag (current_aggr, $2, 0)); - $$.new_type_flag = 1; - } - | class_head_apparent_template %prec EMPTY - { - $$.t = $1; - $$.new_type_flag = 0; - } - ; - -class_head_defn: - class_head '{' - { - yyungetc ('{', 1); - $$.t = parse_handle_class_head (current_aggr, - TREE_PURPOSE ($1), - TREE_VALUE ($1), - 1, - &$$.new_type_flag); - } - | class_head ':' - { - yyungetc (':', 1); - $$.t = parse_handle_class_head (current_aggr, - TREE_PURPOSE ($1), - TREE_VALUE ($1), - 1, &$$.new_type_flag); - } - | class_head_apparent_template '{' - { - yyungetc ('{', 1); - $$.t = handle_class_head_apparent_template - ($1, &$$.new_type_flag); - } - | class_head_apparent_template ':' - { - yyungetc (':', 1); - $$.t = handle_class_head_apparent_template - ($1, &$$.new_type_flag); - } - | aggr identifier_defn '{' - { - yyungetc ('{', 1); - current_aggr = $1; - $$.t = parse_handle_class_head (current_aggr, - NULL_TREE, $2, - 1, &$$.new_type_flag); - } - | aggr identifier_defn ':' - { - yyungetc (':', 1); - current_aggr = $1; - $$.t = parse_handle_class_head (current_aggr, - NULL_TREE, $2, - 1, &$$.new_type_flag); - } - | aggr '{' - { - current_aggr = $1; - $$.t = TYPE_MAIN_DECL (parse_xref_tag ($1, - make_anon_name (), - 0)); - $$.new_type_flag = 0; - CLASSTYPE_DECLARED_CLASS (TREE_TYPE ($$.t)) - = $1 == class_type_node; - yyungetc ('{', 1); - } - ; - -maybe_base_class_list: - /* empty */ - { $$ = NULL_TREE; } - | ':' see_typename - { error ("no bases given following `:'"); - $$ = NULL_TREE; } - | ':' see_typename base_class_list - { $$ = $3; } - ; - -base_class_list: - base_class - | base_class_list ',' see_typename base_class - { $$ = chainon ($$, $4); } - ; - -base_class: - base_class_1 - { $$ = finish_base_specifier (access_default_node, $1); } - | base_class_access_list see_typename base_class_1 - { $$ = finish_base_specifier ($1, $3); } - ; - -base_class_1: - typename_sub - { if (!TYPE_P ($$)) - $$ = error_mark_node; } - | nonnested_type - { $$ = TREE_TYPE ($$); } - ; - -base_class_access_list: - VISSPEC see_typename - | SCSPEC see_typename - { if ($1 != ridpointers[(int)RID_VIRTUAL]) - error ("`%D' access", $1); - $$ = access_default_virtual_node; } - | base_class_access_list VISSPEC see_typename - { - if ($1 != access_default_virtual_node) - error ("multiple access specifiers"); - else if ($2 == access_public_node) - $$ = access_public_virtual_node; - else if ($2 == access_protected_node) - $$ = access_protected_virtual_node; - else /* $2 == access_private_node */ - $$ = access_private_virtual_node; - } - | base_class_access_list SCSPEC see_typename - { if ($2 != ridpointers[(int)RID_VIRTUAL]) - error ("`%D' access", $2); - else if ($$ == access_public_node) - $$ = access_public_virtual_node; - else if ($$ == access_protected_node) - $$ = access_protected_virtual_node; - else if ($$ == access_private_node) - $$ = access_private_virtual_node; - else - error ("multiple `virtual' specifiers"); - } - ; - -opt.component_decl_list: - | component_decl_list - | opt.component_decl_list access_specifier component_decl_list - | opt.component_decl_list access_specifier - ; - -access_specifier: - VISSPEC ':' - { - current_access_specifier = $1; - } - ; - -/* Note: we no longer warn about the semicolon after a component_decl_list. - ARM $9.2 says that the semicolon is optional, and therefore allowed. */ -component_decl_list: - component_decl - { - finish_member_declaration ($1); - current_aggr = NULL_TREE; - reset_type_access_control (); - } - | component_decl_list component_decl - { - finish_member_declaration ($2); - current_aggr = NULL_TREE; - reset_type_access_control (); - } - ; - -component_decl: - component_decl_1 ';' - | component_decl_1 '}' - { error ("missing ';' before right brace"); - yyungetc ('}', 0); } - /* C++: handle constructors, destructors and inline functions */ - /* note that INLINE is like a TYPESPEC */ - | fn_def2 ':' /* base_init compstmt */ - { $$ = finish_method ($$); } - | fn_def2 TRY /* base_init compstmt */ - { $$ = finish_method ($$); } - | fn_def2 RETURN_KEYWORD /* base_init compstmt */ - { $$ = finish_method ($$); } - | fn_def2 '{' /* nodecls compstmt */ - { $$ = finish_method ($$); } - | ';' - { $$ = NULL_TREE; } - | extension component_decl - { $$ = $2; - pedantic = $1; } - | template_header component_decl - { - if ($2) - $$ = finish_member_template_decl ($2); - else - /* The component was already processed. */ - $$ = NULL_TREE; - - finish_template_decl ($1); - } - | template_header typed_declspecs ';' - { - $$ = finish_member_class_template ($2.t); - finish_template_decl ($1); - } - | bad_decl - { $$ = NULL_TREE; } - ; - -component_decl_1: - /* Do not add a "typed_declspecs declarator" rule here for - speed; we need to call grok_x_components for enums, so the - speedup would be insignificant. */ - typed_declspecs components - { - /* Most of the productions for component_decl only - allow the creation of one new member, so we call - finish_member_declaration in component_decl_list. - For this rule and the next, however, there can be - more than one member, e.g.: - - int i, j; - - and we need the first member to be fully - registered before the second is processed. - Therefore, the rules for components take care of - this processing. To avoid registering the - components more than once, we send NULL_TREE up - here; that lets finish_member_declaration know - that there is nothing to do. */ - if (!$2) - grok_x_components ($1.t); - $$ = NULL_TREE; - } - | declmods notype_components - { - if (!$2) - grok_x_components ($1.t); - $$ = NULL_TREE; - } - | notype_declarator maybeasm maybe_attribute maybe_init - { $$ = grokfield ($$, NULL_TREE, $4, $2, $3); } - | constructor_declarator maybeasm maybe_attribute maybe_init - { $$ = grokfield ($$, NULL_TREE, $4, $2, $3); } - | ':' expr_no_commas - { $$ = grokbitfield (NULL_TREE, NULL_TREE, $2); } - | error - { $$ = NULL_TREE; } - - /* These rules introduce a reduce/reduce conflict; in - typedef int foo, bar; - class A { - foo (bar); - }; - should "A::foo" be declared as a function or "A::bar" as a data - member? In other words, is "bar" an after_type_declarator or a - parmlist? */ - | declmods component_constructor_declarator maybeasm maybe_attribute maybe_init - { tree specs, attrs; - split_specs_attrs ($1.t, &specs, &attrs); - $$ = grokfield ($2, specs, $5, $3, - chainon ($4, attrs)); } - | component_constructor_declarator maybeasm maybe_attribute maybe_init - { $$ = grokfield ($$, NULL_TREE, $4, $2, $3); } - | using_decl - { $$ = do_class_using_decl ($1); } - ; - -/* The case of exactly one component is handled directly by component_decl. */ -/* ??? Huh? ^^^ */ -components: - /* empty: possibly anonymous */ - { $$ = 0; } - | component_declarator0 - { - if (PROCESSING_REAL_TEMPLATE_DECL_P ()) - $1 = finish_member_template_decl ($1); - finish_member_declaration ($1); - $$ = 1; - } - | components ',' component_declarator - { - check_multiple_declarators (); - if (PROCESSING_REAL_TEMPLATE_DECL_P ()) - $3 = finish_member_template_decl ($3); - finish_member_declaration ($3); - $$ = 2; - } - ; - -notype_components: - /* empty: possibly anonymous */ - { $$ = 0; } - | notype_component_declarator0 - { - if (PROCESSING_REAL_TEMPLATE_DECL_P ()) - $1 = finish_member_template_decl ($1); - finish_member_declaration ($1); - $$ = 1; - } - | notype_components ',' notype_component_declarator - { - check_multiple_declarators (); - if (PROCESSING_REAL_TEMPLATE_DECL_P ()) - $3 = finish_member_template_decl ($3); - finish_member_declaration ($3); - $$ = 2; - } - ; - -component_declarator0: - after_type_component_declarator0 - | notype_component_declarator0 - ; - -component_declarator: - after_type_component_declarator - | notype_component_declarator - ; - -after_type_component_declarator0: - after_type_declarator maybeasm maybe_attribute maybe_init - { $$ = parse_field0 ($1, $<ftype>0.t, $<ftype>0.lookups, - $3, $2, $4); } - | tTYPENAME ':' expr_no_commas maybe_attribute - { $$ = parse_bitfield0 ($1, $<ftype>0.t, $<ftype>0.lookups, - $4, $3); } - ; - -notype_component_declarator0: - notype_declarator maybeasm maybe_attribute maybe_init - { $$ = parse_field0 ($1, $<ftype>0.t, $<ftype>0.lookups, - $3, $2, $4); } - | constructor_declarator maybeasm maybe_attribute maybe_init - { $$ = parse_field0 ($1, $<ftype>0.t, $<ftype>0.lookups, - $3, $2, $4); } - | IDENTIFIER ':' expr_no_commas maybe_attribute - { $$ = parse_bitfield0 ($1, $<ftype>0.t, $<ftype>0.lookups, - $4, $3); } - | ':' expr_no_commas maybe_attribute - { $$ = parse_bitfield0 (NULL_TREE, $<ftype>0.t, - $<ftype>0.lookups, $3, $2); } - ; - -after_type_component_declarator: - after_type_declarator maybeasm maybe_attribute maybe_init - { $$ = parse_field ($1, $3, $2, $4); } - | tTYPENAME ':' expr_no_commas maybe_attribute - { $$ = parse_bitfield ($1, $4, $3); } - ; - -notype_component_declarator: - notype_declarator maybeasm maybe_attribute maybe_init - { $$ = parse_field ($1, $3, $2, $4); } - | IDENTIFIER ':' expr_no_commas maybe_attribute - { $$ = parse_bitfield ($1, $4, $3); } - | ':' expr_no_commas maybe_attribute - { $$ = parse_bitfield (NULL_TREE, $3, $2); } - ; - -enumlist_opt: - enumlist maybecomma_warn - | maybecomma_warn - ; - -/* We chain the enumerators in reverse order. - Because of the way enums are built, the order is - insignificant. Take advantage of this fact. */ - -enumlist: - enumerator - | enumlist ',' enumerator - ; - -enumerator: - identifier - { build_enumerator ($1, NULL_TREE, current_enum_type); } - | identifier '=' expr_no_commas - { build_enumerator ($1, $3, current_enum_type); } - ; - -/* ISO new-type-id (5.3.4) */ -new_type_id: - type_specifier_seq new_declarator - { $$.t = build_tree_list ($1.t, $2); - $$.new_type_flag = $1.new_type_flag; } - | type_specifier_seq %prec EMPTY - { $$.t = build_tree_list ($1.t, NULL_TREE); - $$.new_type_flag = $1.new_type_flag; } - /* GNU extension to allow arrays of arbitrary types with - non-constant dimension. */ - | '(' type_id ')' '[' expr ']' - { - if (pedantic) - pedwarn ("ISO C++ forbids array dimensions with parenthesized type in new"); - $$.t = build_nt (ARRAY_REF, TREE_VALUE ($2.t), $5); - $$.t = build_tree_list (TREE_PURPOSE ($2.t), $$.t); - $$.new_type_flag = $2.new_type_flag; - } - ; - -cv_qualifiers: - /* empty */ %prec EMPTY - { $$ = NULL_TREE; } - | cv_qualifiers CV_QUALIFIER - { $$ = tree_cons (NULL_TREE, $2, $$); } - ; - -nonempty_cv_qualifiers: - CV_QUALIFIER - { $$.t = hash_tree_cons (NULL_TREE, $1, NULL_TREE); - $$.new_type_flag = 0; } - | nonempty_cv_qualifiers CV_QUALIFIER - { $$.t = hash_tree_cons (NULL_TREE, $2, $1.t); - $$.new_type_flag = $1.new_type_flag; } - | attributes %prec EMPTY - { $$.t = hash_tree_cons ($1, NULL_TREE, NULL_TREE); - $$.new_type_flag = 0; } - | nonempty_cv_qualifiers attributes %prec EMPTY - { $$.t = hash_tree_cons ($2, NULL_TREE, $1.t); - $$.new_type_flag = $1.new_type_flag; } - ; - -/* These rules must follow the rules for function declarations - and component declarations. That way, longer rules are preferred. */ - -/* An expression which will not live on the momentary obstack. */ -maybe_parmlist: - '(' nonnull_exprlist ')' - { $$ = $2; } - | '(' parmlist ')' - { $$ = $2; } - | LEFT_RIGHT - { $$ = empty_parms (); } - | '(' error ')' - { $$ = NULL_TREE; } - ; - -/* A declarator that is allowed only after an explicit typespec. */ - -after_type_declarator_intern: - after_type_declarator - | attributes after_type_declarator - { - /* Provide support for '(' attributes '*' declarator ')' - etc */ - $$ = tree_cons ($1, $2, NULL_TREE); - } - ; - -/* may all be followed by prec '.' */ -after_type_declarator: - '*' nonempty_cv_qualifiers after_type_declarator_intern %prec UNARY - { $$ = make_pointer_declarator ($2.t, $3); } - | '&' nonempty_cv_qualifiers after_type_declarator_intern %prec UNARY - { $$ = make_reference_declarator ($2.t, $3); } - | '*' after_type_declarator_intern %prec UNARY - { $$ = make_pointer_declarator (NULL_TREE, $2); } - | '&' after_type_declarator_intern %prec UNARY - { $$ = make_reference_declarator (NULL_TREE, $2); } - | ptr_to_mem cv_qualifiers after_type_declarator_intern - { tree arg = make_pointer_declarator ($2, $3); - $$ = build_nt (SCOPE_REF, $1, arg); - } - | direct_after_type_declarator - ; - -direct_after_type_declarator: - direct_after_type_declarator maybe_parmlist cv_qualifiers exception_specification_opt %prec '.' - { $$ = make_call_declarator ($$, $2, $3, $4); } - | direct_after_type_declarator '[' expr ']' - { $$ = build_nt (ARRAY_REF, $$, $3); } - | direct_after_type_declarator '[' ']' - { $$ = build_nt (ARRAY_REF, $$, NULL_TREE); } - | '(' after_type_declarator_intern ')' - { $$ = $2; } - | nested_name_specifier type_name %prec EMPTY - { push_nested_class ($1, 3); - $$ = build_nt (SCOPE_REF, $$, $2); - TREE_COMPLEXITY ($$) = current_class_depth; } - | type_name %prec EMPTY - ; - -nonnested_type: - type_name %prec EMPTY - { - if (TREE_CODE ($1) == IDENTIFIER_NODE) - { - $$ = lookup_name ($1, 1); - maybe_note_name_used_in_class ($1, $$); - } - else - $$ = $1; - } - | global_scope type_name - { - if (TREE_CODE ($2) == IDENTIFIER_NODE) - $$ = IDENTIFIER_GLOBAL_VALUE ($2); - else - $$ = $2; - got_scope = NULL_TREE; - } - ; - -complete_type_name: - nonnested_type - | nested_type - | global_scope nested_type - { $$ = $2; } - ; - -nested_type: - nested_name_specifier type_name %prec EMPTY - { $$ = get_type_decl ($2); } - ; - -/* A declarator allowed whether or not there has been - an explicit typespec. These cannot redeclare a typedef-name. */ - -notype_declarator_intern: - notype_declarator - | attributes notype_declarator - { - /* Provide support for '(' attributes '*' declarator ')' - etc */ - $$ = tree_cons ($1, $2, NULL_TREE); - } - ; - -notype_declarator: - '*' nonempty_cv_qualifiers notype_declarator_intern %prec UNARY - { $$ = make_pointer_declarator ($2.t, $3); } - | '&' nonempty_cv_qualifiers notype_declarator_intern %prec UNARY - { $$ = make_reference_declarator ($2.t, $3); } - | '*' notype_declarator_intern %prec UNARY - { $$ = make_pointer_declarator (NULL_TREE, $2); } - | '&' notype_declarator_intern %prec UNARY - { $$ = make_reference_declarator (NULL_TREE, $2); } - | ptr_to_mem cv_qualifiers notype_declarator_intern - { tree arg = make_pointer_declarator ($2, $3); - $$ = build_nt (SCOPE_REF, $1, arg); - } - | direct_notype_declarator - ; - -complex_notype_declarator: - '*' nonempty_cv_qualifiers notype_declarator_intern %prec UNARY - { $$ = make_pointer_declarator ($2.t, $3); } - | '&' nonempty_cv_qualifiers notype_declarator_intern %prec UNARY - { $$ = make_reference_declarator ($2.t, $3); } - | '*' complex_notype_declarator %prec UNARY - { $$ = make_pointer_declarator (NULL_TREE, $2); } - | '&' complex_notype_declarator %prec UNARY - { $$ = make_reference_declarator (NULL_TREE, $2); } - | ptr_to_mem cv_qualifiers notype_declarator_intern - { tree arg = make_pointer_declarator ($2, $3); - $$ = build_nt (SCOPE_REF, $1, arg); - } - | complex_direct_notype_declarator - ; - -complex_direct_notype_declarator: - direct_notype_declarator maybe_parmlist cv_qualifiers exception_specification_opt %prec '.' - { $$ = make_call_declarator ($$, $2, $3, $4); } - | '(' complex_notype_declarator ')' - { $$ = $2; } - | direct_notype_declarator '[' expr ']' - { $$ = build_nt (ARRAY_REF, $$, $3); } - | direct_notype_declarator '[' ']' - { $$ = build_nt (ARRAY_REF, $$, NULL_TREE); } - | notype_qualified_id - { enter_scope_of ($1); } - | global_scope notype_qualified_id - { enter_scope_of ($2); $$ = $2;} - | global_scope notype_unqualified_id - { $$ = build_nt (SCOPE_REF, global_namespace, $2); - enter_scope_of ($$); - } - | nested_name_specifier notype_template_declarator - { got_scope = NULL_TREE; - $$ = build_nt (SCOPE_REF, $1, $2); - enter_scope_of ($$); - } - ; - -qualified_id: - nested_name_specifier unqualified_id - { got_scope = NULL_TREE; - $$ = build_nt (SCOPE_REF, $$, $2); } - | nested_name_specifier object_template_id - { got_scope = NULL_TREE; - $$ = build_nt (SCOPE_REF, $1, $2); } - ; - -notype_qualified_id: - nested_name_specifier notype_unqualified_id - { got_scope = NULL_TREE; - $$ = build_nt (SCOPE_REF, $$, $2); } - | nested_name_specifier object_template_id - { got_scope = NULL_TREE; - $$ = build_nt (SCOPE_REF, $1, $2); } - ; - -overqualified_id: - notype_qualified_id - | global_scope notype_qualified_id - { $$ = $2; } - ; - -functional_cast: - typespec '(' nonnull_exprlist ')' - { $$ = build_functional_cast ($1.t, $3); } - | typespec '(' expr_or_declarator_intern ')' - { $$ = reparse_decl_as_expr ($1.t, $3); } - | typespec fcast_or_absdcl %prec EMPTY - { $$ = reparse_absdcl_as_expr ($1.t, $2); } - ; - -type_name: - tTYPENAME - | SELFNAME - | template_type %prec EMPTY - ; - -nested_name_specifier: - nested_name_specifier_1 - | nested_name_specifier nested_name_specifier_1 - { $$ = $2; } - | nested_name_specifier TEMPLATE explicit_template_type SCOPE - { got_scope = $$ - = make_typename_type ($1, $3, tf_error | tf_parsing); } - /* Error handling per Core 125. */ - | nested_name_specifier IDENTIFIER SCOPE - { got_scope = $$ - = make_typename_type ($1, $2, tf_error | tf_parsing); } - | nested_name_specifier PTYPENAME SCOPE - { got_scope = $$ - = make_typename_type ($1, $2, tf_error | tf_parsing); } - ; - -/* Why the @#$%^& do type_name and notype_identifier need to be expanded - inline here?!? (jason) */ -nested_name_specifier_1: - tTYPENAME SCOPE - { - if (TREE_CODE ($1) == IDENTIFIER_NODE) - { - $$ = lastiddecl; - maybe_note_name_used_in_class ($1, $$); - } - got_scope = $$ = - complete_type (TYPE_MAIN_VARIANT (TREE_TYPE ($$))); - } - | SELFNAME SCOPE - { - if (TREE_CODE ($1) == IDENTIFIER_NODE) - $$ = lastiddecl; - got_scope = $$ = TREE_TYPE ($$); - } - | NSNAME SCOPE - { - if (TREE_CODE ($$) == IDENTIFIER_NODE) - $$ = lastiddecl; - got_scope = $$; - } - | template_type SCOPE - { got_scope = $$ = complete_type (TREE_TYPE ($1)); } - ; - -typename_sub: - typename_sub0 - | global_scope typename_sub0 - { $$ = $2; } - ; - -typename_sub0: - typename_sub1 identifier %prec EMPTY - { - if (TYPE_P ($1)) - $$ = make_typename_type ($1, $2, tf_error | tf_parsing); - else if (TREE_CODE ($2) == IDENTIFIER_NODE) - error ("`%T' is not a class or namespace", $2); - else - { - $$ = $2; - if (TREE_CODE ($$) == TYPE_DECL) - $$ = TREE_TYPE ($$); - } - } - | typename_sub1 template_type %prec EMPTY - { $$ = TREE_TYPE ($2); } - | typename_sub1 explicit_template_type %prec EMPTY - { $$ = make_typename_type ($1, $2, tf_error | tf_parsing); } - | typename_sub1 TEMPLATE explicit_template_type %prec EMPTY - { $$ = make_typename_type ($1, $3, tf_error | tf_parsing); } - ; - -typename_sub1: - typename_sub2 - { - if (TREE_CODE ($1) == IDENTIFIER_NODE) - error ("`%T' is not a class or namespace", $1); - else if (TREE_CODE ($1) == TYPE_DECL) - $$ = TREE_TYPE ($1); - } - | typename_sub1 typename_sub2 - { - if (TYPE_P ($1)) - $$ = make_typename_type ($1, $2, tf_error | tf_parsing); - else if (TREE_CODE ($2) == IDENTIFIER_NODE) - error ("`%T' is not a class or namespace", $2); - else - { - $$ = $2; - if (TREE_CODE ($$) == TYPE_DECL) - $$ = TREE_TYPE ($$); - } - } - | typename_sub1 explicit_template_type SCOPE - { got_scope = $$ - = make_typename_type ($1, $2, tf_error | tf_parsing); } - | typename_sub1 TEMPLATE explicit_template_type SCOPE - { got_scope = $$ - = make_typename_type ($1, $3, tf_error | tf_parsing); } - ; - -/* This needs to return a TYPE_DECL for simple names so that we don't - forget what name was used. */ -typename_sub2: - tTYPENAME SCOPE - { - if (TREE_CODE ($1) != TYPE_DECL) - $$ = lastiddecl; - - /* Retrieve the type for the identifier, which might involve - some computation. */ - got_scope = complete_type (TREE_TYPE ($$)); - - if ($$ == error_mark_node) - error ("`%T' is not a class or namespace", $1); - } - | SELFNAME SCOPE - { - if (TREE_CODE ($1) != TYPE_DECL) - $$ = lastiddecl; - got_scope = complete_type (TREE_TYPE ($$)); - } - | template_type SCOPE - { got_scope = $$ = complete_type (TREE_TYPE ($$)); } - | PTYPENAME SCOPE - | IDENTIFIER SCOPE - | NSNAME SCOPE - { - if (TREE_CODE ($$) == IDENTIFIER_NODE) - $$ = lastiddecl; - got_scope = $$; - } - ; - -explicit_template_type: - identifier '<' template_arg_list_opt template_close_bracket - { $$ = build_min_nt (TEMPLATE_ID_EXPR, $1, $3); } - ; - -complex_type_name: - global_scope type_name - { - if (TREE_CODE ($2) == IDENTIFIER_NODE) - $$ = IDENTIFIER_GLOBAL_VALUE ($2); - else - $$ = $2; - got_scope = NULL_TREE; - } - | nested_type - | global_scope nested_type - { $$ = $2; } - ; - -ptr_to_mem: - nested_name_specifier '*' - { got_scope = NULL_TREE; } - | global_scope nested_name_specifier '*' - { $$ = $2; got_scope = NULL_TREE; } - ; - -/* All uses of explicit global scope must go through this nonterminal so - that got_scope will be set before yylex is called to get the next token. */ -global_scope: - SCOPE - { got_scope = void_type_node; } - ; - -/* ISO new-declarator (5.3.4) */ -new_declarator: - '*' cv_qualifiers new_declarator - { $$ = make_pointer_declarator ($2, $3); } - | '*' cv_qualifiers %prec EMPTY - { $$ = make_pointer_declarator ($2, NULL_TREE); } - | '&' cv_qualifiers new_declarator %prec EMPTY - { $$ = make_reference_declarator ($2, $3); } - | '&' cv_qualifiers %prec EMPTY - { $$ = make_reference_declarator ($2, NULL_TREE); } - | ptr_to_mem cv_qualifiers %prec EMPTY - { tree arg = make_pointer_declarator ($2, NULL_TREE); - $$ = build_nt (SCOPE_REF, $1, arg); - } - | ptr_to_mem cv_qualifiers new_declarator - { tree arg = make_pointer_declarator ($2, $3); - $$ = build_nt (SCOPE_REF, $1, arg); - } - | direct_new_declarator %prec EMPTY - ; - -/* ISO direct-new-declarator (5.3.4) */ -direct_new_declarator: - '[' expr ']' - { $$ = build_nt (ARRAY_REF, NULL_TREE, $2); } - | direct_new_declarator '[' expr ']' - { $$ = build_nt (ARRAY_REF, $$, $3); } - ; - -absdcl_intern: - absdcl - | attributes absdcl - { - /* Provide support for '(' attributes '*' declarator ')' - etc */ - $$ = tree_cons ($1, $2, NULL_TREE); - } - ; - -/* ISO abstract-declarator (8.1) */ -absdcl: - '*' nonempty_cv_qualifiers absdcl_intern - { $$ = make_pointer_declarator ($2.t, $3); } - | '*' absdcl_intern - { $$ = make_pointer_declarator (NULL_TREE, $2); } - | '*' nonempty_cv_qualifiers %prec EMPTY - { $$ = make_pointer_declarator ($2.t, NULL_TREE); } - | '*' %prec EMPTY - { $$ = make_pointer_declarator (NULL_TREE, NULL_TREE); } - | '&' nonempty_cv_qualifiers absdcl_intern - { $$ = make_reference_declarator ($2.t, $3); } - | '&' absdcl_intern - { $$ = make_reference_declarator (NULL_TREE, $2); } - | '&' nonempty_cv_qualifiers %prec EMPTY - { $$ = make_reference_declarator ($2.t, NULL_TREE); } - | '&' %prec EMPTY - { $$ = make_reference_declarator (NULL_TREE, NULL_TREE); } - | ptr_to_mem cv_qualifiers %prec EMPTY - { tree arg = make_pointer_declarator ($2, NULL_TREE); - $$ = build_nt (SCOPE_REF, $1, arg); - } - | ptr_to_mem cv_qualifiers absdcl_intern - { tree arg = make_pointer_declarator ($2, $3); - $$ = build_nt (SCOPE_REF, $1, arg); - } - | direct_abstract_declarator %prec EMPTY - ; - -/* ISO direct-abstract-declarator (8.1) */ -direct_abstract_declarator: - '(' absdcl_intern ')' - { $$ = $2; } - /* `(typedef)1' is `int'. */ - | direct_abstract_declarator '(' parmlist ')' cv_qualifiers exception_specification_opt %prec '.' - { $$ = make_call_declarator ($$, $3, $5, $6); } - | direct_abstract_declarator LEFT_RIGHT cv_qualifiers exception_specification_opt %prec '.' - { $$ = make_call_declarator ($$, empty_parms (), $3, $4); } - | direct_abstract_declarator '[' expr ']' %prec '.' - { $$ = build_nt (ARRAY_REF, $$, $3); } - | direct_abstract_declarator '[' ']' %prec '.' - { $$ = build_nt (ARRAY_REF, $$, NULL_TREE); } - | '(' complex_parmlist ')' cv_qualifiers exception_specification_opt %prec '.' - { $$ = make_call_declarator (NULL_TREE, $2, $4, $5); } - | regcast_or_absdcl cv_qualifiers exception_specification_opt %prec '.' - { set_quals_and_spec ($$, $2, $3); } - | fcast_or_absdcl cv_qualifiers exception_specification_opt %prec '.' - { set_quals_and_spec ($$, $2, $3); } - | '[' expr ']' %prec '.' - { $$ = build_nt (ARRAY_REF, NULL_TREE, $2); } - | '[' ']' %prec '.' - { $$ = build_nt (ARRAY_REF, NULL_TREE, NULL_TREE); } - ; - -/* For C++, decls and stmts can be intermixed, so we don't need to - have a special rule that won't start parsing the stmt section - until we have a stmt that parses without errors. */ - -stmts: - stmt - | errstmt - | stmts stmt - | stmts errstmt - ; - -errstmt: - error ';' - ; - -/* Read zero or more forward-declarations for labels - that nested functions can jump to. */ -maybe_label_decls: - /* empty */ - | label_decls - { if (pedantic) - pedwarn ("ISO C++ forbids label declarations"); } - ; - -label_decls: - label_decl - | label_decls label_decl - ; - -label_decl: - LABEL identifiers_or_typenames ';' - { - while ($2) - { - finish_label_decl (TREE_VALUE ($2)); - $2 = TREE_CHAIN ($2); - } - } - ; - -compstmt_or_stmtexpr: - save_lineno '{' - { $<ttype>$ = begin_compound_stmt (0); } - compstmtend - { STMT_LINENO ($<ttype>3) = $1; - finish_compound_stmt (0, $<ttype>3); } - ; - -compstmt: - compstmt_or_stmtexpr - { last_expr_type = NULL_TREE; } - ; - -simple_if: - IF - { $<ttype>$ = begin_if_stmt (); - cond_stmt_keyword = "if"; } - paren_cond_or_null - { finish_if_stmt_cond ($3, $<ttype>2); } - implicitly_scoped_stmt - { $$ = $<ttype>2; - finish_then_clause ($<ttype>2); } - ; - -implicitly_scoped_stmt: - compstmt - | - { $<ttype>$ = begin_compound_stmt (0); } - save_lineno simple_stmt - { STMT_LINENO ($<ttype>1) = $2; - if ($3) STMT_LINENO ($3) = $2; - finish_compound_stmt (0, $<ttype>1); } - ; - -stmt: - compstmt - | save_lineno simple_stmt - { if ($2) STMT_LINENO ($2) = $1; } - ; - -simple_stmt: - decl - { finish_stmt (); - $$ = NULL_TREE; } - | expr ';' - { $$ = finish_expr_stmt ($1); } - | simple_if ELSE - { begin_else_clause (); } - implicitly_scoped_stmt - { - $$ = $1; - finish_else_clause ($1); - finish_if_stmt (); - } - | simple_if %prec IF - { $$ = $1; - finish_if_stmt (); } - | WHILE - { - $<ttype>$ = begin_while_stmt (); - cond_stmt_keyword = "while"; - } - paren_cond_or_null - { finish_while_stmt_cond ($3, $<ttype>2); } - implicitly_scoped_stmt - { $$ = $<ttype>2; - finish_while_stmt ($<ttype>2); } - | DO - { $<ttype>$ = begin_do_stmt (); } - implicitly_scoped_stmt WHILE - { - finish_do_body ($<ttype>2); - cond_stmt_keyword = "do"; - } - paren_expr_or_null ';' - { $$ = $<ttype>2; - finish_do_stmt ($6, $<ttype>2); } - | FOR - { $<ttype>$ = begin_for_stmt (); } - '(' for.init.statement - { finish_for_init_stmt ($<ttype>2); } - xcond ';' - { finish_for_cond ($6, $<ttype>2); } - xexpr ')' - { finish_for_expr ($9, $<ttype>2); } - implicitly_scoped_stmt - { $$ = $<ttype>2; - finish_for_stmt ($<ttype>2); } - | SWITCH - { $<ttype>$ = begin_switch_stmt (); } - '(' condition ')' - { finish_switch_cond ($4, $<ttype>2); } - implicitly_scoped_stmt - { $$ = $<ttype>2; - finish_switch_stmt ($<ttype>2); } - | CASE expr_no_commas ':' - { $<ttype>$ = finish_case_label ($2, NULL_TREE); } - stmt - { $$ = $<ttype>4; } - | CASE expr_no_commas ELLIPSIS expr_no_commas ':' - { $<ttype>$ = finish_case_label ($2, $4); } - stmt - { $$ = $<ttype>6; } - | DEFAULT ':' - { $<ttype>$ = finish_case_label (NULL_TREE, NULL_TREE); } - stmt - { $$ = $<ttype>3; } - | BREAK ';' - { $$ = finish_break_stmt (); } - | CONTINUE ';' - { $$ = finish_continue_stmt (); } - | RETURN_KEYWORD ';' - { $$ = finish_return_stmt (NULL_TREE); } - | RETURN_KEYWORD expr ';' - { $$ = finish_return_stmt ($2); } - | asm_keyword maybe_cv_qualifier '(' STRING ')' ';' - { $$ = finish_asm_stmt ($2, $4, NULL_TREE, NULL_TREE, - NULL_TREE); - ASM_INPUT_P ($$) = 1; } - /* This is the case with just output operands. */ - | asm_keyword maybe_cv_qualifier '(' STRING ':' asm_operands ')' ';' - { $$ = finish_asm_stmt ($2, $4, $6, NULL_TREE, NULL_TREE); } - /* This is the case with input operands as well. */ - | asm_keyword maybe_cv_qualifier '(' STRING ':' asm_operands ':' - asm_operands ')' ';' - { $$ = finish_asm_stmt ($2, $4, $6, $8, NULL_TREE); } - | asm_keyword maybe_cv_qualifier '(' STRING SCOPE asm_operands ')' ';' - { $$ = finish_asm_stmt ($2, $4, NULL_TREE, $6, NULL_TREE); } - /* This is the case with clobbered registers as well. */ - | asm_keyword maybe_cv_qualifier '(' STRING ':' asm_operands ':' - asm_operands ':' asm_clobbers ')' ';' - { $$ = finish_asm_stmt ($2, $4, $6, $8, $10); } - | asm_keyword maybe_cv_qualifier '(' STRING SCOPE asm_operands ':' - asm_clobbers ')' ';' - { $$ = finish_asm_stmt ($2, $4, NULL_TREE, $6, $8); } - | asm_keyword maybe_cv_qualifier '(' STRING ':' asm_operands SCOPE - asm_clobbers ')' ';' - { $$ = finish_asm_stmt ($2, $4, $6, NULL_TREE, $8); } - | GOTO '*' expr ';' - { - if (pedantic) - pedwarn ("ISO C++ forbids computed gotos"); - $$ = finish_goto_stmt ($3); - } - | GOTO identifier ';' - { $$ = finish_goto_stmt ($2); } - | label_colon stmt - { $$ = NULL_TREE; } - | label_colon '}' - { error ("label must be followed by statement"); - yyungetc ('}', 0); - $$ = NULL_TREE; } - | ';' - { finish_stmt (); - $$ = NULL_TREE; } - | try_block - { $$ = NULL_TREE; } - | using_directive - { $$ = NULL_TREE; } - | namespace_using_decl - { do_local_using_decl ($1); - $$ = NULL_TREE; } - | namespace_alias - { $$ = NULL_TREE; } - ; - -function_try_block: - TRY - { $<ttype>$ = begin_function_try_block (); } - function_body - { finish_function_try_block ($<ttype>2); } - handler_seq - { finish_function_handler_sequence ($<ttype>2); } - ; - -try_block: - TRY - { $<ttype>$ = begin_try_block (); } - compstmt - { finish_try_block ($<ttype>2); } - handler_seq - { finish_handler_sequence ($<ttype>2); } - ; - -handler_seq: - handler - | handler_seq handler - | /* empty */ - { /* Generate a fake handler block to avoid later aborts. */ - tree fake_handler = begin_handler (); - finish_handler_parms (NULL_TREE, fake_handler); - finish_handler (fake_handler); - $<ttype>$ = fake_handler; - - error ("must have at least one catch per try block"); - } - ; - -handler: - CATCH - { $<ttype>$ = begin_handler (); } - handler_args - { finish_handler_parms ($3, $<ttype>2); } - compstmt - { finish_handler ($<ttype>2); } - ; - -type_specifier_seq: - typed_typespecs %prec EMPTY - | nonempty_cv_qualifiers %prec EMPTY - ; - -handler_args: - '(' ELLIPSIS ')' - { $$ = NULL_TREE; } - /* This doesn't allow reference parameters, the below does. - | '(' type_specifier_seq absdcl ')' - { check_for_new_type ("inside exception declarations", $2); - expand_start_catch_block ($2.t, $3); } - | '(' type_specifier_seq ')' - { check_for_new_type ("inside exception declarations", $2); - expand_start_catch_block ($2.t, NULL_TREE); } - | '(' type_specifier_seq notype_declarator ')' - { check_for_new_type ("inside exception declarations", $2); - expand_start_catch_block ($2.t, $3); } - | '(' typed_typespecs after_type_declarator ')' - { check_for_new_type ("inside exception declarations", $2); - expand_start_catch_block ($2.t, $3); } - This allows reference parameters... */ - | '(' parm ')' - { - check_for_new_type ("inside exception declarations", $2); - $$ = start_handler_parms (TREE_PURPOSE ($2.t), - TREE_VALUE ($2.t)); - } - ; - -label_colon: - IDENTIFIER ':' - { finish_label_stmt ($1); } - | PTYPENAME ':' - { finish_label_stmt ($1); } - | tTYPENAME ':' - { finish_label_stmt ($1); } - | SELFNAME ':' - { finish_label_stmt ($1); } - ; - -for.init.statement: - xexpr ';' - { finish_expr_stmt ($1); } - | decl - | '{' compstmtend - { if (pedantic) - pedwarn ("ISO C++ forbids compound statements inside for initializations"); - } - ; - -/* Either a type-qualifier or nothing. First thing in an `asm' statement. */ - -maybe_cv_qualifier: - /* empty */ - { $$ = NULL_TREE; } - | CV_QUALIFIER - ; - -xexpr: - /* empty */ - { $$ = NULL_TREE; } - | expr - | error - { $$ = NULL_TREE; } - ; - -/* These are the operands other than the first string and colon - in asm ("addextend %2,%1": "=dm" (x), "0" (y), "g" (*x)) */ -asm_operands: - /* empty */ - { $$ = NULL_TREE; } - | nonnull_asm_operands - ; - -nonnull_asm_operands: - asm_operand - | nonnull_asm_operands ',' asm_operand - { $$ = chainon ($$, $3); } - ; - -asm_operand: - STRING '(' expr ')' - { $$ = build_tree_list (build_tree_list (NULL_TREE, $1), $3); } - | '[' identifier ']' STRING '(' expr ')' - { $2 = build_string (IDENTIFIER_LENGTH ($2), - IDENTIFIER_POINTER ($2)); - $$ = build_tree_list (build_tree_list ($2, $4), $6); } - ; - -asm_clobbers: - STRING - { $$ = tree_cons (NULL_TREE, $1, NULL_TREE);} - | asm_clobbers ',' STRING - { $$ = tree_cons (NULL_TREE, $3, $1); } - ; - -/* This is what appears inside the parens in a function declarator. - Its value is represented in the format that grokdeclarator expects. - - In C++, declaring a function with no parameters - means that that function takes *no* parameters. */ - -parmlist: - /* empty */ - { - $$ = empty_parms(); - } - | complex_parmlist - | type_id - { $$ = finish_parmlist (build_tree_list (NULL_TREE, $1.t), 0); - check_for_new_type ("inside parameter list", $1); } - ; - -/* This nonterminal does not include the common sequence '(' type_id ')', - as it is ambiguous and must be disambiguated elsewhere. */ -complex_parmlist: - parms - { $$ = finish_parmlist ($$, 0); } - | parms_comma ELLIPSIS - { $$ = finish_parmlist ($1, 1); } - /* C++ allows an ellipsis without a separating ',' */ - | parms ELLIPSIS - { $$ = finish_parmlist ($1, 1); } - | type_id ELLIPSIS - { $$ = finish_parmlist (build_tree_list (NULL_TREE, - $1.t), 1); } - | ELLIPSIS - { $$ = finish_parmlist (NULL_TREE, 1); } - | parms ':' - { - /* This helps us recover from really nasty - parse errors, for example, a missing right - parenthesis. */ - yyerror ("possibly missing ')'"); - $$ = finish_parmlist ($1, 0); - yyungetc (':', 0); - yychar = ')'; - } - | type_id ':' - { - /* This helps us recover from really nasty - parse errors, for example, a missing right - parenthesis. */ - yyerror ("possibly missing ')'"); - $$ = finish_parmlist (build_tree_list (NULL_TREE, - $1.t), 0); - yyungetc (':', 0); - yychar = ')'; - } - ; - -/* A default argument to a */ -defarg: - '=' - { maybe_snarf_defarg (); } - defarg1 - { $$ = $3; } - ; - -defarg1: - DEFARG - | init - ; - -/* A nonempty list of parameter declarations or type names. */ -parms: - named_parm - { check_for_new_type ("in a parameter list", $1); - $$ = build_tree_list (NULL_TREE, $1.t); } - | parm defarg - { check_for_new_type ("in a parameter list", $1); - $$ = build_tree_list ($2, $1.t); } - | parms_comma full_parm - { check_for_new_type ("in a parameter list", $2); - $$ = chainon ($$, $2.t); } - | parms_comma bad_parm - { $$ = chainon ($$, build_tree_list (NULL_TREE, $2)); } - | parms_comma bad_parm '=' init - { $$ = chainon ($$, build_tree_list ($4, $2)); } - ; - -parms_comma: - parms ',' - | type_id ',' - { check_for_new_type ("in a parameter list", $1); - $$ = build_tree_list (NULL_TREE, $1.t); } - ; - -/* A single parameter declaration or parameter type name, - as found in a parmlist. */ -named_parm: - /* Here we expand typed_declspecs inline to avoid mis-parsing of - TYPESPEC IDENTIFIER. */ - typed_declspecs1 declarator - { $$.new_type_flag = $1.new_type_flag; - $$.t = build_tree_list ($1.t, $2); } - | typed_typespecs declarator - { $$.t = build_tree_list ($1.t, $2); - $$.new_type_flag = $1.new_type_flag; } - | typespec declarator - { $$.t = build_tree_list (build_tree_list (NULL_TREE, $1.t), - $2); - $$.new_type_flag = $1.new_type_flag; } - | typed_declspecs1 absdcl - { $$.t = build_tree_list ($1.t, $2); - $$.new_type_flag = $1.new_type_flag; } - | typed_declspecs1 %prec EMPTY - { $$.t = build_tree_list ($1.t, NULL_TREE); - $$.new_type_flag = $1.new_type_flag; } - | declmods notype_declarator - { $$.t = build_tree_list ($1.t, $2); - $$.new_type_flag = 0; } - ; - -full_parm: - parm - { $$.t = build_tree_list (NULL_TREE, $1.t); - $$.new_type_flag = $1.new_type_flag; } - | parm defarg - { $$.t = build_tree_list ($2, $1.t); - $$.new_type_flag = $1.new_type_flag; } - ; - -parm: - named_parm - | type_id - ; - -see_typename: - /* empty */ %prec EMPTY - { see_typename (); } - ; - -bad_parm: - /* empty */ %prec EMPTY - { - error ("type specifier omitted for parameter"); - $$ = build_tree_list (integer_type_node, NULL_TREE); - } - | notype_declarator - { - if (TREE_CODE ($$) == SCOPE_REF) - { - if (TREE_CODE (TREE_OPERAND ($$, 0)) == TEMPLATE_TYPE_PARM - || TREE_CODE (TREE_OPERAND ($$, 0)) == BOUND_TEMPLATE_TEMPLATE_PARM) - error ("`%E' is not a type, use `typename %E' to make it one", $$, $$); - else - error ("no type `%D' in `%T'", TREE_OPERAND ($$, 1), TREE_OPERAND ($$, 0)); - } - else - error ("type specifier omitted for parameter `%E'", $$); - $$ = build_tree_list (integer_type_node, $$); - } - ; - -bad_decl: - IDENTIFIER template_arg_list_ignore IDENTIFIER arg_list_ignore ';' - { - error("'%D' is used as a type, but is not defined as a type.", $1); - $3 = error_mark_node; - } - ; - -template_arg_list_ignore: - '<' template_arg_list_opt template_close_bracket - { } - | /* empty */ - ; - -arg_list_ignore: - '(' nonnull_exprlist ')' - { } - | /* empty */ - ; - -exception_specification_opt: - /* empty */ %prec EMPTY - { $$ = NULL_TREE; } - | THROW '(' ansi_raise_identifiers ')' %prec EMPTY - { $$ = $3; } - | THROW LEFT_RIGHT %prec EMPTY - { $$ = empty_except_spec; } - ; - -ansi_raise_identifier: - type_id - { - check_for_new_type ("exception specifier", $1); - $$ = groktypename ($1.t); - } - | error - { $$ = error_mark_node; } - ; - -ansi_raise_identifiers: - ansi_raise_identifier - { $$ = add_exception_specifier (NULL_TREE, $1, 1); } - | ansi_raise_identifiers ',' ansi_raise_identifier - { $$ = add_exception_specifier ($1, $3, 1); } - ; - -conversion_declarator: - /* empty */ %prec EMPTY - { $$ = NULL_TREE; } - | '*' cv_qualifiers conversion_declarator - { $$ = make_pointer_declarator ($2, $3); } - | '&' cv_qualifiers conversion_declarator - { $$ = make_reference_declarator ($2, $3); } - | ptr_to_mem cv_qualifiers conversion_declarator - { tree arg = make_pointer_declarator ($2, $3); - $$ = build_nt (SCOPE_REF, $1, arg); - } - ; - -operator: - OPERATOR - { - saved_scopes = tree_cons (got_scope, got_object, saved_scopes); - TREE_LANG_FLAG_0 (saved_scopes) = looking_for_typename; - /* We look for conversion-type-id's in both the class and current - scopes, just as for ID in 'ptr->ID::'. */ - looking_for_typename = 1; - got_object = got_scope; - got_scope = NULL_TREE; - } - ; - -unoperator: - { got_scope = TREE_PURPOSE (saved_scopes); - got_object = TREE_VALUE (saved_scopes); - looking_for_typename = TREE_LANG_FLAG_0 (saved_scopes); - saved_scopes = TREE_CHAIN (saved_scopes); - $$ = got_scope; - } - ; - -operator_name: - operator '*' unoperator - { $$ = frob_opname (ansi_opname (MULT_EXPR)); } - | operator '/' unoperator - { $$ = frob_opname (ansi_opname (TRUNC_DIV_EXPR)); } - | operator '%' unoperator - { $$ = frob_opname (ansi_opname (TRUNC_MOD_EXPR)); } - | operator '+' unoperator - { $$ = frob_opname (ansi_opname (PLUS_EXPR)); } - | operator '-' unoperator - { $$ = frob_opname (ansi_opname (MINUS_EXPR)); } - | operator '&' unoperator - { $$ = frob_opname (ansi_opname (BIT_AND_EXPR)); } - | operator '|' unoperator - { $$ = frob_opname (ansi_opname (BIT_IOR_EXPR)); } - | operator '^' unoperator - { $$ = frob_opname (ansi_opname (BIT_XOR_EXPR)); } - | operator '~' unoperator - { $$ = frob_opname (ansi_opname (BIT_NOT_EXPR)); } - | operator ',' unoperator - { $$ = frob_opname (ansi_opname (COMPOUND_EXPR)); } - | operator ARITHCOMPARE unoperator - { $$ = frob_opname (ansi_opname ($2)); } - | operator '<' unoperator - { $$ = frob_opname (ansi_opname (LT_EXPR)); } - | operator '>' unoperator - { $$ = frob_opname (ansi_opname (GT_EXPR)); } - | operator EQCOMPARE unoperator - { $$ = frob_opname (ansi_opname ($2)); } - | operator ASSIGN unoperator - { $$ = frob_opname (ansi_assopname ($2)); } - | operator '=' unoperator - { $$ = frob_opname (ansi_assopname (NOP_EXPR)); } - | operator LSHIFT unoperator - { $$ = frob_opname (ansi_opname ($2)); } - | operator RSHIFT unoperator - { $$ = frob_opname (ansi_opname ($2)); } - | operator PLUSPLUS unoperator - { $$ = frob_opname (ansi_opname (POSTINCREMENT_EXPR)); } - | operator MINUSMINUS unoperator - { $$ = frob_opname (ansi_opname (PREDECREMENT_EXPR)); } - | operator ANDAND unoperator - { $$ = frob_opname (ansi_opname (TRUTH_ANDIF_EXPR)); } - | operator OROR unoperator - { $$ = frob_opname (ansi_opname (TRUTH_ORIF_EXPR)); } - | operator '!' unoperator - { $$ = frob_opname (ansi_opname (TRUTH_NOT_EXPR)); } - | operator '?' ':' unoperator - { $$ = frob_opname (ansi_opname (COND_EXPR)); } - | operator MIN_MAX unoperator - { $$ = frob_opname (ansi_opname ($2)); } - | operator POINTSAT unoperator %prec EMPTY - { $$ = frob_opname (ansi_opname (COMPONENT_REF)); } - | operator POINTSAT_STAR unoperator %prec EMPTY - { $$ = frob_opname (ansi_opname (MEMBER_REF)); } - | operator LEFT_RIGHT unoperator - { $$ = frob_opname (ansi_opname (CALL_EXPR)); } - | operator '[' ']' unoperator - { $$ = frob_opname (ansi_opname (ARRAY_REF)); } - | operator NEW unoperator %prec EMPTY - { $$ = frob_opname (ansi_opname (NEW_EXPR)); } - | operator DELETE unoperator %prec EMPTY - { $$ = frob_opname (ansi_opname (DELETE_EXPR)); } - | operator NEW '[' ']' unoperator - { $$ = frob_opname (ansi_opname (VEC_NEW_EXPR)); } - | operator DELETE '[' ']' unoperator - { $$ = frob_opname (ansi_opname (VEC_DELETE_EXPR)); } - | operator type_specifier_seq conversion_declarator unoperator - { $$ = frob_opname (grokoptypename ($2.t, $3, $4)); } - | operator error unoperator - { $$ = frob_opname (ansi_opname (ERROR_MARK)); } - ; - -/* The forced readahead in here is because we might be at the end of a - line, and lineno won't be bumped until yylex absorbs the first token - on the next line. */ -save_lineno: - { if (yychar == YYEMPTY) - yychar = YYLEX; - $$ = lineno; } - ; -%% - -#ifdef SPEW_DEBUG -const char * -debug_yytranslate (value) - int value; -{ - return yytname[YYTRANSLATE (value)]; -} -#endif - -/* Free malloced parser stacks if necessary. */ - -void -free_parser_stacks () -{ - if (malloced_yyss) - { - free (malloced_yyss); - free (malloced_yyvs); - } -} - -/* Return the value corresponding to TOKEN in the global scope. */ - -static tree -parse_scoped_id (token) - tree token; -{ - cxx_binding binding; - - cxx_binding_clear (&binding); - if (!qualified_lookup_using_namespace (token, global_namespace, &binding, 0)) - binding.value = NULL; - if (yychar == YYEMPTY) - yychar = yylex(); - - return do_scoped_id (token, binding.value); -} - -/* AGGR may be either a type node (like class_type_node) or a - TREE_LIST whose TREE_PURPOSE is a list of attributes and whose - TREE_VALUE is a type node. Set *TAG_KIND and *ATTRIBUTES to - represent the information encoded. */ - -static void -parse_split_aggr (tree aggr, enum tag_types *tag_kind, tree *attributes) -{ - if (TREE_CODE (aggr) == TREE_LIST) - { - *attributes = TREE_PURPOSE (aggr); - aggr = TREE_VALUE (aggr); - } - else - *attributes = NULL_TREE; - *tag_kind = (enum tag_types) tree_low_cst (aggr, 1); -} - -/* Like xref_tag, except that the AGGR may be either a type node (like - class_type_node) or a TREE_LIST whose TREE_PURPOSE is a list of - attributes and whose TREE_VALUE is a type node. */ - -static tree -parse_xref_tag (tree aggr, tree name, int globalize) -{ - tree attributes; - enum tag_types tag_kind; - parse_split_aggr (aggr, &tag_kind, &attributes); - return xref_tag (tag_kind, name, attributes, globalize); -} - -/* Like handle_class_head, but AGGR may be as for parse_xref_tag. */ - -static tree -parse_handle_class_head (tree aggr, tree scope, tree id, - int defn_p, int *new_type_p) -{ - tree attributes; - enum tag_types tag_kind; - parse_split_aggr (aggr, &tag_kind, &attributes); - return handle_class_head (tag_kind, scope, id, attributes, - defn_p, new_type_p); -} - -/* Like do_decl_instantiation, but the declarator has not yet been - parsed. */ - -static void -parse_decl_instantiation (tree declspecs, tree declarator, tree storage) -{ - tree decl = grokdeclarator (declarator, declspecs, NORMAL, 0, NULL); - do_decl_instantiation (decl, storage); -} - -/* Like begin_function_definition, but SPECS_ATTRS is a combined list - containing both a decl-specifier-seq and attributes. */ - -static int -parse_begin_function_definition (tree specs_attrs, tree declarator) -{ - tree specs; - tree attrs; - - split_specs_attrs (specs_attrs, &specs, &attrs); - return begin_function_definition (specs, attrs, declarator); -} - -/* Like finish_call_expr, but the name for FN has not yet been - resolved. */ - -static tree -parse_finish_call_expr (tree fn, tree args, int koenig) -{ - bool disallow_virtual; - - if (TREE_CODE (fn) == OFFSET_REF) - return build_offset_ref_call_from_tree (fn, args); - - if (TREE_CODE (fn) == SCOPE_REF) - { - tree scope = TREE_OPERAND (fn, 0); - tree name = TREE_OPERAND (fn, 1); - - if (scope == error_mark_node || name == error_mark_node) - return error_mark_node; - if (!processing_template_decl) - fn = resolve_scoped_fn_name (scope, name); - disallow_virtual = true; - } - else - disallow_virtual = false; - - if (koenig && TREE_CODE (fn) == IDENTIFIER_NODE) - { - tree f; - - /* Do the Koenig lookup. */ - fn = do_identifier (fn, 2, args); - /* If name lookup didn't find any matching declarations, we've - got an unbound identifier. */ - if (TREE_CODE (fn) == IDENTIFIER_NODE) - { - /* For some reason, do_identifier does not resolve - conversion operator names if the only matches would be - template conversion operators. So, we do it here. */ - if (IDENTIFIER_TYPENAME_P (fn) && current_class_type) - { - f = lookup_member (current_class_type, fn, - /*protect=*/1, /*want_type=*/0); - if (f) - return finish_call_expr (f, args, - /*disallow_virtual=*/false); - } - /* If the name still could not be resolved, then the program - is ill-formed. */ - if (TREE_CODE (fn) == IDENTIFIER_NODE) - { - unqualified_name_lookup_error (fn); - return error_mark_node; - } - } - else if (TREE_CODE (fn) == FUNCTION_DECL - || DECL_FUNCTION_TEMPLATE_P (fn) - || TREE_CODE (fn) == OVERLOAD) - { - tree scope = DECL_CONTEXT (get_first_fn (fn)); - if (scope && TYPE_P (scope)) - { - tree access_scope; - - if (DERIVED_FROM_P (scope, current_class_type) - && current_class_ref) - { - fn = build_baselink (lookup_base (current_class_type, - scope, - ba_any, - NULL), - TYPE_BINFO (current_class_type), - fn, - /*optype=*/NULL_TREE); - return finish_object_call_expr (fn, - current_class_ref, - args); - } - - - access_scope = current_class_type; - while (!DERIVED_FROM_P (scope, access_scope)) - { - access_scope = TYPE_CONTEXT (access_scope); - while (DECL_P (access_scope)) - access_scope = DECL_CONTEXT (access_scope); - } - - fn = build_baselink (NULL_TREE, - TYPE_BINFO (access_scope), - fn, - /*optype=*/NULL_TREE); - } - } - } - - if (TREE_CODE (fn) == COMPONENT_REF) - /* If the parser sees `(x->y)(bar)' we get here because the - parentheses confuse the parser. Treat this like - `x->y(bar)'. */ - return finish_object_call_expr (TREE_OPERAND (fn, 1), - TREE_OPERAND (fn, 0), - args); - - if (processing_template_decl) - return build_nt (CALL_EXPR, fn, args, NULL_TREE); - - return build_call_from_tree (fn, args, disallow_virtual); -} - -#include "gt-cp-parse.h" diff --git a/contrib/gcc/cp/spew.c b/contrib/gcc/cp/spew.c deleted file mode 100644 index 5bd3fdf..0000000 --- a/contrib/gcc/cp/spew.c +++ /dev/null @@ -1,1558 +0,0 @@ -/* Type Analyzer for GNU C++. - Copyright (C) 1987, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998, - 1999, 2000, 2001, 2002 Free Software Foundation, Inc. - Hacked... nay, bludgeoned... by Mark Eichin (eichin@cygnus.com) - -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. */ - -/* This file is the type analyzer for GNU C++. To debug it, define SPEW_DEBUG - when compiling parse.c and spew.c. */ - -#include "config.h" -#include "system.h" -#include "input.h" -#include "tree.h" -#include "cp-tree.h" -#include "cpplib.h" -#include "c-pragma.h" -#include "lex.h" -#include "parse.h" -#include "flags.h" -#include "obstack.h" -#include "toplev.h" -#include "ggc.h" -#include "intl.h" -#include "timevar.h" - -#ifdef SPEW_DEBUG -#define SPEW_INLINE -#else -#define SPEW_INLINE inline -#endif - -/* This takes a token stream that hasn't decided much about types and - tries to figure out as much as it can, with excessive lookahead and - backtracking. */ - -/* fifo of tokens recognized and available to parser. */ -struct token GTY(()) -{ - /* The values for YYCHAR will fit in a short. */ - short yychar; - unsigned int lineno; - YYSTYPE GTY ((desc ("%1.yychar"))) yylval; -}; - -/* Since inline methods can refer to text which has not yet been seen, - we store the text of the method in a structure which is placed in the - DECL_PENDING_INLINE_INFO field of the FUNCTION_DECL. - After parsing the body of the class definition, the FUNCTION_DECL's are - scanned to see which ones have this field set. Those are then digested - one at a time. - - This function's FUNCTION_DECL will have a bit set in its common so - that we know to watch out for it. */ - -#define TOKEN_CHUNK_SIZE 20 -struct token_chunk GTY(()) -{ - struct token_chunk *next; - struct token toks[TOKEN_CHUNK_SIZE]; -}; - -struct unparsed_text GTY(()) -{ - struct unparsed_text *next; /* process this one next */ - tree decl; /* associated declaration */ - location_t locus; /* location we got the text from */ - int interface; /* remembering interface_unknown and interface_only */ - - struct token_chunk * tokens; /* Start of the token list. */ - - struct token_chunk *last_chunk; /* End of the token list. */ - short last_pos; /* Number of tokens used in the last chunk of - TOKENS. */ - - short cur_pos; /* Current token in 'cur_chunk', when rescanning. */ - struct token_chunk *cur_chunk; /* Current chunk, when rescanning. */ -}; - -/* Stack of state saved off when we return to an inline method or - default argument that has been stored for later parsing. */ -struct feed GTY(()) -{ - struct unparsed_text *input; - location_t locus; - int yychar; - YYSTYPE GTY ((desc ("%1.yychar"))) yylval; - int first_token; - struct obstack GTY ((skip (""))) token_obstack; - struct feed *next; -}; - -static GTY(()) struct feed *feed; - -static SPEW_INLINE void do_aggr PARAMS ((void)); -static SPEW_INLINE int identifier_type PARAMS ((tree)); -static void scan_tokens PARAMS ((int)); -static void feed_defarg PARAMS ((tree)); -static void finish_defarg PARAMS ((void)); -static void yylexstring PARAMS ((struct token *)); -static int read_token PARAMS ((struct token *)); - -static SPEW_INLINE int num_tokens PARAMS ((void)); -static SPEW_INLINE struct token *nth_token PARAMS ((int)); -static SPEW_INLINE int next_token PARAMS ((struct token *)); -static SPEW_INLINE int shift_token PARAMS ((void)); -static SPEW_INLINE void push_token PARAMS ((struct token *)); -static SPEW_INLINE void consume_token PARAMS ((void)); -static SPEW_INLINE int read_process_identifier PARAMS ((YYSTYPE *)); - -static SPEW_INLINE void feed_input PARAMS ((struct unparsed_text *)); -static SPEW_INLINE struct token * space_for_token - PARAMS ((struct unparsed_text *t)); -static SPEW_INLINE struct token * remove_last_token - PARAMS ((struct unparsed_text *t)); -static struct unparsed_text * alloc_unparsed_text - PARAMS ((const location_t *, tree decl, int interface)); - -static void snarf_block PARAMS ((struct unparsed_text *t)); -static tree snarf_defarg PARAMS ((void)); -static void snarf_parenthesized_expression (struct unparsed_text *); -static int frob_id PARAMS ((int, int, tree *)); - -/* The list of inline functions being held off until we reach the end of - the current class declaration. */ -static GTY(()) struct unparsed_text *pending_inlines; -static GTY(()) struct unparsed_text *pending_inlines_tail; - -/* The list of previously-deferred inline functions currently being parsed. - This exists solely to be a GC root. */ -static GTY(()) struct unparsed_text *processing_these_inlines; - -static void begin_parsing_inclass_inline PARAMS ((struct unparsed_text *)); - -#ifdef SPEW_DEBUG -int spew_debug = 0; -static unsigned int yylex_ctr = 0; - -static void debug_yychar PARAMS ((int)); - -/* In parse.y: */ -extern char *debug_yytranslate PARAMS ((int)); -#endif -static enum cpp_ttype last_token; -static tree last_token_id; - -/* From lex.c: */ -/* the declaration found for the last IDENTIFIER token read in. yylex - must look this up to detect typedefs, which get token type - tTYPENAME, so it is left around in case the identifier is not a - typedef but is used in a context which makes it a reference to a - variable. */ -extern tree lastiddecl; /* let our brains leak out here too */ -extern int yychar; /* the lookahead symbol */ -extern YYSTYPE yylval; /* the semantic value of the */ - /* lookahead symbol */ -/* The token fifo lives in this obstack. */ -static struct obstack token_obstack; -static int first_token; - -/* When we see a default argument in a method declaration, we snarf it as - text using snarf_defarg. When we get up to namespace scope, we then go - through and parse all of them using do_pending_defargs. Since yacc - parsers are not reentrant, we retain defargs state in these two - variables so that subsequent calls to do_pending_defargs can resume - where the previous call left off. DEFARG_FNS is a tree_list where - the TREE_TYPE is the current_class_type, TREE_VALUE is the FUNCTION_DECL, - and TREE_PURPOSE is the list unprocessed dependent functions. */ - -/* list of functions with unprocessed defargs */ -static GTY(()) tree defarg_fns; -/* current default parameter */ -static GTY(()) tree defarg_parm; -/* list of unprocessed fns met during current fn. */ -static GTY(()) tree defarg_depfns; -/* list of fns with circular defargs */ -static GTY(()) tree defarg_fnsdone; - -/* Initialize obstacks. Called once, from cxx_init. */ - -void -init_spew () -{ - gcc_obstack_init (&token_obstack); -} - -/* Subroutine of read_token. */ -static SPEW_INLINE int -read_process_identifier (pyylval) - YYSTYPE *pyylval; -{ - tree id = pyylval->ttype; - - if (C_IS_RESERVED_WORD (id)) - { - pyylval->ttype = ridpointers[C_RID_CODE (id)]; - return C_RID_YYCODE (id); - } - - /* Make sure that user does not collide with our internal naming - scheme. This is not necessary if '.' is used to remove them from - the user's namespace, but is if '$' or double underscores are. */ - -#if !defined(JOINER) || JOINER == '$' - if (VPTR_NAME_P (id) - || VTABLE_NAME_P (id) - || TEMP_NAME_P (id) - || ANON_AGGRNAME_P (id)) - warning ( -"identifier name `%s' conflicts with GNU C++ internal naming strategy", - IDENTIFIER_POINTER (id)); -#endif - return IDENTIFIER; -} - -/* Concatenate strings before returning them to the parser. This isn't quite - as good as having it done in the lexer, but it's better than nothing. */ - -static void -yylexstring (t) - struct token *t; -{ - enum cpp_ttype next_type; - tree next; - - next_type = c_lex (&next); - if (next_type == CPP_STRING || next_type == CPP_WSTRING) - { - varray_type strings; - - VARRAY_TREE_INIT (strings, 32, "strings"); - VARRAY_PUSH_TREE (strings, t->yylval.ttype); - - do - { - VARRAY_PUSH_TREE (strings, next); - next_type = c_lex (&next); - } - while (next_type == CPP_STRING || next_type == CPP_WSTRING); - - t->yylval.ttype = combine_strings (strings); - last_token_id = t->yylval.ttype; - } - - /* We will have always read one token too many. */ - _cpp_backup_tokens (parse_in, 1); - - t->yychar = STRING; -} - -/* Read the next token from the input file. The token is written into - T, and its type number is returned. */ -static int -read_token (t) - struct token *t; -{ - retry: - - last_token = c_lex (&last_token_id); - t->yylval.ttype = last_token_id; - - switch (last_token) - { -#define YYCHAR(YY) t->yychar = (YY); break; -#define YYCODE(C) t->yylval.code = (C); - - case CPP_EQ: YYCHAR('='); - case CPP_NOT: YYCHAR('!'); - case CPP_GREATER: YYCODE(GT_EXPR); YYCHAR('>'); - case CPP_LESS: YYCODE(LT_EXPR); YYCHAR('<'); - case CPP_PLUS: YYCODE(PLUS_EXPR); YYCHAR('+'); - case CPP_MINUS: YYCODE(MINUS_EXPR); YYCHAR('-'); - case CPP_MULT: YYCODE(MULT_EXPR); YYCHAR('*'); - case CPP_DIV: YYCODE(TRUNC_DIV_EXPR); YYCHAR('/'); - case CPP_MOD: YYCODE(TRUNC_MOD_EXPR); YYCHAR('%'); - case CPP_AND: YYCODE(BIT_AND_EXPR); YYCHAR('&'); - case CPP_OR: YYCODE(BIT_IOR_EXPR); YYCHAR('|'); - case CPP_XOR: YYCODE(BIT_XOR_EXPR); YYCHAR('^'); - case CPP_RSHIFT: YYCODE(RSHIFT_EXPR); YYCHAR(RSHIFT); - case CPP_LSHIFT: YYCODE(LSHIFT_EXPR); YYCHAR(LSHIFT); - - case CPP_COMPL: YYCHAR('~'); - case CPP_AND_AND: YYCHAR(ANDAND); - case CPP_OR_OR: YYCHAR(OROR); - case CPP_QUERY: YYCHAR('?'); - case CPP_COLON: YYCHAR(':'); - case CPP_COMMA: YYCHAR(','); - case CPP_OPEN_PAREN: YYCHAR('('); - case CPP_CLOSE_PAREN: YYCHAR(')'); - case CPP_EQ_EQ: YYCODE(EQ_EXPR); YYCHAR(EQCOMPARE); - case CPP_NOT_EQ: YYCODE(NE_EXPR); YYCHAR(EQCOMPARE); - case CPP_GREATER_EQ:YYCODE(GE_EXPR); YYCHAR(ARITHCOMPARE); - case CPP_LESS_EQ: YYCODE(LE_EXPR); YYCHAR(ARITHCOMPARE); - - case CPP_PLUS_EQ: YYCODE(PLUS_EXPR); YYCHAR(ASSIGN); - case CPP_MINUS_EQ: YYCODE(MINUS_EXPR); YYCHAR(ASSIGN); - case CPP_MULT_EQ: YYCODE(MULT_EXPR); YYCHAR(ASSIGN); - case CPP_DIV_EQ: YYCODE(TRUNC_DIV_EXPR); YYCHAR(ASSIGN); - case CPP_MOD_EQ: YYCODE(TRUNC_MOD_EXPR); YYCHAR(ASSIGN); - case CPP_AND_EQ: YYCODE(BIT_AND_EXPR); YYCHAR(ASSIGN); - case CPP_OR_EQ: YYCODE(BIT_IOR_EXPR); YYCHAR(ASSIGN); - case CPP_XOR_EQ: YYCODE(BIT_XOR_EXPR); YYCHAR(ASSIGN); - case CPP_RSHIFT_EQ: YYCODE(RSHIFT_EXPR); YYCHAR(ASSIGN); - case CPP_LSHIFT_EQ: YYCODE(LSHIFT_EXPR); YYCHAR(ASSIGN); - - case CPP_OPEN_SQUARE: YYCHAR('['); - case CPP_CLOSE_SQUARE: YYCHAR(']'); - case CPP_OPEN_BRACE: YYCHAR('{'); - case CPP_CLOSE_BRACE: YYCHAR('}'); - case CPP_SEMICOLON: YYCHAR(';'); - case CPP_ELLIPSIS: YYCHAR(ELLIPSIS); - - case CPP_PLUS_PLUS: YYCHAR(PLUSPLUS); - case CPP_MINUS_MINUS: YYCHAR(MINUSMINUS); - case CPP_DEREF: YYCHAR(POINTSAT); - case CPP_DOT: YYCHAR('.'); - - /* These tokens are C++ specific. */ - case CPP_SCOPE: YYCHAR(SCOPE); - case CPP_DEREF_STAR: YYCHAR(POINTSAT_STAR); - case CPP_DOT_STAR: YYCHAR(DOT_STAR); - case CPP_MIN_EQ: YYCODE(MIN_EXPR); YYCHAR(ASSIGN); - case CPP_MAX_EQ: YYCODE(MAX_EXPR); YYCHAR(ASSIGN); - case CPP_MIN: YYCODE(MIN_EXPR); YYCHAR(MIN_MAX); - case CPP_MAX: YYCODE(MAX_EXPR); YYCHAR(MIN_MAX); -#undef YYCHAR -#undef YYCODE - - case CPP_EOF: - t->yychar = 0; - break; - - case CPP_NAME: - t->yychar = read_process_identifier (&t->yylval); - break; - - case CPP_NUMBER: - case CPP_CHAR: - case CPP_WCHAR: - t->yychar = CONSTANT; - break; - - case CPP_STRING: - case CPP_WSTRING: - yylexstring (t); - break; - - default: - yyerror ("parse error"); - goto retry; - } - - t->lineno = lineno; - return t->yychar; -} - -static void -feed_input (input) - struct unparsed_text *input; -{ - struct feed *f; -#if 0 - if (feed) - abort (); -#endif - - f = ggc_alloc (sizeof (struct feed)); - - input->cur_chunk = input->tokens; - input->cur_pos = 0; - -#ifdef SPEW_DEBUG - if (spew_debug) - fprintf (stderr, "\tfeeding %s:%d [%d tokens]\n", - input->locus.file, input->locus.line, input->limit - input->pos); -#endif - - f->input = input; - f->locus.file = input_filename; - f->locus.line = lineno; - f->yychar = yychar; - f->yylval = yylval; - f->first_token = first_token; - f->token_obstack = token_obstack; - f->next = feed; - - input_filename = input->locus.file; - lineno = input->locus.line; - yychar = YYEMPTY; - yylval.ttype = NULL_TREE; - first_token = 0; - gcc_obstack_init (&token_obstack); - feed = f; -} - -void -end_input () -{ - struct feed *f = feed; - - input_filename = f->locus.file; - lineno = f->locus.line; - yychar = f->yychar; - yylval = f->yylval; - first_token = f->first_token; - obstack_free (&token_obstack, 0); - token_obstack = f->token_obstack; - feed = f->next; - -#ifdef SPEW_DEBUG - if (spew_debug) - fprintf (stderr, "\treturning to %s:%d\n", input_filename, lineno); -#endif -} - -/* Token queue management. */ - -/* Return the number of tokens available on the fifo. */ -static SPEW_INLINE int -num_tokens () -{ - return (obstack_object_size (&token_obstack) / sizeof (struct token)) - - first_token; -} - -/* Fetch the token N down the line from the head of the fifo. */ - -static SPEW_INLINE struct token* -nth_token (n) - int n; -{ -#ifdef ENABLE_CHECKING - /* could just have this do slurp_ implicitly, but this way is easier - to debug... */ - my_friendly_assert (n >= 0 && n < num_tokens (), 298); -#endif - return ((struct token*)obstack_base (&token_obstack)) + n + first_token; -} - -static const struct token Teosi = { END_OF_SAVED_INPUT, 0 UNION_INIT_ZERO }; -static const struct token Tpad = { EMPTY, 0 UNION_INIT_ZERO }; - -/* Copy the next token into T and return its value. */ -static SPEW_INLINE int -next_token (t) - struct token *t; -{ - if (!feed) - return read_token (t); - - if (feed->input->cur_chunk != feed->input->last_chunk - || feed->input->cur_pos != feed->input->last_pos) - { - if (feed->input->cur_pos == TOKEN_CHUNK_SIZE) - { - feed->input->cur_chunk = feed->input->cur_chunk->next; - feed->input->cur_pos = 0; - } - memcpy (t, feed->input->cur_chunk->toks + feed->input->cur_pos, - sizeof (struct token)); - feed->input->cur_pos++; - return t->yychar; - } - - return 0; -} - -/* Shift the next token onto the fifo. */ -static SPEW_INLINE int -shift_token () -{ - size_t point = obstack_object_size (&token_obstack); - obstack_blank (&token_obstack, sizeof (struct token)); - return next_token ((struct token *) (obstack_base (&token_obstack) + point)); -} - -/* Consume the next token out of the fifo. */ - -static SPEW_INLINE void -consume_token () -{ - if (num_tokens () == 1) - { - obstack_free (&token_obstack, obstack_base (&token_obstack)); - first_token = 0; - } - else - first_token++; -} - -/* Push a token at the head of the queue; it will be the next token read. */ -static SPEW_INLINE void -push_token (t) - struct token *t; -{ - if (first_token == 0) /* We hope this doesn't happen often. */ - { - size_t active = obstack_object_size (&token_obstack); - obstack_blank (&token_obstack, sizeof (struct token)); - if (active) - memmove (obstack_base (&token_obstack) + sizeof (struct token), - obstack_base (&token_obstack), active); - first_token++; - } - first_token--; - memcpy (nth_token (0), t, sizeof (struct token)); -} - - -/* Pull in enough tokens that the queue is N long beyond the current - token. */ - -static void -scan_tokens (n) - int n; -{ - int i; - int num = num_tokens (); - int yychar; - - /* First, prune any empty tokens at the end. */ - i = num; - while (i > 0 && nth_token (i - 1)->yychar == EMPTY) - i--; - if (i < num) - { - obstack_blank (&token_obstack, -((num - i) * sizeof (struct token))); - num = i; - } - - /* Now, if we already have enough tokens, return. */ - if (num > n) - return; - - /* Never read past these characters: they might separate - the current input stream from one we save away later. */ - for (i = 0; i < num; i++) - { - yychar = nth_token (i)->yychar; - if (yychar == '{' || yychar == ':' || yychar == ';') - goto pad_tokens; - } - - while (num_tokens () <= n) - { - yychar = shift_token (); - if (yychar == '{' || yychar == ':' || yychar == ';') - goto pad_tokens; - } - return; - - pad_tokens: - while (num_tokens () <= n) - obstack_grow (&token_obstack, &Tpad, sizeof (struct token)); -} - -int looking_for_typename; -int looking_for_template; - -static int after_friend; -static int after_new; -static int do_snarf_defarg; - -tree got_scope; -tree got_object; - -static SPEW_INLINE int -identifier_type (decl) - tree decl; -{ - tree t; - - if (TREE_CODE (decl) == TEMPLATE_DECL) - { - if (TREE_CODE (DECL_TEMPLATE_RESULT (decl)) == TYPE_DECL) - return PTYPENAME; - else if (looking_for_template) - return PFUNCNAME; - } - if (looking_for_template && really_overloaded_fn (decl)) - { - /* See through a baselink. */ - if (TREE_CODE (decl) == BASELINK) - decl = BASELINK_FUNCTIONS (decl); - - for (t = decl; t != NULL_TREE; t = OVL_CHAIN (t)) - if (DECL_FUNCTION_TEMPLATE_P (OVL_FUNCTION (t))) - return PFUNCNAME; - } - if (TREE_CODE (decl) == NAMESPACE_DECL) - return NSNAME; - if (TREE_CODE (decl) != TYPE_DECL) - return IDENTIFIER; - if (DECL_ARTIFICIAL (decl) && TREE_TYPE (decl) == current_class_type) - return SELFNAME; - - /* A constructor declarator for a template type will get here as an - implicit typename, a TYPENAME_TYPE with a type. */ - t = got_scope; - if (t && TREE_CODE (t) == TYPENAME_TYPE) - t = TREE_TYPE (t); - decl = TREE_TYPE (decl); - if (TREE_CODE (decl) == TYPENAME_TYPE) - decl = TREE_TYPE (decl); - if (t && t == decl) - return SELFNAME; - - return tTYPENAME; -} - -/* token[0] == AGGR (struct/union/enum) - Thus, token[1] is either a tTYPENAME or a TYPENAME_DEFN. - If token[2] == '{' or ':' then it's TYPENAME_DEFN. - It's also a definition if it's a forward declaration (as in 'struct Foo;') - which we can tell if token[2] == ';' *and* token[-1] != FRIEND or NEW. */ - -static SPEW_INLINE void -do_aggr () -{ - int yc1, yc2; - - scan_tokens (2); - yc1 = nth_token (1)->yychar; - if (yc1 != tTYPENAME && yc1 != IDENTIFIER && yc1 != PTYPENAME) - return; - yc2 = nth_token (2)->yychar; - if (yc2 == ';') - { - /* It's a forward declaration iff we were not preceded by - 'friend' or `new'. */ - if (after_friend || after_new) - return; - } - else if (yc2 != '{' && yc2 != ':') - return; - - switch (yc1) - { - case tTYPENAME: - nth_token (1)->yychar = TYPENAME_DEFN; - break; - case PTYPENAME: - nth_token (1)->yychar = PTYPENAME_DEFN; - break; - case IDENTIFIER: - nth_token (1)->yychar = IDENTIFIER_DEFN; - break; - default: - abort (); - } -} - -void -see_typename () -{ - /* Only types expected, not even namespaces. */ - looking_for_typename = 2; - if (yychar < 0) - if ((yychar = yylex ()) < 0) yychar = 0; - looking_for_typename = 0; - if (yychar == IDENTIFIER) - { - lastiddecl = lookup_name (yylval.ttype, -2); - if (lastiddecl) - yychar = identifier_type (lastiddecl); - } -} - -int -yylex () -{ - int yychr; - int old_looking_for_typename = 0; - int just_saw_new = 0; - int just_saw_friend = 0; - - timevar_push (TV_LEX); - - retry: -#ifdef SPEW_DEBUG - if (spew_debug) - { - yylex_ctr ++; - fprintf (stderr, "\t\t## %d @%d ", yylex_ctr, lineno); - } -#endif - - if (do_snarf_defarg) - { - do_snarf_defarg = 0; - yylval.ttype = snarf_defarg (); - yychar = DEFARG; - got_object = NULL_TREE; - timevar_pop (TV_LEX); - return DEFARG; - } - - /* if we've got tokens, send them */ - else if (num_tokens ()) - yychr = nth_token (0)->yychar; - else - yychr = shift_token (); - - /* many tokens just need to be returned. At first glance, all we - have to do is send them back up, but some of them are needed to - figure out local context. */ - switch (yychr) - { - case EMPTY: - /* This is a lexical no-op. */ -#ifdef SPEW_DEBUG - if (spew_debug) - debug_yychar (yychr); -#endif - consume_token (); - goto retry; - - case '(': - scan_tokens (1); - if (nth_token (1)->yychar == ')') - { - consume_token (); - yychr = LEFT_RIGHT; - } - break; - - case IDENTIFIER: - { - int peek; - - scan_tokens (1); - peek = nth_token (1)->yychar; - yychr = frob_id (yychr, peek, &nth_token (0)->yylval.ttype); - break; - } - case IDENTIFIER_DEFN: - case tTYPENAME: - case TYPENAME_DEFN: - case PTYPENAME: - case PTYPENAME_DEFN: - /* If we see a SCOPE next, restore the old value. - Otherwise, we got what we want. */ - looking_for_typename = old_looking_for_typename; - looking_for_template = 0; - break; - - case SCSPEC: - if (nth_token (0)->yylval.ttype == ridpointers[RID_EXTERN]) - { - scan_tokens (1); - if (nth_token (1)->yychar == STRING) - { - yychr = EXTERN_LANG_STRING; - nth_token (1)->yylval.ttype = get_identifier - (TREE_STRING_POINTER (nth_token (1)->yylval.ttype)); - consume_token (); - } - } - /* do_aggr needs to know if the previous token was `friend'. */ - else if (nth_token (0)->yylval.ttype == ridpointers[RID_FRIEND]) - just_saw_friend = 1; - - break; - - case NEW: - /* do_aggr needs to know if the previous token was `new'. */ - just_saw_new = 1; - break; - - case TYPESPEC: - case '{': - case ':': - case ';': - /* If this provides a type for us, then revert lexical - state to standard state. */ - looking_for_typename = 0; - break; - - case AGGR: - do_aggr (); - break; - - case ENUM: - /* Set this again, in case we are rescanning. */ - looking_for_typename = 2; - break; - - default: - break; - } - - after_friend = just_saw_friend; - after_new = just_saw_new; - - /* class member lookup only applies to the first token after the object - expression, except for explicit destructor calls. */ - if (yychr != '~') - got_object = NULL_TREE; - - yychar = yychr; - { - struct token *tok = nth_token (0); - - yylval = tok->yylval; - if (tok->lineno) - lineno = tok->lineno; - } - -#ifdef SPEW_DEBUG - if (spew_debug) - debug_yychar (yychr); -#endif - consume_token (); - - timevar_pop (TV_LEX); - return yychr; -} - -/* Unget character CH from the input stream. - If RESCAN is nonzero, then we want to `see' this - character as the next input token. */ - -void -yyungetc (ch, rescan) - int ch; - int rescan; -{ - /* Unget a character from the input stream. */ - if (yychar == YYEMPTY || rescan == 0) - { - struct token fake; - - fake.yychar = ch; - fake.yylval.ttype = 0; - fake.lineno = lineno; - - push_token (&fake); - } - else - { - yychar = ch; - } -} - -/* Lexer hackery to determine what *IDP really is. */ - -static int -frob_id (yyc, peek, idp) - int yyc; - int peek; - tree *idp; -{ - tree trrr; - int old_looking_for_typename = 0; - - if (peek == SCOPE) - { - /* Don't interfere with the setting from an 'aggr' prefix. */ - old_looking_for_typename = looking_for_typename; - looking_for_typename = 1; - } - else if (peek == '<') - looking_for_template = 1; - trrr = lookup_name (*idp, -2); - if (trrr) - { - yyc = identifier_type (trrr); - switch(yyc) - { - case tTYPENAME: - case SELFNAME: - case NSNAME: - case PTYPENAME: - /* If this got special lookup, remember it. In these - cases, we know it can't be a declarator-id. */ - if (got_scope || got_object) - *idp = trrr; - /* FALLTHROUGH */ - case PFUNCNAME: - case IDENTIFIER: - lastiddecl = trrr; - break; - default: - abort (); - } - } - else - lastiddecl = NULL_TREE; - got_scope = NULL_TREE; - looking_for_typename = old_looking_for_typename; - looking_for_template = 0; - return yyc; -} - -/* ID is an operator name. Duplicate the hackery in yylex to determine what - it really is. */ - -tree frob_opname (id) - tree id; -{ - scan_tokens (0); - frob_id (0, nth_token (0)->yychar, &id); - got_object = NULL_TREE; - return id; -} - -/* Set up the state required to correctly handle the definition of the - inline function whose preparsed state has been saved in PI. */ - -static void -begin_parsing_inclass_inline (pi) - struct unparsed_text *pi; -{ - tree context; - - /* Record that we are processing the chain of inlines starting at - PI for GC. */ - if (cfun) - cp_function_chain->unparsed_inlines = pi; - else - processing_these_inlines = pi; - - ggc_collect (); - - /* If this is an inline function in a local class, we must make sure - that we save all pertinent information about the function - surrounding the local class. */ - context = decl_function_context (pi->decl); - if (context) - push_function_context_to (context); - - feed_input (pi); - interface_unknown = pi->interface == 1; - interface_only = pi->interface == 0; - DECL_PENDING_INLINE_P (pi->decl) = 0; - DECL_PENDING_INLINE_INFO (pi->decl) = 0; - - /* Pass back a handle to the rest of the inline functions, so that they - can be processed later. */ - yychar = PRE_PARSED_FUNCTION_DECL; - yylval.pi = pi; - - start_function (NULL_TREE, pi->decl, NULL_TREE, - (SF_DEFAULT | SF_PRE_PARSED | SF_INCLASS_INLINE)); -} - -/* Called from the top level: if there are any pending inlines to - do, set up to process them now. This function sets up the first function - to be parsed; after it has been, the rule for fndef in parse.y will - call process_next_inline to start working on the next one. */ - -void -do_pending_inlines () -{ - /* Oops, we're still dealing with the last batch. */ - if (yychar == PRE_PARSED_FUNCTION_DECL) - return; - - if (pending_inlines) - { - /* Clear the chain, so that any inlines nested inside the batch - we're to process now don't refer to this batch. See e.g. - g++.other/lookup6.C. */ - struct unparsed_text *first = pending_inlines; - pending_inlines = pending_inlines_tail = 0; - - begin_parsing_inclass_inline (first); - } -} - -/* Called from the fndecl rule in the parser when the function just parsed - was declared using a PRE_PARSED_FUNCTION_DECL (i.e. came from - do_pending_inlines). */ - -void -process_next_inline (i) - struct unparsed_text *i; -{ - tree decl = i->decl; - tree context = decl_function_context (decl); - - if (context) - pop_function_context_from (context); - if (yychar == YYEMPTY) - yychar = yylex (); - if (yychar != END_OF_SAVED_INPUT) - error ("parse error at end of saved function text"); - end_input (); - - i = i->next; - if (i) - begin_parsing_inclass_inline (i); - else - { - if (cfun) - cp_function_chain->unparsed_inlines = 0; - else - processing_these_inlines = 0; - extract_interface_info (); - } -} - -/* Create a new token at the end of the token list in T. */ -static SPEW_INLINE struct token * -space_for_token (t) - struct unparsed_text *t; -{ - if (t->last_pos != TOKEN_CHUNK_SIZE) - return t->last_chunk->toks + (t->last_pos++); - - t->last_chunk->next = ggc_alloc_cleared (sizeof (*t->last_chunk->next)); - t->last_chunk = t->last_chunk->next; - t->last_chunk->next = NULL; - - t->last_pos = 1; - return t->last_chunk->toks; -} - -/* Shrink the token list in T by one token. */ -static SPEW_INLINE struct token * -remove_last_token (t) - struct unparsed_text *t; -{ - struct token *result = t->last_chunk->toks + t->last_pos - 1; - if (t->last_pos == 0) - abort (); - t->last_pos--; - if (t->last_pos == 0 && t->last_chunk != t->tokens) - { - struct token_chunk *c; - c = t->tokens; - while (c->next != t->last_chunk) - c = c->next; - c->next = NULL; - t->last_chunk = c; - t->last_pos = ARRAY_SIZE (c->toks); - } - return result; -} - -/* Allocate an 'unparsed_text' structure, ready to use space_for_token. */ -static struct unparsed_text * -alloc_unparsed_text (locus, decl, interface) - const location_t *locus; - tree decl; - int interface; -{ - struct unparsed_text *r; - r = ggc_alloc_cleared (sizeof (*r)); - r->decl = decl; - r->locus = *locus; - r->interface = interface; - r->tokens = r->last_chunk = ggc_alloc_cleared (sizeof (*r->tokens)); - return r; -} - -/* Accumulate the tokens that make up a parenthesized expression in T, - having already read the opening parenthesis. */ - -static void -snarf_parenthesized_expression (struct unparsed_text *t) -{ - int yyc; - int level = 1; - - while (1) - { - yyc = next_token (space_for_token (t)); - if (yyc == '(') - ++level; - else if (yyc == ')' && --level == 0) - break; - else if (yyc == 0) - { - error ("%Hend of file read inside definition", &t->locus); - break; - } - } -} - -/* Subroutine of snarf_method, deals with actual absorption of the block. */ - -static void -snarf_block (t) - struct unparsed_text *t; -{ - int blev = 1; - int look_for_semicolon = 0; - int look_for_lbrac = 0; - int look_for_catch = 0; - int yyc; - struct token *current; - - if (yychar == '{') - ; - else if (yychar == '=') - look_for_semicolon = 1; - else if (yychar == ':' || yychar == RETURN_KEYWORD || yychar == TRY) - { - if (yychar == TRY) - look_for_catch = 1; - look_for_lbrac = 1; - blev = 0; - } - else - yyerror ("parse error in method specification"); - - /* The current token is the first one to be recorded. */ - current = space_for_token (t); - current->yychar = yychar; - current->yylval = yylval; - current->lineno = lineno; - - for (;;) - { - yyc = next_token (space_for_token (t)); - - if (yyc == '{') - { - look_for_lbrac = 0; - blev++; - } - else if (yyc == '}') - { - blev--; - if (blev == 0 && !look_for_semicolon) - { - if (!look_for_catch) - break; - - if (next_token (space_for_token (t)) != CATCH) - { - push_token (remove_last_token (t)); - break; - } - - look_for_lbrac = 1; - } - } - else if (yyc == ';') - { - if (look_for_lbrac) - { - struct token *fake; - - error ("function body for constructor missing"); - /* fake a { } to avoid further errors */ - fake = space_for_token (t); - fake->yylval.ttype = 0; - fake->yychar = '{'; - fake = space_for_token (t); - fake->yylval.ttype = 0; - fake->yychar = '}'; - break; - } - else if (look_for_semicolon && blev == 0) - break; - } - else if (yyc == '(' && blev == 0) - snarf_parenthesized_expression (t); - else if (yyc == 0) - { - error ("%Hend of file read inside definition", &t->locus); - break; - } - } -} - -/* This function stores away the text for an inline function that should - be processed later (by do_pending_inlines). */ -void -snarf_method (decl) - tree decl; -{ - struct unparsed_text *meth; - location_t starting; - starting.file = input_filename; - starting.line = lineno; - - meth = alloc_unparsed_text (&starting, decl, (interface_unknown ? 1 - : (interface_only ? 0 : 2))); - - snarf_block (meth); - /* Add three END_OF_SAVED_INPUT tokens. We used to provide an - infinite stream of END_OF_SAVED_INPUT tokens -- but that can - cause the compiler to get stuck in an infinite loop when - encountering invalid code. We need more than one because the - parser sometimes peeks ahead several tokens. */ - memcpy (space_for_token (meth), &Teosi, sizeof (struct token)); - memcpy (space_for_token (meth), &Teosi, sizeof (struct token)); - memcpy (space_for_token (meth), &Teosi, sizeof (struct token)); - - /* Happens when we get two declarations of the same function in the - same scope. */ - if (decl == void_type_node - || (current_class_type && TYPE_REDEFINED (current_class_type))) - return; - -#ifdef SPEW_DEBUG - if (spew_debug) - fprintf (stderr, "\tsaved method of %d tokens from %s:%d\n", - meth->limit, starting.file, starting.line); -#endif - - DECL_PENDING_INLINE_INFO (decl) = meth; - DECL_PENDING_INLINE_P (decl) = 1; - - /* We need to know that this was defined in the class, so that - friend templates are handled correctly. */ - DECL_INITIALIZED_IN_CLASS_P (decl) = 1; - - if (pending_inlines_tail) - pending_inlines_tail->next = meth; - else - pending_inlines = meth; - pending_inlines_tail = meth; -} - -/* Consume a no-commas expression - a default argument - and return - a DEFAULT_ARG tree node. */ - -static tree -snarf_defarg () -{ - int yyc; - int plev = 0; - struct unparsed_text *buf; - tree arg; - location_t starting; - starting.file = input_filename; - starting.line = lineno; - - buf = alloc_unparsed_text (&starting, 0, 0); - - for (;;) - { - yyc = next_token (space_for_token (buf)); - - if (plev <= 0 && (yyc == ')' || yyc == ',')) - break; - else if (yyc == '(' || yyc == '[') - ++plev; - else if (yyc == ']' || yyc == ')') - --plev; - else if (yyc == 0) - { - error ("%Hend of file read inside default argument", &starting); - goto done; - } - } - - /* Unget the last token. */ - push_token (remove_last_token (buf)); - /* Add three END_OF_SAVED_INPUT tokens. We used to provide an - infinite stream of END_OF_SAVED_INPUT tokens -- but that can - cause the compiler to get stuck in an infinite loop when - encountering invalid code. We need more than one because the - parser sometimes peeks ahead several tokens. */ - memcpy (space_for_token (buf), &Teosi, sizeof (struct token)); - memcpy (space_for_token (buf), &Teosi, sizeof (struct token)); - memcpy (space_for_token (buf), &Teosi, sizeof (struct token)); - - done: -#ifdef SPEW_DEBUG - if (spew_debug) - fprintf (stderr, "\tsaved defarg of %d tokens from %s:%d\n", - buf->limit, starting.file, starting.line); -#endif - - arg = make_node (DEFAULT_ARG); - DEFARG_POINTER (arg) = (char *)buf; - - return arg; -} - -/* Decide whether the default argument we are about to see should be - gobbled up as text for later parsing. */ - -void -maybe_snarf_defarg () -{ - if (current_class_type && TYPE_BEING_DEFINED (current_class_type)) - do_snarf_defarg = 1; -} - -/* Called from grokfndecl to note a function decl with unparsed default - arguments for later processing. Also called from grokdeclarator - for function types with unparsed defargs; the call from grokfndecl - will always come second, so we can overwrite the entry from the type. */ - -void -add_defarg_fn (decl) - tree decl; -{ - if (TREE_CODE (decl) == FUNCTION_DECL) - TREE_VALUE (defarg_fns) = decl; - else - { - defarg_fns = tree_cons (NULL_TREE, decl, defarg_fns); - TREE_TYPE (defarg_fns) = current_class_type; - } -} - -/* Helper for do_pending_defargs. Starts the parsing of a default arg. */ - -static void -feed_defarg (p) - tree p; -{ - tree d = TREE_PURPOSE (p); - - feed_input ((struct unparsed_text *)DEFARG_POINTER (d)); - yychar = DEFARG_MARKER; - yylval.ttype = p; -} - -/* Helper for do_pending_defargs. Ends the parsing of a default arg. */ - -static void -finish_defarg () -{ - if (yychar == YYEMPTY) - yychar = yylex (); - if (yychar != END_OF_SAVED_INPUT) - error ("parse error at end of saved function text"); - - end_input (); -} - -/* Main function for deferred parsing of default arguments. Called from - the parser. */ - -void -do_pending_defargs () -{ - if (defarg_parm) - finish_defarg (); - - for (; defarg_fns;) - { - tree current = defarg_fns; - - tree defarg_fn = TREE_VALUE (defarg_fns); - if (defarg_parm == NULL_TREE) - { - push_nested_class (TREE_TYPE (defarg_fns), 1); - pushlevel (0); - if (TREE_CODE (defarg_fn) == FUNCTION_DECL) - maybe_begin_member_template_processing (defarg_fn); - - if (TREE_CODE (defarg_fn) == FUNCTION_DECL) - defarg_parm = TYPE_ARG_TYPES (TREE_TYPE (defarg_fn)); - else - defarg_parm = TYPE_ARG_TYPES (defarg_fn); - } - else - defarg_parm = TREE_CHAIN (defarg_parm); - - for (; defarg_parm; defarg_parm = TREE_CHAIN (defarg_parm)) - if (!TREE_PURPOSE (defarg_parm) - || TREE_CODE (TREE_PURPOSE (defarg_parm)) != DEFAULT_ARG) - ;/* OK */ - else if (TREE_PURPOSE (current) == error_mark_node) - DEFARG_POINTER (TREE_PURPOSE (defarg_parm)) = NULL; - else - { - feed_defarg (defarg_parm); - - /* Return to the parser, which will process this defarg - and call us again. */ - return; - } - - if (TREE_CODE (defarg_fn) == FUNCTION_DECL) - { - maybe_end_member_template_processing (); - check_default_args (defarg_fn); - } - - poplevel (0, 0, 0); - pop_nested_class (); - - defarg_fns = TREE_CHAIN (defarg_fns); - if (defarg_depfns) - { - /* This function's default args depend on unprocessed default args - of defarg_fns. We will need to reprocess this function, and - check for circular dependencies. */ - tree a, b; - - for (a = defarg_depfns, b = TREE_PURPOSE (current); a && b; - a = TREE_CHAIN (a), b = TREE_CHAIN (b)) - if (TREE_VALUE (a) != TREE_VALUE (b)) - goto different; - if (a || b) - { - different:; - TREE_CHAIN (current) = NULL_TREE; - defarg_fns = chainon (defarg_fns, current); - TREE_PURPOSE (current) = defarg_depfns; - } - else - { - cp_warning_at ("circular dependency in default args of `%#D'", defarg_fn); - /* No need to say what else is dependent, as they will be - picked up in another pass. */ - - /* Immediately repeat, but marked so that we break the loop. */ - defarg_fns = current; - TREE_PURPOSE (current) = error_mark_node; - } - defarg_depfns = NULL_TREE; - } - else if (TREE_PURPOSE (current) == error_mark_node) - defarg_fnsdone = tree_cons (NULL_TREE, defarg_fn, defarg_fnsdone); - } -} - -/* After parsing all the default arguments, we must clear any that remain, - which will be part of a circular dependency. */ -void -done_pending_defargs () -{ - for (; defarg_fnsdone; defarg_fnsdone = TREE_CHAIN (defarg_fnsdone)) - { - tree fn = TREE_VALUE (defarg_fnsdone); - tree parms; - - if (TREE_CODE (fn) == FUNCTION_DECL) - parms = TYPE_ARG_TYPES (TREE_TYPE (fn)); - else - parms = TYPE_ARG_TYPES (fn); - for (; parms; parms = TREE_CHAIN (parms)) - if (TREE_PURPOSE (parms) - && TREE_CODE (TREE_PURPOSE (parms)) == DEFAULT_ARG) - { - my_friendly_assert (!DEFARG_POINTER (TREE_PURPOSE (parms)), 20010107); - TREE_PURPOSE (parms) = NULL_TREE; - } - } -} - -/* In processing the current default arg, we called FN, but that call - required a default argument of FN, and that had not yet been processed. - Remember FN. */ - -void -unprocessed_defarg_fn (fn) - tree fn; -{ - defarg_depfns = tree_cons (NULL_TREE, fn, defarg_depfns); -} - -/* Called from the parser to update an element of TYPE_ARG_TYPES for some - FUNCTION_TYPE with the newly parsed version of its default argument, which - was previously digested as text. */ - -void -replace_defarg (arg, init) - tree arg, init; -{ - if (init == error_mark_node) - TREE_PURPOSE (arg) = error_mark_node; - else - { - if (! processing_template_decl - && ! can_convert_arg (TREE_VALUE (arg), TREE_TYPE (init), init)) - pedwarn ("invalid type `%T' for default argument to `%T'", - TREE_TYPE (init), TREE_VALUE (arg)); - if (!defarg_depfns) - TREE_PURPOSE (arg) = init; - } -} - -#ifdef SPEW_DEBUG -/* debug_yychar takes a yychar (token number) value and prints its name. */ - -static void -debug_yychar (yy) - int yy; -{ - if (yy<256) - fprintf (stderr, "->%d < %c >\n", lineno, yy); - else if (yy == IDENTIFIER || yy == tTYPENAME) - { - const char *id; - if (TREE_CODE (yylval.ttype) == IDENTIFIER_NODE) - id = IDENTIFIER_POINTER (yylval.ttype); - else if (TREE_CODE_CLASS (TREE_CODE (yylval.ttype)) == 'd') - id = IDENTIFIER_POINTER (DECL_NAME (yylval.ttype)); - else - id = ""; - fprintf (stderr, "->%d <%s `%s'>\n", lineno, debug_yytranslate (yy), id); - } - else - fprintf (stderr, "->%d <%s>\n", lineno, debug_yytranslate (yy)); -} - -#endif - -#define NAME(TYPE) cpp_type2name (TYPE) - -void -yyerror (msgid) - const char *msgid; -{ - const char *string = _(msgid); - - if (last_token == CPP_EOF) - error ("%s at end of input", string); - else if (last_token == CPP_CHAR || last_token == CPP_WCHAR) - { - if (yylval.ttype && TREE_CODE (yylval.ttype) == INTEGER_CST) - { - unsigned int val = TREE_INT_CST_LOW (yylval.ttype); - const char *const ell = (last_token == CPP_CHAR) ? "" : "L"; - if (val <= UCHAR_MAX && ISGRAPH (val)) - error ("%s before %s'%c'", string, ell, val); - else - error ("%s before %s'\\x%x'", string, ell, val); - } - else - error ("%s", string); - } - else if (last_token == CPP_STRING - || last_token == CPP_WSTRING) - error ("%s before string constant", string); - else if (last_token == CPP_NUMBER) - error ("%s before numeric constant", string); - else if (last_token == CPP_NAME) - { - if (TREE_CODE (last_token_id) == IDENTIFIER_NODE) - error ("%s before `%s'", string, IDENTIFIER_POINTER (last_token_id)); - else if (ISGRAPH (yychar)) - error ("%s before `%c'", string, yychar); - else - error ("%s before `\%o'", string, yychar); - } - else - error ("%s before `%s' token", string, NAME (last_token)); -} - -#include "gt-cp-spew.h" diff --git a/contrib/gcc/cppmain.c b/contrib/gcc/cppmain.c deleted file mode 100644 index d49c6f8..0000000 --- a/contrib/gcc/cppmain.c +++ /dev/null @@ -1,432 +0,0 @@ -/* Preprocess only, using cpplib. - Copyright (C) 1995, 1997, 1998, 1999, 2000, 2001, 2002, 2003 - Free Software Foundation, Inc. - Written by Per Bothner, 1994-95. - -This program is free software; you can redistribute it and/or modify it -under the terms of the GNU General Public License as published by the -Free Software Foundation; either version 2, or (at your option) any -later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - - In other words, you are welcome to use, share and improve this program. - You are forbidden to forbid anyone else to use, share and improve - what you give them. Help stamp out software-hoarding! */ - -#include "config.h" -#include "system.h" -#include "cpplib.h" -#include "cpphash.h" - -static void setup_callbacks PARAMS ((cpp_reader *)); - -/* General output routines. */ -static void scan_translation_unit PARAMS ((cpp_reader *)); -static void scan_translation_unit_trad PARAMS ((cpp_reader *)); -static void account_for_newlines PARAMS ((cpp_reader *, const uchar *, - size_t)); -static int dump_macro PARAMS ((cpp_reader *, cpp_hashnode *, void *)); - -static void print_line PARAMS ((cpp_reader *, const struct line_map *, - unsigned int, const char *)); -static void maybe_print_line PARAMS ((cpp_reader *, const struct line_map *, - unsigned int)); - -/* Callback routines for the parser. Most of these are active only - in specific modes. */ -static void cb_line_change PARAMS ((cpp_reader *, const cpp_token *, int)); -static void cb_define PARAMS ((cpp_reader *, unsigned int, cpp_hashnode *)); -static void cb_undef PARAMS ((cpp_reader *, unsigned int, cpp_hashnode *)); -static void cb_include PARAMS ((cpp_reader *, unsigned int, - const unsigned char *, const cpp_token *)); -static void cb_ident PARAMS ((cpp_reader *, unsigned int, - const cpp_string *)); -static void cb_file_change PARAMS ((cpp_reader *, const struct line_map *)); -static void cb_def_pragma PARAMS ((cpp_reader *, unsigned int)); - -/* Preprocess and output. */ -void -cpp_preprocess_file (pfile, in_fname, out_stream) - cpp_reader *pfile; - const char *in_fname; - FILE *out_stream; -{ - /* Initialize the printer structure. Setting print.line to -1 here - is a trick to guarantee that the first token of the file will - cause a linemarker to be output by maybe_print_line. */ - pfile->print.line = (unsigned int) -1; - pfile->print.printed = 0; - pfile->print.prev = 0; - pfile->print.map = 0; - pfile->print.outf = out_stream; - - setup_callbacks (pfile); - - if (cpp_read_main_file (pfile, in_fname, NULL)) - { - cpp_options *options = &pfile->opts; - cpp_finish_options (pfile); - - /* A successful cpp_read_main_file guarantees that we can call - cpp_scan_nooutput or cpp_get_token next. */ - if (options->no_output) - { - /* Scan -included buffers, then the main file. */ - while (pfile->buffer->prev) - cpp_scan_nooutput (pfile); - cpp_scan_nooutput (pfile); - } - else if (options->traditional) - scan_translation_unit_trad (pfile); - else - scan_translation_unit (pfile); - - /* -dM command line option. Should this be in cpp_finish? */ - if (options->dump_macros == dump_only) - cpp_forall_identifiers (pfile, dump_macro, NULL); - } - - /* Flush any pending output. */ - if (pfile->print.printed) - putc ('\n', pfile->print.outf); -} - -/* Set up the callbacks as appropriate. */ -static void -setup_callbacks (pfile) - cpp_reader *pfile; -{ - cpp_options *options = &pfile->opts; - cpp_callbacks *cb = cpp_get_callbacks (pfile); - - if (! options->no_output) - { - cb->line_change = cb_line_change; - /* Don't emit #pragma or #ident directives if we are processing - assembly language; the assembler may choke on them. */ - if (options->lang != CLK_ASM) - { - cb->ident = cb_ident; - cb->def_pragma = cb_def_pragma; - } - if (! options->no_line_commands) - cb->file_change = cb_file_change; - } - - if (options->dump_includes) - cb->include = cb_include; - - if (options->dump_macros == dump_names - || options->dump_macros == dump_definitions) - { - cb->define = cb_define; - cb->undef = cb_undef; - } -} - -/* Writes out the preprocessed file, handling spacing and paste - avoidance issues. */ -static void -scan_translation_unit (pfile) - cpp_reader *pfile; -{ - bool avoid_paste = false; - - pfile->print.source = NULL; - for (;;) - { - const cpp_token *token = cpp_get_token (pfile); - - if (token->type == CPP_PADDING) - { - avoid_paste = true; - if (pfile->print.source == NULL - || (!(pfile->print.source->flags & PREV_WHITE) - && token->val.source == NULL)) - pfile->print.source = token->val.source; - continue; - } - - if (token->type == CPP_EOF) - break; - - /* Subtle logic to output a space if and only if necessary. */ - if (avoid_paste) - { - if (pfile->print.source == NULL) - pfile->print.source = token; - if (pfile->print.source->flags & PREV_WHITE - || (pfile->print.prev - && cpp_avoid_paste (pfile, pfile->print.prev, token)) - || (pfile->print.prev == NULL && token->type == CPP_HASH)) - putc (' ', pfile->print.outf); - } - else if (token->flags & PREV_WHITE) - putc (' ', pfile->print.outf); - - avoid_paste = false; - pfile->print.source = NULL; - pfile->print.prev = token; - cpp_output_token (token, pfile->print.outf); - - if (token->type == CPP_COMMENT) - account_for_newlines (pfile, token->val.str.text, token->val.str.len); - } -} - -/* Adjust pfile->print.line for newlines embedded in output. */ -static void -account_for_newlines (pfile, str, len) - cpp_reader *pfile; - const uchar *str; - size_t len; -{ - while (len--) - if (*str++ == '\n') - pfile->print.line++; -} - -/* Writes out a traditionally preprocessed file. */ -static void -scan_translation_unit_trad (pfile) - cpp_reader *pfile; -{ - while (_cpp_read_logical_line_trad (pfile)) - { - size_t len = pfile->out.cur - pfile->out.base; - maybe_print_line (pfile, pfile->print.map, pfile->out.first_line); - fwrite (pfile->out.base, 1, len, pfile->print.outf); - pfile->print.printed = 1; - if (!CPP_OPTION (pfile, discard_comments)) - account_for_newlines (pfile, pfile->out.base, len); - } -} - -/* If the token read on logical line LINE needs to be output on a - different line to the current one, output the required newlines or - a line marker, and return 1. Otherwise return 0. */ -static void -maybe_print_line (pfile, map, line) - cpp_reader *pfile; - const struct line_map *map; - unsigned int line; -{ - /* End the previous line of text. */ - if (pfile->print.printed) - { - putc ('\n', pfile->print.outf); - pfile->print.line++; - pfile->print.printed = 0; - } - - if (line >= pfile->print.line && line < pfile->print.line + 8) - { - while (line > pfile->print.line) - { - putc ('\n', pfile->print.outf); - pfile->print.line++; - } - } - else - print_line (pfile, map, line, ""); -} - -/* Output a line marker for logical line LINE. Special flags are "1" - or "2" indicating entering or leaving a file. */ -static void -print_line (pfile, map, line, special_flags) - cpp_reader *pfile; - const struct line_map *map; - unsigned int line; - const char *special_flags; -{ - /* End any previous line of text. */ - if (pfile->print.printed) - putc ('\n', pfile->print.outf); - pfile->print.printed = 0; - - pfile->print.line = line; - if (! CPP_OPTION (pfile, no_line_commands)) - { - size_t to_file_len = strlen (map->to_file); - unsigned char *to_file_quoted = alloca (to_file_len * 4 + 1); - unsigned char *p; - - /* cpp_quote_string does not nul-terminate, so we have to do it - ourselves. */ - p = cpp_quote_string (to_file_quoted, - (unsigned char *)map->to_file, to_file_len); - *p = '\0'; - fprintf (pfile->print.outf, "# %u \"%s\"%s", - SOURCE_LINE (map, pfile->print.line), - to_file_quoted, special_flags); - - if (map->sysp == 2) - fputs (" 3 4", pfile->print.outf); - else if (map->sysp == 1) - fputs (" 3", pfile->print.outf); - - putc ('\n', pfile->print.outf); - } -} - -/* Called when a line of output is started. TOKEN is the first token - of the line, and at end of file will be CPP_EOF. */ -static void -cb_line_change (pfile, token, parsing_args) - cpp_reader *pfile; - const cpp_token *token; - int parsing_args; -{ - if (token->type == CPP_EOF || parsing_args) - return; - - maybe_print_line (pfile, pfile->print.map, token->line); - pfile->print.prev = 0; - pfile->print.source = 0; - - /* Supply enough spaces to put this token in its original column, - one space per column greater than 2, since scan_translation_unit - will provide a space if PREV_WHITE. Don't bother trying to - reconstruct tabs; we can't get it right in general, and nothing - ought to care. Some things do care; the fault lies with them. */ - if (!CPP_OPTION (pfile, traditional)) - { - pfile->print.printed = 1; - if (token->col > 2) - { - unsigned int spaces = token->col - 2; - - while (spaces--) - putc (' ', pfile->print.outf); - } - } -} - -static void -cb_ident (pfile, line, str) - cpp_reader *pfile; - unsigned int line; - const cpp_string * str; -{ - maybe_print_line (pfile, pfile->print.map, line); - fprintf (pfile->print.outf, "#ident \"%s\"\n", str->text); - pfile->print.line++; -} - -static void -cb_define (pfile, line, node) - cpp_reader *pfile; - unsigned int line; - cpp_hashnode *node; -{ - maybe_print_line (pfile, pfile->print.map, line); - fputs ("#define ", pfile->print.outf); - - /* -dD command line option. */ - if (CPP_OPTION (pfile, dump_macros) == dump_definitions) - fputs ((const char *) cpp_macro_definition (pfile, node), - pfile->print.outf); - else - fputs ((const char *) NODE_NAME (node), pfile->print.outf); - - putc ('\n', pfile->print.outf); - pfile->print.line++; -} - -static void -cb_undef (pfile, line, node) - cpp_reader *pfile; - unsigned int line; - cpp_hashnode *node; -{ - maybe_print_line (pfile, pfile->print.map, line); - fprintf (pfile->print.outf, "#undef %s\n", NODE_NAME (node)); - pfile->print.line++; -} - -static void -cb_include (pfile, line, dir, header) - cpp_reader *pfile; - unsigned int line; - const unsigned char *dir; - const cpp_token *header; -{ - maybe_print_line (pfile, pfile->print.map, line); - fprintf (pfile->print.outf, "#%s %s\n", dir, - cpp_token_as_text (pfile, header)); - pfile->print.line++; -} - -/* The file name, line number or system header flags have changed, as - described in MAP. From this point on, the old pfile->print.map might be - pointing to freed memory, and so must not be dereferenced. */ - -static void -cb_file_change (pfile, map) - cpp_reader *pfile; - const struct line_map *map; -{ - const char *flags = ""; - - /* First time? */ - if (pfile->print.map == NULL) - { - /* Avoid printing foo.i when the main file is foo.c. */ - if (!CPP_OPTION (pfile, preprocessed)) - print_line (pfile, map, map->from_line, flags); - } - else - { - /* Bring current file to correct line when entering a new file. */ - if (map->reason == LC_ENTER) - maybe_print_line (pfile, map - 1, map->from_line - 1); - - if (map->reason == LC_ENTER) - flags = " 1"; - else if (map->reason == LC_LEAVE) - flags = " 2"; - print_line (pfile, map, map->from_line, flags); - } - - pfile->print.map = map; -} - -/* Copy a #pragma directive to the preprocessed output. */ -static void -cb_def_pragma (pfile, line) - cpp_reader *pfile; - unsigned int line; -{ - maybe_print_line (pfile, pfile->print.map, line); - fputs ("#pragma ", pfile->print.outf); - cpp_output_line (pfile, pfile->print.outf); - pfile->print.line++; -} - -/* Dump out the hash table. */ -static int -dump_macro (pfile, node, v) - cpp_reader *pfile; - cpp_hashnode *node; - void *v ATTRIBUTE_UNUSED; -{ - if (node->type == NT_MACRO && !(node->flags & NODE_BUILTIN)) - { - fputs ("#define ", pfile->print.outf); - fputs ((const char *) cpp_macro_definition (pfile, node), - pfile->print.outf); - putc ('\n', pfile->print.outf); - pfile->print.line++; - } - - return 1; -} diff --git a/contrib/gcc/dbxstclass.h b/contrib/gcc/dbxstclass.h deleted file mode 100644 index 2d003fe..0000000 --- a/contrib/gcc/dbxstclass.h +++ /dev/null @@ -1,17 +0,0 @@ -/* Storage classes in XCOFF object file format designed for DBX's use. - This info is from the `Files Reference' manual for IBM's AIX version 3 - for the RS6000. */ - -#define C_GSYM 0x80 -#define C_LSYM 0x81 -#define C_PSYM 0x82 -#define C_RSYM 0x83 -#define C_RPSYM 0x84 -#define C_STSYM 0x85 - -#define C_BCOMM 0x87 -#define C_ECOML 0x88 -#define C_ECOMM 0x89 -#define C_DECL 0x8c -#define C_ENTRY 0x8d -#define C_FUN 0x8e diff --git a/contrib/gcc/doc/install-old.texi b/contrib/gcc/doc/install-old.texi deleted file mode 100644 index 9ce9896..0000000 --- a/contrib/gcc/doc/install-old.texi +++ /dev/null @@ -1,725 +0,0 @@ -@c Copyright (C) 1988, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc. -@c This is part of the GCC manual. -@c For copying conditions, see the file install.texi. - -@ifnothtml -@comment node-name, next, previous, up -@node Old, GNU Free Documentation License, Specific, Top -@end ifnothtml -@html -<h1 align="center">Old installation documentation</h1> -@end html -@ifnothtml -@chapter Old installation documentation -@end ifnothtml - -Note most of this information is out of date and superseded by the -previous chapters of this manual. It is provided for historical -reference only, because of a lack of volunteers to merge it into the -main manual. - -@ifnothtml -@menu -* Configurations:: Configurations Supported by GNU CC. -* Cross-Compiler:: Building and installing a cross-compiler. -* VMS Install:: See below for installation on VMS. -@end menu -@end ifnothtml - -Here is the procedure for installing GNU CC on a GNU or Unix system. -See @ref{VMS Install}, for VMS systems. - -@enumerate -@item -If you have chosen a configuration for GNU CC which requires other GNU -tools (such as GAS or the GNU linker) instead of the standard system -tools, install the required tools in the build directory under the names -@file{as}, @file{ld} or whatever is appropriate. This will enable the -compiler to find the proper tools for compilation of the program -@file{enquire}. - -Alternatively, you can do subsequent compilation using a value of the -@code{PATH} environment variable such that the necessary GNU tools come -before the standard system tools. - -@item -Specify the host, build and target machine configurations. You do this -when you run the @file{configure} script. - -The @dfn{build} machine is the system which you are using, the -@dfn{host} machine is the system where you want to run the resulting -compiler (normally the build machine), and the @dfn{target} machine is -the system for which you want the compiler to generate code. - -If you are building a compiler to produce code for the machine it runs -on (a native compiler), you normally do not need to specify any operands -to @file{configure}; it will try to guess the type of machine you are on -and use that as the build, host and target machines. So you don't need -to specify a configuration when building a native compiler unless -@file{configure} cannot figure out what your configuration is or guesses -wrong. - -In those cases, specify the build machine's @dfn{configuration name} -with the @option{--host} option; the host and target will default to be -the same as the host machine. (If you are building a cross-compiler, -see @ref{Cross-Compiler}.) - -Here is an example: - -@smallexample -./configure --host=sparc-sun-sunos4.1 -@end smallexample - -A configuration name may be canonical or it may be more or less -abbreviated. - -A canonical configuration name has three parts, separated by dashes. -It looks like this: @samp{@var{cpu}-@var{company}-@var{system}}. -(The three parts may themselves contain dashes; @file{configure} -can figure out which dashes serve which purpose.) For example, -@samp{m68k-sun-sunos4.1} specifies a Sun 3. - -You can also replace parts of the configuration by nicknames or aliases. -For example, @samp{sun3} stands for @samp{m68k-sun}, so -@samp{sun3-sunos4.1} is another way to specify a Sun 3. - -You can specify a version number after any of the system types, and some -of the CPU types. In most cases, the version is irrelevant, and will be -ignored. So you might as well specify the version if you know it. - -See @ref{Configurations}, for a list of supported configuration names and -notes on many of the configurations. You should check the notes in that -section before proceeding any further with the installation of GNU CC@. - -@end enumerate - -@ifnothtml -@node Configurations, Cross-Compiler, , Old -@section Configurations Supported by GNU CC -@end ifnothtml -@html -<h2>@anchor{Configurations}Configurations Supported by GNU CC</h2> -@end html -@cindex configurations supported by GNU CC - -Here are the possible CPU types: - -@quotation -@c gmicro, fx80, spur and tahoe omitted since they don't work. -1750a, a29k, alpha, arm, avr, c@var{n}, clipper, dsp16xx, elxsi, fr30, h8300, -hppa1.0, hppa1.1, i370, i386, i486, i586, i686, i786, i860, i960, m32r, -m68000, m68k, m6811, m6812, m88k, mcore, mips, mipsel, mips64, mips64el, -mn10200, mn10300, ns32k, pdp11, powerpc, powerpcle, romp, rs6000, sh, sparc, -sparclite, sparc64, v850, vax, we32k. -@end quotation - -Here are the recognized company names. As you can see, customary -abbreviations are used rather than the longer official names. - -@c What should be done about merlin, tek*, dolphin? -@quotation -acorn, alliant, altos, apollo, apple, att, bull, -cbm, convergent, convex, crds, dec, dg, dolphin, -elxsi, encore, harris, hitachi, hp, ibm, intergraph, isi, -mips, motorola, ncr, next, ns, omron, plexus, -sequent, sgi, sony, sun, tti, unicom, wrs. -@end quotation - -The company name is meaningful only to disambiguate when the rest of -the information supplied is insufficient. You can omit it, writing -just @samp{@var{cpu}-@var{system}}, if it is not needed. For example, -@samp{vax-ultrix4.2} is equivalent to @samp{vax-dec-ultrix4.2}. - -Here is a list of system types: - -@quotation -386bsd, aix, acis, amigaos, aos, aout, aux, bosx, bsd, clix, coff, ctix, cxux, -dgux, dynix, ebmon, ecoff, elf, esix, freebsd, hms, genix, gnu, linux, -linux-gnu, hiux, hpux, iris, irix, isc, luna, lynxos, mach, minix, msdos, mvs, -netbsd, newsos, nindy, ns, osf, osfrose, ptx, riscix, riscos, rtu, sco, sim, -solaris, sunos, sym, sysv, udi, ultrix, unicos, uniplus, unos, vms, vsta, -vxworks, winnt, xenix. -@end quotation - -@noindent -You can omit the system type; then @file{configure} guesses the -operating system from the CPU and company. - -You can add a version number to the system type; this may or may not -make a difference. For example, you can write @samp{bsd4.3} or -@samp{bsd4.4} to distinguish versions of BSD@. In practice, the version -number is most needed for @samp{sysv3} and @samp{sysv4}, which are often -treated differently. - -@samp{linux-gnu} is the canonical name for the GNU/Linux target; however -GNU CC will also accept @samp{linux}. The version of the kernel in use is -not relevant on these systems. A suffix such as @samp{libc1} or @samp{aout} -distinguishes major versions of the C library; all of the suffixed versions -are obsolete. - -If you specify an impossible combination such as @samp{i860-dg-vms}, -then you may get an error message from @file{configure}, or it may -ignore part of the information and do the best it can with the rest. -@file{configure} always prints the canonical name for the alternative -that it used. GNU CC does not support all possible alternatives. - -Often a particular model of machine has a name. Many machine names are -recognized as aliases for CPU/company combinations. Thus, the machine -name @samp{sun3}, mentioned above, is an alias for @samp{m68k-sun}. -Sometimes we accept a company name as a machine name, when the name is -popularly used for a particular machine. Here is a table of the known -machine names: - -@quotation -3300, 3b1, 3b@var{n}, 7300, altos3068, altos, -apollo68, att-7300, balance, -convex-c@var{n}, crds, decstation-3100, -decstation, delta, encore, -fx2800, gmicro, hp7@var{nn}, hp8@var{nn}, -hp9k2@var{nn}, hp9k3@var{nn}, hp9k7@var{nn}, -hp9k8@var{nn}, iris4d, iris, isi68, -m3230, magnum, merlin, miniframe, -mmax, news-3600, news800, news, next, -pbd, pc532, pmax, powerpc, powerpcle, ps2, risc-news, -rtpc, sun2, sun386i, sun386, sun3, -sun4, symmetry, tower-32, tower. -@end quotation - -@noindent -Remember that a machine name specifies both the cpu type and the company -name. -If you want to install your own homemade configuration files, you can -use @samp{local} as the company name to access them. If you use -configuration @samp{@var{cpu}-local}, the configuration name -without the cpu prefix -is used to form the configuration file names. - -Thus, if you specify @samp{m68k-local}, configuration uses -files @file{m68k.md}, @file{local.h}, @file{m68k.c}, -@file{xm-local.h}, @file{t-local}, and @file{x-local}, all in the -directory @file{config/m68k}. - -Here is a list of configurations that have special treatment or special -things you must know: - -@table @samp -@item vax-dec-vms -See @ref{VMS Install}, for details on how to install GNU CC on VMS@. -@end table - -@ifnothtml -@node Cross-Compiler, VMS Install, Configurations, Old -@section Building and Installing a Cross-Compiler -@end ifnothtml -@html -<h2>@anchor{Cross-Compiler}Building and Installing a Cross-Compiler</h2> -@end html -@cindex cross-compiler, installation - -GNU CC can function as a cross-compiler for many machines, but not all. - -@itemize @bullet -@item -Cross-compilers for the Mips as target using the Mips assembler -currently do not work, because the auxiliary programs -@file{mips-tdump.c} and @file{mips-tfile.c} can't be compiled on -anything but a Mips. It does work to cross compile for a Mips -if you use the GNU assembler and linker. - -@item -Cross-compilers between machines with different floating point formats -have not all been made to work. GNU CC now has a floating point -emulator with which these can work, but each target machine description -needs to be updated to take advantage of it. - -@item -Cross-compilation between machines of different word sizes is -somewhat problematic and sometimes does not work. -@end itemize - -Since GNU CC generates assembler code, you probably need a -cross-assembler that GNU CC can run, in order to produce object files. -If you want to link on other than the target machine, you need a -cross-linker as well. You also need header files and libraries suitable -for the target machine that you can install on the host machine. - -@ifnothtml -@menu -* Steps of Cross:: Using a cross-compiler involves several steps - that may be carried out on different machines. -* Configure Cross:: Configuring a cross-compiler. -* Tools and Libraries:: Where to put the linker and assembler, and the C library. -* Cross Headers:: Finding and installing header files - for a cross-compiler. -* Build Cross:: Actually compiling the cross-compiler. -@end menu -@end ifnothtml - -@ifnothtml -@node Steps of Cross, Configure Cross, , Cross-Compiler -@subsection Steps of Cross-Compilation -@end ifnothtml -@html -<h2>Steps of Cross-Compilation</h2> -@end html - -To compile and run a program using a cross-compiler involves several -steps: - -@itemize @bullet -@item -Run the cross-compiler on the host machine to produce assembler files -for the target machine. This requires header files for the target -machine. - -@item -Assemble the files produced by the cross-compiler. You can do this -either with an assembler on the target machine, or with a -cross-assembler on the host machine. - -@item -Link those files to make an executable. You can do this either with a -linker on the target machine, or with a cross-linker on the host -machine. Whichever machine you use, you need libraries and certain -startup files (typically @file{crt@dots{}.o}) for the target machine. -@end itemize - -It is most convenient to do all of these steps on the same host machine, -since then you can do it all with a single invocation of GNU CC@. This -requires a suitable cross-assembler and cross-linker. For some targets, -the GNU assembler and linker are available. - -@ifnothtml -@node Configure Cross, Tools and Libraries, Steps of Cross, Cross-Compiler -@subsection Configuring a Cross-Compiler -@end ifnothtml -@html -<h2>Configuring a Cross-Compiler</h2> -@end html - -To build GNU CC as a cross-compiler, you start out by running -@file{configure}. Use the @option{--target=@var{target}} to specify the -target type. If @file{configure} was unable to correctly identify the -system you are running on, also specify the @option{--build=@var{build}} -option. For example, here is how to configure for a cross-compiler that -produces code for an HP 68030 system running BSD on a system that -@file{configure} can correctly identify: - -@smallexample -./configure --target=m68k-hp-bsd4.3 -@end smallexample - -@ifnothtml -@node Tools and Libraries, Cross Headers, Configure Cross, Cross-Compiler -@subsection Tools and Libraries for a Cross-Compiler -@end ifnothtml -@html -<h2>Tools and Libraries for a Cross-Compiler</h2> -@end html - -If you have a cross-assembler and cross-linker available, you should -install them now. Put them in the directory -@file{/usr/local/@var{target}/bin}. Here is a table of the tools -you should put in this directory: - -@table @file -@item as -This should be the cross-assembler. - -@item ld -This should be the cross-linker. - -@item ar -This should be the cross-archiver: a program which can manipulate -archive files (linker libraries) in the target machine's format. - -@item ranlib -This should be a program to construct a symbol table in an archive file. -@end table - -The installation of GNU CC will find these programs in that directory, -and copy or link them to the proper place to for the cross-compiler to -find them when run later. - -The easiest way to provide these files is to build the Binutils package -and GAS@. Configure them with the same @option{--host} and @option{--target} -options that you use for configuring GNU CC, then build and install -them. They install their executables automatically into the proper -directory. Alas, they do not support all the targets that GNU CC -supports. - -If you want to install libraries to use with the cross-compiler, such as -a standard C library, put them in the directory -@file{/usr/local/@var{target}/lib}; installation of GNU CC copies -all the files in that subdirectory into the proper place for GNU CC to -find them and link with them. Here's an example of copying some -libraries from a target machine: - -@example -ftp @var{target-machine} -lcd /usr/local/@var{target}/lib -cd /lib -get libc.a -cd /usr/lib -get libg.a -get libm.a -quit -@end example - -@noindent -The precise set of libraries you'll need, and their locations on -the target machine, vary depending on its operating system. - -@cindex start files -Many targets require ``start files'' such as @file{crt0.o} and -@file{crtn.o} which are linked into each executable; these too should be -placed in @file{/usr/local/@var{target}/lib}. There may be several -alternatives for @file{crt0.o}, for use with profiling or other -compilation options. Check your target's definition of -@code{STARTFILE_SPEC} to find out what start files it uses. -Here's an example of copying these files from a target machine: - -@example -ftp @var{target-machine} -lcd /usr/local/@var{target}/lib -prompt -cd /lib -mget *crt*.o -cd /usr/lib -mget *crt*.o -quit -@end example - -@ifnothtml -@node Cross Headers, Build Cross, Tools and Libraries, Cross-Compiler -@subsection Cross-Compilers and Header Files -@end ifnothtml -@html -<h2>Cross-Compilers and Header Files</h2> -@end html - -If you are cross-compiling a standalone program or a program for an -embedded system, then you may not need any header files except the few -that are part of GNU CC (and those of your program). However, if you -intend to link your program with a standard C library such as -@file{libc.a}, then you probably need to compile with the header files -that go with the library you use. - -The GNU C compiler does not come with these files, because (1) they are -system-specific, and (2) they belong in a C library, not in a compiler. - -If the GNU C library supports your target machine, then you can get the -header files from there (assuming you actually use the GNU library when -you link your program). - -If your target machine comes with a C compiler, it probably comes with -suitable header files also. If you make these files accessible from the host -machine, the cross-compiler can use them also. - -Otherwise, you're on your own in finding header files to use when -cross-compiling. - -When you have found suitable header files, you should put them in the -directory @file{/usr/local/@var{target}/include}, before building the -cross compiler. Then installation will run fixincludes properly and -install the corrected versions of the header files where the compiler -will use them. - -Provide the header files before you build the cross-compiler, because -the build stage actually runs the cross-compiler to produce parts of -@file{libgcc.a}. (These are the parts that @emph{can} be compiled with -GNU CC@.) Some of them need suitable header files. - -Here's an example showing how to copy the header files from a target -machine. On the target machine, do this: - -@example -(cd /usr/include; tar cf - .) > tarfile -@end example - -Then, on the host machine, do this: - -@example -ftp @var{target-machine} -lcd /usr/local/@var{target}/include -get tarfile -quit -tar xf tarfile -@end example - -@ifnothtml -@node Build Cross, , Cross Headers, Cross-Compiler -@subsection Actually Building the Cross-Compiler -@end ifnothtml -@html -<h2>Actually Building the Cross-Compiler</h2> -@end html - -Now you can proceed just as for compiling a single-machine compiler -through the step of building stage 1. - -If your target is exotic, you may need to provide the header file -@file{float.h}.One way to do this is to compile @file{enquire} and run -it on your target machine. The job of @file{enquire} is to run on the -target machine and figure out by experiment the nature of its floating -point representation. @file{enquire} records its findings in the header -file @file{float.h}. If you can't produce this file by running -@file{enquire} on the target machine, then you will need to come up with -a suitable @file{float.h} in some other way (or else, avoid using it in -your programs). - -Do not try to build stage 2 for a cross-compiler. It doesn't work to -rebuild GNU CC as a cross-compiler using the cross-compiler, because -that would produce a program that runs on the target machine, not on the -host. For example, if you compile a 386-to-68030 cross-compiler with -itself, the result will not be right either for the 386 (because it was -compiled into 68030 code) or for the 68030 (because it was configured -for a 386 as the host). If you want to compile GNU CC into 68030 code, -whether you compile it on a 68030 or with a cross-compiler on a 386, you -must specify a 68030 as the host when you configure it. - -To install the cross-compiler, use @samp{make install}, as usual. - -@ifnothtml -@node VMS Install, , Cross-Compiler, Old -@section Installing GNU CC on VMS -@end ifnothtml -@html -<h2>@anchor{VMS Install}Installing GNU CC on VMS</h2> -@end html -@cindex VMS installation -@cindex installing GNU CC on VMS - -The VMS version of GNU CC is distributed in a backup saveset containing -both source code and precompiled binaries. - -To install the @file{gcc} command so you can use the compiler easily, in -the same manner as you use the VMS C compiler, you must install the VMS CLD -file for GNU CC as follows: - -@enumerate -@item -Define the VMS logical names @samp{GNU_CC} and @samp{GNU_CC_INCLUDE} -to point to the directories where the GNU CC executables -(@file{gcc-cpp.exe}, @file{gcc-cc1.exe}, etc.) and the C include files are -kept respectively. This should be done with the commands: - -@smallexample -$ assign /system /translation=concealed - - disk:[gcc.] gnu_cc -$ assign /system /translation=concealed - - disk:[gcc.include.] gnu_cc_include -@end smallexample - -@noindent -with the appropriate disk and directory names. These commands can be -placed in your system startup file so they will be executed whenever -the machine is rebooted. You may, if you choose, do this via the -@file{GCC_INSTALL.COM} script in the @file{[GCC]} directory. - -@item -Install the @file{GCC} command with the command line: - -@smallexample -$ set command /table=sys$common:[syslib]dcltables - - /output=sys$common:[syslib]dcltables gnu_cc:[000000]gcc -$ install replace sys$common:[syslib]dcltables -@end smallexample - -@item -To install the help file, do the following: - -@smallexample -$ library/help sys$library:helplib.hlb gcc.hlp -@end smallexample - -@noindent -Now you can invoke the compiler with a command like @samp{gcc /verbose -file.c}, which is equivalent to the command @samp{gcc -v -c file.c} in -Unix. -@end enumerate - -If you wish to use GNU C++ you must first install GNU CC, and then -perform the following steps: - -@enumerate -@item -Define the VMS logical name @samp{GNU_GXX_INCLUDE} to point to the -directory where the preprocessor will search for the C++ header files. -This can be done with the command: - -@smallexample -$ assign /system /translation=concealed - - disk:[gcc.gxx_include.] gnu_gxx_include -@end smallexample - -@noindent -with the appropriate disk and directory name. If you are going to be -using a C++ runtime library, this is where its install procedure will install -its header files. - -@item -Obtain the file @file{gcc-cc1plus.exe}, and place this in the same -directory that @file{gcc-cc1.exe} is kept. - -The GNU C++ compiler can be invoked with a command like @samp{gcc /plus -/verbose file.cc}, which is equivalent to the command @samp{g++ -v -c -file.cc} in Unix. -@end enumerate - -We try to put corresponding binaries and sources on the VMS distribution -tape. But sometimes the binaries will be from an older version than the -sources, because we don't always have time to update them. (Use the -@samp{/version} option to determine the version number of the binaries and -compare it with the source file @file{version.c} to tell whether this is -so.) In this case, you should use the binaries you get to recompile the -sources. If you must recompile, here is how: - -@enumerate -@item -Execute the command procedure @file{vmsconfig.com} to set up the files -@file{tm.h}, @file{config.h}, @file{aux-output.c}, and @file{md.}, and -to create files @file{tconfig.h} and @file{hconfig.h}. This procedure -also creates several linker option files used by @file{make-cc1.com} and -a data file used by @file{make-l2.com}. - -@smallexample -$ @@vmsconfig.com -@end smallexample - -@item -Setup the logical names and command tables as defined above. In -addition, define the VMS logical name @samp{GNU_BISON} to point at the -to the directories where the Bison executable is kept. This should be -done with the command: - -@smallexample -$ assign /system /translation=concealed - - disk:[bison.] gnu_bison -@end smallexample - -You may, if you choose, use the @file{INSTALL_BISON.COM} script in the -@file{[BISON]} directory. - -@item -Install the @samp{BISON} command with the command line: - -@smallexample -$ set command /table=sys$common:[syslib]dcltables - - /output=sys$common:[syslib]dcltables - - gnu_bison:[000000]bison -$ install replace sys$common:[syslib]dcltables -@end smallexample - -@item -Type @samp{@@make-gcc} to recompile everything, or submit the file -@file{make-gcc.com} to a batch queue. If you wish to build the GNU C++ -compiler as well as the GNU CC compiler, you must first edit -@file{make-gcc.com} and follow the instructions that appear in the -comments. - -@item -In order to use GCC, you need a library of functions which GCC compiled code -will call to perform certain tasks, and these functions are defined in the -file @file{libgcc2.c}. To compile this you should use the command procedure -@file{make-l2.com}, which will generate the library @file{libgcc2.olb}. -@file{libgcc2.olb} should be built using the compiler built from -the same distribution that @file{libgcc2.c} came from, and -@file{make-gcc.com} will automatically do all of this for you. - -To install the library, use the following commands: - -@smallexample -$ library gnu_cc:[000000]gcclib/delete=(new,eprintf) -$ library gnu_cc:[000000]gcclib/delete=L_* -$ library libgcc2/extract=*/output=libgcc2.obj -$ library gnu_cc:[000000]gcclib libgcc2.obj -@end smallexample - -The first command simply removes old modules that will be replaced with -modules from @file{libgcc2} under different module names. The modules -@code{new} and @code{eprintf} may not actually be present in your -@file{gcclib.olb}---if the VMS librarian complains about those modules -not being present, simply ignore the message and continue on with the -next command. The second command removes the modules that came from the -previous version of the library @file{libgcc2.c}. - -Whenever you update the compiler on your system, you should also update the -library with the above procedure. - -@item -You may wish to build GCC in such a way that no files are written to the -directory where the source files reside. An example would be the when -the source files are on a read-only disk. In these cases, execute the -following DCL commands (substituting your actual path names): - -@smallexample -$ assign dua0:[gcc.build_dir.]/translation=concealed, - - dua1:[gcc.source_dir.]/translation=concealed gcc_build -$ set default gcc_build:[000000] -@end smallexample - -@noindent -where the directory @file{dua1:[gcc.source_dir]} contains the source -code, and the directory @file{dua0:[gcc.build_dir]} is meant to contain -all of the generated object files and executables. Once you have done -this, you can proceed building GCC as described above. (Keep in mind -that @file{gcc_build} is a rooted logical name, and thus the device -names in each element of the search list must be an actual physical -device name rather than another rooted logical name). - -@item -@strong{If you are building GNU CC with a previous version of GNU CC, -you also should check to see that you have the newest version of the -assembler}. In particular, GNU CC version 2 treats global constant -variables slightly differently from GNU CC version 1, and GAS version -1.38.1 does not have the patches required to work with GCC version 2. -If you use GAS 1.38.1, then @code{extern const} variables will not have -the read-only bit set, and the linker will generate warning messages -about mismatched psect attributes for these variables. These warning -messages are merely a nuisance, and can safely be ignored. - -@item -If you want to build GNU CC with the VAX C compiler, you will need to -make minor changes in @file{make-cccp.com} and @file{make-cc1.com} -to choose alternate definitions of @code{CC}, @code{CFLAGS}, and -@code{LIBS}. See comments in those files. However, you must -also have a working version of the GNU assembler (GNU as, aka GAS) as -it is used as the back end for GNU CC to produce binary object modules -and is not included in the GNU CC sources. GAS is also needed to -compile @file{libgcc2} in order to build @file{gcclib} (see above); -@file{make-l2.com} expects to be able to find it operational in -@file{gnu_cc:[000000]gnu-as.exe}. - -To use GNU CC on VMS, you need the VMS driver programs -@file{gcc.exe}, @file{gcc.com}, and @file{gcc.cld}. They are -distributed with the VMS binaries (@file{gcc-vms}) rather than the -GNU CC sources. GAS is also included in @file{gcc-vms}, as is Bison. - -Once you have successfully built GNU CC with VAX C, you should use the -resulting compiler to rebuild itself. Before doing this, be sure to -restore the @code{CC}, @code{CFLAGS}, and @code{LIBS} definitions in -@file{make-cccp.com} and @file{make-cc1.com}. The second generation -compiler will be able to take advantage of many optimizations that must -be suppressed when building with other compilers. -@end enumerate - -Under previous versions of GNU CC, the generated code would occasionally -give strange results when linked with the sharable @file{VAXCRTL} library. -Now this should work. - -Even with this version, however, GNU CC itself should not be linked with -the sharable @file{VAXCRTL}. The version of @code{qsort} in -@file{VAXCRTL} has a bug (known to be present in VMS versions V4.6 -through V5.5) which causes the compiler to fail. - -The executables are generated by @file{make-cc1.com} and -@file{make-cccp.com} use the object library version of @file{VAXCRTL} in -order to make use of the @code{qsort} routine in @file{gcclib.olb}. If -you wish to link the compiler executables with the shareable image -version of @file{VAXCRTL}, you should edit the file @file{tm.h} (created -by @file{vmsconfig.com}) to define the macro @code{QSORT_WORKAROUND}. - -@code{QSORT_WORKAROUND} is always defined when GNU CC is compiled with -VAX C, to avoid a problem in case @file{gcclib.olb} is not yet -available. diff --git a/contrib/gcc/doc/install.texi b/contrib/gcc/doc/install.texi deleted file mode 100644 index 350d365..0000000 --- a/contrib/gcc/doc/install.texi +++ /dev/null @@ -1,3928 +0,0 @@ -\input texinfo.tex @c -*-texinfo-*- -@c @ifnothtml -@c %**start of header -@setfilename install.info -@settitle Installing GCC -@setchapternewpage odd -@c %**end of header -@c @end ifnothtml - -@c Specify title for specific html page -@ifset indexhtml -@settitle Installing GCC -@end ifset -@ifset specifichtml -@settitle Host/Target specific installation notes for GCC -@end ifset -@ifset downloadhtml -@settitle Downloading GCC -@end ifset -@ifset configurehtml -@settitle Installing GCC: Configuration -@end ifset -@ifset buildhtml -@settitle Installing GCC: Building -@end ifset -@ifset testhtml -@settitle Installing GCC: Testing -@end ifset -@ifset finalinstallhtml -@settitle Installing GCC: Final installation -@end ifset -@ifset binarieshtml -@settitle Installing GCC: Binaries -@end ifset -@ifset oldhtml -@settitle Installing GCC: Old documentation -@end ifset -@ifset gfdlhtml -@settitle Installing GCC: GNU Free Documentation License -@end ifset - -@c Copyright (C) 1988, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998, -@c 1999, 2000, 2001, 2002 Free Software Foundation, Inc. -@c *** Converted to texinfo by Dean Wakerley, dean@wakerley.com - -@c Include everything if we're not making html -@ifnothtml -@set indexhtml -@set specifichtml -@set downloadhtml -@set configurehtml -@set buildhtml -@set testhtml -@set finalinstallhtml -@set binarieshtml -@set oldhtml -@set gfdlhtml -@end ifnothtml - -@c Part 2 Summary Description and Copyright -@macro copyrightnotice -Copyright @copyright{} 1988, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998, -1999, 2000, 2001, 2002 Free Software Foundation, Inc. -@sp 1 -Permission is granted to copy, distribute and/or modify this document -under the terms of the GNU Free Documentation License, Version 1.1 or -any later version published by the Free Software Foundation; with no -Invariant Sections, the Front-Cover texts being (a) (see below), and -with the Back-Cover Texts being (b) (see below). A copy of the -license is included in the section entitled ``@uref{./gfdl.html,,GNU -Free Documentation License}''. - -(a) The FSF's Front-Cover Text is: - - A GNU Manual - -(b) The FSF's Back-Cover Text is: - - You have freedom to copy and modify this GNU Manual, like GNU - software. Copies published by the Free Software Foundation raise - funds for GNU development. -@end macro -@ifinfo -@copyrightnotice{} -@end ifinfo - -@c Part 3 Titlepage and Copyright -@titlepage -@sp 10 -@comment The title is printed in a large font. -@center @titlefont{Installing GCC} - -@c The following two commands start the copyright page. -@page -@vskip 0pt plus 1filll -@copyrightnotice{} -@end titlepage - -@c Part 4 Top node and Master Menu -@ifinfo -@node Top, , , (dir) -@comment node-name, next, Previous, up - -@menu -* Installing GCC:: This document describes the generic installation - procedure for GCC as well as detailing some target - specific installation instructions. - -* Specific:: Host/target specific installation notes for GCC. -* Binaries:: Where to get pre-compiled binaries. - -* Old:: Old installation documentation. - -* GNU Free Documentation License:: How you can copy and share this manual. -* Concept Index:: This index has two entries. -@end menu -@end ifinfo - -@c Part 5 The Body of the Document -@c ***Installing GCC********************************************************** -@ifnothtml -@comment node-name, next, previous, up -@node Installing GCC, Binaries, , Top -@end ifnothtml -@ifset indexhtml -@ifnothtml -@chapter Installing GCC -@end ifnothtml - -The latest version of this document is always available at -@uref{http://gcc.gnu.org/install/,,http://gcc.gnu.org/install/}. - -This document describes the generic installation procedure for GCC as well -as detailing some target specific installation instructions. - -GCC includes several components that previously were separate distributions -with their own installation instructions. This document supersedes all -package specific installation instructions. - -@emph{Before} starting the build/install procedure please check the -@ifnothtml -@ref{Specific, host/target specific installation notes}. -@end ifnothtml -@ifhtml -@uref{specific.html,,host/target specific installation notes}. -@end ifhtml -We recommend you browse the entire generic installation instructions before -you proceed. - -Lists of successful builds for released versions of GCC are -available at @uref{http://gcc.gnu.org/buildstat.html}. -These lists are updated as new information becomes available. - -The installation procedure itself is broken into five steps. - -@ifinfo -@menu -* Downloading the source:: -* Configuration:: -* Building:: -* Testing:: (optional) -* Final install:: -@end menu -@end ifinfo -@ifhtml -@enumerate -@item -@uref{download.html,,Downloading the source} -@item -@uref{configure.html,,Configuration} -@item -@uref{build.html,,Building} -@item -@uref{test.html,,Testing} (optional) -@item -@uref{finalinstall.html,,Final install} -@end enumerate -@end ifhtml - -Please note that GCC does not support @samp{make uninstall} and probably -won't do so in the near future as this would open a can of worms. Instead, -we suggest that you install GCC into a directory of its own and simply -remove that directory when you do not need that specific version of GCC -any longer, and, if shared libraries are installed there as well, no -more binaries exist that use them. - -@ifhtml -There are also some @uref{old.html,,old installation instructions}, -which are mostly obsolete but still contain some information which has -not yet been merged into the main part of this manual. -@end ifhtml - -@html -<hr /> -<p> -@end html -@ifhtml -@uref{./index.html,,Return to the GCC Installation page} - -@copyrightnotice{} -@end ifhtml -@end ifset - -@c ***Downloading the source************************************************** -@ifnothtml -@comment node-name, next, previous, up -@node Downloading the source, Configuration, , Installing GCC -@end ifnothtml -@ifset downloadhtml -@ifnothtml -@chapter Downloading GCC -@end ifnothtml -@cindex Downloading GCC -@cindex Downloading the Source - -GCC is distributed via @uref{http://gcc.gnu.org/cvs.html,,CVS} and FTP -tarballs compressed with @command{gzip} or -@command{bzip2}. It is possible to download a full distribution or specific -components. - -Please refer to our @uref{http://gcc.gnu.org/releases.html,,releases web page} -for information on how to obtain GCC@. - -The full distribution includes the C, C++, Objective-C, Fortran, Java, -and Ada (in case of GCC 3.1 and later) compilers. The full distribution -also includes runtime libraries for C++, Objective-C, Fortran, and Java. -In GCC 3.0 and later versions, GNU compiler testsuites are also included -in the full distribution. - -If you choose to download specific components, you must download the core -GCC distribution plus any language specific distributions you wish to -use. The core distribution includes the C language front end as well as the -shared components. Each language has a tarball which includes the language -front end as well as the language runtime (when appropriate). - -Unpack the core distribution as well as any language specific -distributions in the same directory. - -If you also intend to build binutils (either to upgrade an existing -installation or for use in place of the corresponding tools of your -OS), unpack the binutils distribution either in the same directory or -a separate one. In the latter case, add symbolic links to any -components of the binutils you intend to build alongside the compiler -(@file{bfd}, @file{binutils}, @file{gas}, @file{gprof}, @file{ld}, -@file{opcodes}, @dots{}) to the directory containing the GCC sources. - -@html -<hr /> -<p> -@end html -@ifhtml -@uref{./index.html,,Return to the GCC Installation page} -@end ifhtml -@end ifset - -@c ***Configuration*********************************************************** -@ifnothtml -@comment node-name, next, previous, up -@node Configuration, Building, Downloading the source, Installing GCC -@end ifnothtml -@ifset configurehtml -@ifnothtml -@chapter Installing GCC: Configuration -@end ifnothtml -@cindex Configuration -@cindex Installing GCC: Configuration - -Like most GNU software, GCC must be configured before it can be built. -This document describes the recommended configuration procedure -for both native and cross targets. - -We use @var{srcdir} to refer to the toplevel source directory for -GCC; we use @var{objdir} to refer to the toplevel build/object directory. - -If you obtained the sources via CVS, @var{srcdir} must refer to the top -@file{gcc} directory, the one where the @file{MAINTAINERS} can be found, -and not its @file{gcc} subdirectory, otherwise the build will fail. - -First, we @strong{highly} recommend that GCC be built into a -separate directory than the sources which does @strong{not} reside -within the source tree. This is how we generally build GCC; building -where @var{srcdir} == @var{objdir} should still work, but doesn't -get extensive testing; building where @var{objdir} is a subdirectory -of @var{srcdir} is unsupported. - -If you have previously built GCC in the same directory for a -different target machine, do @samp{make distclean} to delete all files -that might be invalid. One of the files this deletes is -@file{Makefile}; if @samp{make distclean} complains that @file{Makefile} -does not exist, it probably means that the directory is already suitably -clean. However, with the recommended method of building in a separate -@var{objdir}, you should simply use a different @var{objdir} for each -target. - -Second, when configuring a native system, either @command{cc} or -@command{gcc} must be in your path or you must set @env{CC} in -your environment before running configure. Otherwise the configuration -scripts may fail. - -Note that the bootstrap compiler and the resulting GCC must be link -compatible, else the bootstrap will fail with linker errors about -incompatible object file formats. Several multilibed targets are -affected by this requirement, see -@ifnothtml -@ref{Specific, host/target specific installation notes}. -@end ifnothtml -@ifhtml -@uref{specific.html,,host/target specific installation notes}. -@end ifhtml - -To configure GCC: - -@example - % mkdir @var{objdir} - % cd @var{objdir} - % @var{srcdir}/configure [@var{options}] [@var{target}] -@end example - - -@heading Target specification -@itemize @bullet -@item -GCC has code to correctly determine the correct value for @var{target} -for nearly all native systems. Therefore, we highly recommend you not -provide a configure target when configuring a native compiler. - -@item -@var{target} must be specified as @option{--target=@var{target}} -when configuring a cross compiler; examples of valid targets would be -i960-rtems, m68k-coff, sh-elf, etc. - -@item -Specifying just @var{target} instead of @option{--target=@var{target}} -implies that the host defaults to @var{target}. -@end itemize - - -@heading Options specification - -Use @var{options} to override several configure time options for -GCC@. A list of supported @var{options} follows; @command{configure ---help} may list other options, but those not listed below may not -work and should not normally be used. - -@table @code -@item --prefix=@var{dirname} -Specify the toplevel installation -directory. This is the recommended way to install the tools into a directory -other than the default. The toplevel installation directory defaults to -@file{/usr/local}. - -We @strong{highly} recommend against @var{dirname} being the same or a -subdirectory of @var{objdir} or vice versa. - -These additional options control where certain parts of the distribution -are installed. Normally you should not need to use these options. -@table @code -@item --exec-prefix=@var{dirname} -Specify the toplevel installation directory for architecture-dependent -files. The default is @file{@var{prefix}}. - -@item --bindir=@var{dirname} -Specify the installation directory for the executables called by users -(such as @command{gcc} and @command{g++}). The default is -@file{@var{exec-prefix}/bin}. - -@item --libdir=@var{dirname} -Specify the installation directory for object code libraries and -internal parts of GCC@. The default is @file{@var{exec-prefix}/lib}. - -@item --with-slibdir=@var{dirname} -Specify the installation directory for the shared libgcc library. The -default is @file{@var{libdir}}. - -@item --infodir=@var{dirname} -Specify the installation directory for documentation in info format. -The default is @file{@var{prefix}/info}. - -@item --mandir=@var{dirname} -Specify the installation directory for manual pages. The default is -@file{@var{prefix}/man}. (Note that the manual pages are only extracts from -the full GCC manuals, which are provided in Texinfo format. The -@command{g77} manpage is unmaintained and may be out of date; the others -are derived by an automatic conversion process from parts of the full -manual.) - -@item --with-gxx-include-dir=@var{dirname} -Specify -the installation directory for G++ header files. The default is -@file{@var{prefix}/include/g++-v3}. - -@end table - -@item --program-prefix=@var{prefix} -GCC supports some transformations of the names of its programs when -installing them. This option prepends @var{prefix} to the names of -programs to install in @var{bindir} (see above). For example, specifying -@option{--program-prefix=foo-} would result in @samp{gcc} -being installed as @file{/usr/local/bin/foo-gcc}. - -@item --program-suffix=@var{suffix} -Appends @var{suffix} to the names of programs to install in @var{bindir} -(see above). For example, specifying @option{--program-suffix=-3.1} -would result in @samp{gcc} being installed as -@file{/usr/local/bin/gcc-3.1}. - -@item --program-transform-name=@var{pattern} -Applies the @samp{sed} script @var{pattern} to be applied to the names -of programs to install in @var{bindir} (see above). @var{pattern} has to -consist of one or more basic @samp{sed} editing commands, separated by -semicolons. For example, if you want the @samp{gcc} program name to be -transformed to the installed program @file{/usr/local/bin/myowngcc} and -the @samp{g++} program name to be transformed to -@file{/usr/local/bin/gspecial++} without changing other program names, -you could use the pattern -@option{--program-transform-name='s/^gcc$/myowngcc/; s/^g++$/gspecial++/'} -to achieve this effect. - -All three options can be combined and used together, resulting in more -complex conversion patterns. As a basic rule, @var{prefix} (and -@var{suffix}) are prepended (appended) before further transformations -can happen with a special transformation script @var{pattern}. - -As currently implemented, these options only take effect for native -builds; cross compiler binaries' names are not transformed even when a -transformation is explicitly asked for by one of these options. - -For native builds, some of the installed programs are also installed -with the target alias in front of their name, as in -@samp{i686-pc-linux-gnu-gcc}. All of the above transformations happen -before the target alias is prepended to the name - so, specifying -@option{--program-prefix=foo-} and @option{program-suffix=-3.1}, the -resulting binary would be installed as -@file{/usr/local/bin/i686-pc-linux-gnu-foo-gcc-3.1}. - -As a last shortcoming, none of the installed Ada programs are -transformed yet, which will be fixed in some time. - -@item --with-local-prefix=@var{dirname} -Specify the -installation directory for local include files. The default is -@file{/usr/local}. Specify this option if you want the compiler to -search directory @file{@var{dirname}/include} for locally installed -header files @emph{instead} of @file{/usr/local/include}. - -You should specify @option{--with-local-prefix} @strong{only} if your -site has a different convention (not @file{/usr/local}) for where to put -site-specific files. - -The default value for @option{--with-local-prefix} is @file{/usr/local} -regardless of the value of @option{--prefix}. Specifying -@option{--prefix} has no effect on which directory GCC searches for -local header files. This may seem counterintuitive, but actually it is -logical. - -The purpose of @option{--prefix} is to specify where to @emph{install -GCC}. The local header files in @file{/usr/local/include}---if you put -any in that directory---are not part of GCC@. They are part of other -programs---perhaps many others. (GCC installs its own header files in -another directory which is based on the @option{--prefix} value.) - -Both the local-prefix include directory and the GCC-prefix include -directory are part of GCC's "system include" directories. Although these -two directories are not fixed, they need to be searched in the proper -order for the correct processing of the include_next directive. The -local-prefix include directory is searched before the GCC-prefix -include directory. Another characteristic of system include directories -is that pedantic warnings are turned off for headers in these directories. - -Some autoconf macros add @option{-I @var{directory}} options to the -compiler command line, to ensure that directories containing installed -packages' headers are searched. When @var{directory} is one of GCC's -system include directories, GCC will ignore the option so that system -directories continue to be processed in the correct order. This -may result in a search order different from what was specified but the -directory will still be searched. - -GCC automatically searches for ordinary libraries using -@env{GCC_EXEC_PREFIX}. Thus, when the same installation prefix is -used for both GCC and packages, GCC will automatically search for -both headers and libraries. This provides a configuration that is -easy to use. GCC behaves in a manner similar to that when it is -installed as a system compiler in @file{/usr}. - -Sites that need to install multiple versions of GCC may not want to -use the above simple configuration. It is possible to use the -@option{--program-prefix}, @option{--program-suffix} and -@option{--program-transform-name} options to install multiple versions -into a single directory, but it may be simpler to use different prefixes -and the @option{--with-local-prefix} option to specify the location of the -site-specific files for each version. It will then be necessary for -users to specify explicitly the location of local site libraries -(e.g., with @env{LIBRARY_PATH}). - -The same value can be used for both @option{--with-local-prefix} and -@option{--prefix} provided it is not @file{/usr}. This can be used -to avoid the default search of @file{/usr/local/include}. - -@strong{Do not} specify @file{/usr} as the @option{--with-local-prefix}! -The directory you use for @option{--with-local-prefix} @strong{must not} -contain any of the system's standard header files. If it did contain -them, certain programs would be miscompiled (including GNU Emacs, on -certain targets), because this would override and nullify the header -file corrections made by the @command{fixincludes} script. - -Indications are that people who use this option use it based on mistaken -ideas of what it is for. People use it as if it specified where to -install part of GCC@. Perhaps they make this assumption because -installing GCC creates the directory. - -@item --enable-shared[=@var{package}[,@dots{}]] -Build shared versions of libraries, if shared libraries are supported on -the target platform. Unlike GCC 2.95.x and earlier, shared libraries -are enabled by default on all platforms that support shared libraries, -except for @samp{libobjc} which is built as a static library only by -default. - -If a list of packages is given as an argument, build shared libraries -only for the listed packages. For other packages, only static libraries -will be built. Package names currently recognized in the GCC tree are -@samp{libgcc} (also known as @samp{gcc}), @samp{libstdc++} (not -@samp{libstdc++-v3}), @samp{libffi}, @samp{zlib}, @samp{boehm-gc} and -@samp{libjava}. Note that @samp{libobjc} does not recognize itself by -any name, so, if you list package names in @option{--enable-shared}, -you will only get static Objective-C libraries. @samp{libf2c} and -@samp{libiberty} do not support shared libraries at all. - -Use @option{--disable-shared} to build only static libraries. Note that -@option{--disable-shared} does not accept a list of package names as -argument, only @option{--enable-shared} does. - -@item @anchor{with-gnu-as}--with-gnu-as -Specify that the compiler should assume that the -assembler it finds is the GNU assembler. However, this does not modify -the rules to find an assembler and will result in confusion if found -assembler is not actually the GNU assembler. (Confusion will also -result if the compiler finds the GNU assembler but has not been -configured with @option{--with-gnu-as}.) If you have more than one -assembler installed on your system, you may want to use this option in -connection with @option{--with-as=@var{pathname}}. - -The following systems are the only ones where it makes a difference -whether you use the GNU assembler. On any other system, -@option{--with-gnu-as} has no effect. - -@itemize bullet -@item @samp{hppa1.0-@var{any}-@var{any}} -@item @samp{hppa1.1-@var{any}-@var{any}} -@item @samp{i386-@var{any}-sysv} -@item @samp{i386-@var{any}-isc} -@item @samp{i860-@var{any}-bsd} -@item @samp{m68k-bull-sysv} -@item @samp{m68k-hp-hpux} -@item @samp{m68k-sony-bsd} -@item @samp{m68k-altos-sysv} -@item @samp{m68000-hp-hpux} -@item @samp{m68000-att-sysv} -@item @samp{@var{any}-lynx-lynxos} -@item @samp{mips-@var{any}} -@end itemize - -On the systems listed above (except for the HP-PA, for ISC on the -386, and for @samp{mips-sgi-irix5.*}), if you use the GNU assembler, -you should also use the GNU linker (and specify @option{--with-gnu-ld}). - -@item --with-as=@var{pathname} -Specify that the -compiler should use the assembler pointed to by @var{pathname}, rather -than the one found by the standard rules to find an assembler, which -are: -@itemize @bullet -@item -Check the -@file{@var{exec_prefix}/lib/gcc-lib/@var{target}/@var{version}} -directory, where @var{exec_prefix} defaults to @var{prefix} which -defaults to @file{/usr/local} unless overridden by the -@option{--prefix=@var{pathname}} switch described above. @var{target} is the -target system triple, such as @samp{sparc-sun-solaris2.7}, and -@var{version} denotes the GCC version, such as 3.0. -@item -Check operating system specific directories (e.g.@: @file{/usr/ccs/bin} on -Sun Solaris 2). -@end itemize -Note that these rules do not check for the value of @env{PATH}. You may -want to use @option{--with-as} if no assembler is installed in the -directories listed above, or if you have multiple assemblers installed -and want to choose one that is not found by the above rules. - -@item @anchor{with-gnu-ld}--with-gnu-ld -Same as @uref{#with-gnu-as,,@option{--with-gnu-as}} -but for linker. - - -@item --with-ld=@var{pathname} -Same as -@option{--with-as}, but for the linker. - -@item --with-stabs -Specify that stabs debugging -information should be used instead of whatever format the host normally -uses. Normally GCC uses the same debug format as the host system. - -On MIPS based systems and on Alphas, you must specify whether you want -GCC to create the normal ECOFF debugging format, or to use BSD-style -stabs passed through the ECOFF symbol table. The normal ECOFF debug -format cannot fully handle languages other than C@. BSD stabs format can -handle other languages, but it only works with the GNU debugger GDB@. - -Normally, GCC uses the ECOFF debugging format by default; if you -prefer BSD stabs, specify @option{--with-stabs} when you configure GCC@. - -No matter which default you choose when you configure GCC, the user -can use the @option{-gcoff} and @option{-gstabs+} options to specify explicitly -the debug format for a particular compilation. - -@option{--with-stabs} is meaningful on the ISC system on the 386, also, if -@option{--with-gas} is used. It selects use of stabs debugging -information embedded in COFF output. This kind of debugging information -supports C++ well; ordinary COFF debugging information does not. - -@option{--with-stabs} is also meaningful on 386 systems running SVR4. It -selects use of stabs debugging information embedded in ELF output. The -C++ compiler currently (2.6.0) does not support the DWARF debugging -information normally used on 386 SVR4 platforms; stabs provide a -workable alternative. This requires gas and gdb, as the normal SVR4 -tools can not generate or interpret stabs. - -@item --disable-multilib -Specify that multiple target -libraries to support different target variants, calling -conventions, etc should not be built. The default is to build a -predefined set of them. - -Some targets provide finer-grained control over which multilibs are built -(e.g., @option{--disable-softfloat}): -@table @code -@item arc-*-elf* -biendian. - -@item arm-*-* -fpu, 26bit, underscore, interwork, biendian, nofmult. - -@item m68*-*-* -softfloat, m68881, m68000, m68020. - -@item mips*-*-* -single-float, biendian, softfloat. - -@item powerpc*-*-*, rs6000*-*-* -aix64, pthread, softfloat, powercpu, powerpccpu, powerpcos, biendian, -sysv, aix. - -@end table - -@item --enable-threads -Specify that the target -supports threads. This affects the Objective-C compiler and runtime -library, and exception handling for other languages like C++ and Java. -On some systems, this is the default. - -In general, the best (and, in many cases, the only known) threading -model available will be configured for use. Beware that on some -systems, gcc has not been taught what threading models are generally -available for the system. In this case, @option{--enable-threads} is an -alias for @option{--enable-threads=single}. - -@item --disable-threads -Specify that threading support should be disabled for the system. -This is an alias for @option{--enable-threads=single}. - -@item --enable-threads=@var{lib} -Specify that -@var{lib} is the thread support library. This affects the Objective-C -compiler and runtime library, and exception handling for other languages -like C++ and Java. The possibilities for @var{lib} are: - -@table @code -@item aix -AIX thread support. -@item dce -DCE thread support. -@item mach -Generic MACH thread support, known to work on NeXTSTEP@. (Please note -that the file needed to support this configuration, @file{gthr-mach.h}, is -missing and thus this setting will cause a known bootstrap failure.) -@item no -This is an alias for @samp{single}. -@item posix -Generic POSIX thread support. -@item pthreads -Same as @samp{posix} on arm*-*-linux*, *-*-chorusos* and *-*-freebsd* -only. A future release of gcc might remove this alias or extend it -to all platforms. -@item rtems -RTEMS thread support. -@item single -Disable thread support, should work for all platforms. -@item solaris -Sun Solaris 2 thread support. -@item vxworks -VxWorks thread support. -@item win32 -Microsoft Win32 API thread support. -@end table - -@item --with-cpu=@var{cpu} -Specify which cpu variant the -compiler should generate code for by default. This is currently -only supported on the some ports, specifically arm, powerpc, and -SPARC@. If configure does not recognize the model name (e.g.@: arm700, -603e, or ultrasparc) you provide, please check the configure script -for a complete list of supported models. - -@item --enable-altivec -Specify that the target supports AltiVec vector enhancements. This -option will adjust the ABI for AltiVec enhancements, as well as generate -AltiVec code when appropriate. This option is only available for -PowerPC systems. - -@item --enable-target-optspace -Specify that target -libraries should be optimized for code space instead of code speed. -This is the default for the m32r platform. - -@item --disable-cpp -Specify that a user visible @command{cpp} program should not be installed. - -@item --with-cpp-install-dir=@var{dirname} -Specify that the user visible @command{cpp} program should be installed -in @file{@var{prefix}/@var{dirname}/cpp}, in addition to @var{bindir}. - -@item --enable-maintainer-mode -The build rules that -regenerate the GCC master message catalog @file{gcc.pot} are normally -disabled. This is because it can only be rebuilt if the complete source -tree is present. If you have changed the sources and want to rebuild the -catalog, configuring with @option{--enable-maintainer-mode} will enable -this. Note that you need a recent version of the @code{gettext} tools -to do so. - -@item --enable-version-specific-runtime-libs -Specify -that runtime libraries should be installed in the compiler specific -subdirectory (@file{@var{libsubdir}}) rather than the usual places. In -addition, @samp{libstdc++}'s include files will be installed in -@file{@var{libsubdir}/include/g++} unless you overruled it by using -@option{--with-gxx-include-dir=@var{dirname}}. Using this option is -particularly useful if you intend to use several versions of GCC in -parallel. This is currently supported by @samp{libf2c} and -@samp{libstdc++}, and is the default for @samp{libobjc} which cannot be -changed in this case. - -@item --enable-languages=@var{lang1},@var{lang2},@dots{} -Specify that only a particular subset of compilers and -their runtime libraries should be built. For a list of valid values for -@var{langN} you can issue the following command in the -@file{gcc} directory of your GCC source tree:@* -@example -grep language= */config-lang.in -@end example -Currently, you can use any of the following: -@code{ada}, @code{c}, @code{c++}, @code{f77}, @code{java}, @code{objc}. -Building the Ada compiler has special requirements, see below.@* -If you do not pass this flag, all languages available in the @file{gcc} -sub-tree will be configured. Re-defining @code{LANGUAGES} when calling -@samp{make bootstrap} @strong{does not} work anymore, as those -language sub-directories might not have been configured! - -@item --disable-libgcj -Specify that the run-time libraries -used by GCJ should not be built. This is useful in case you intend -to use GCJ with some other run-time, or you're going to install it -separately, or it just happens not to build on your particular -machine. In general, if the Java front end is enabled, the GCJ -libraries will be enabled too, unless they're known to not work on -the target platform. If GCJ is enabled but @samp{libgcj} isn't built, you -may need to port it; in this case, before modifying the top-level -@file{configure.in} so that @samp{libgcj} is enabled by default on this platform, -you may use @option{--enable-libgcj} to override the default. - -@item --with-dwarf2 -Specify that the compiler should -use DWARF 2 debugging information as the default. - -@item --enable-win32-registry -@itemx --enable-win32-registry=@var{key} -@itemx --disable-win32-registry -The @option{--enable-win32-registry} option enables Windows-hosted GCC -to look up installations paths in the registry using the following key: - -@smallexample -@code{HKEY_LOCAL_MACHINE\SOFTWARE\Free Software Foundation\@var{key}} -@end smallexample - -@var{key} defaults to GCC version number, and can be overridden by the -@option{--enable-win32-registry=@var{key}} option. Vendors and distributors -who use custom installers are encouraged to provide a different key, -perhaps one comprised of vendor name and GCC version number, to -avoid conflict with existing installations. This feature is enabled -by default, and can be disabled by @option{--disable-win32-registry} -option. This option has no effect on the other hosts. - -@item --nfp -Specify that the machine does not have a floating point unit. This -option only applies to @samp{m68k-sun-sunos@var{n}} and -@samp{m68k-isi-bsd}. On any other system, @option{--nfp} has no effect. - -@item --enable-checking -@itemx --enable-checking=@var{list} -When you specify this option, the compiler is built to perform checking -of tree node types when referencing fields of that node, and some other -internal consistency checks. This does not change the generated code, -but adds error checking within the compiler. This will slow down the -compiler and may only work properly if you are building the compiler -with GCC@. This is on by default when building from CVS or snapshots, -but off for releases. More control over the checks may be had by -specifying @var{list}; the categories of checks available are -@samp{misc}, @samp{tree}, @samp{gc}, @samp{rtl} and @samp{gcac}. The -default when @var{list} is not specified is @samp{misc,tree,gc}; the -checks @samp{rtl} and @samp{gcac} are very expensive. - -@item --enable-nls -@itemx --disable-nls -The @option{--enable-nls} option enables Native Language Support (NLS), -which lets GCC output diagnostics in languages other than American -English. Native Language Support is enabled by default if not doing a -canadian cross build. The @option{--disable-nls} option disables NLS@. - -@item --with-included-gettext -If NLS is enabled, the @option{--with-included-gettext} option causes the build -procedure to prefer its copy of GNU @command{gettext}. - -@item --with-catgets -If NLS is enabled, and if the host lacks @code{gettext} but has the -inferior @code{catgets} interface, the GCC build procedure normally -ignores @code{catgets} and instead uses GCC's copy of the GNU -@code{gettext} library. The @option{--with-catgets} option causes the -build procedure to use the host's @code{catgets} in this situation. - -@item --with-libiconv-prefix=@var{dir} -Search for libiconv header files in @file{@var{dir}/include} and -libiconv library files in @file{@var{dir}/lib}. - -@item --with-system-zlib -Use installed zlib rather than that included with GCC@. This option -only applies if the Java front end is being built. - -@item --enable-obsolete -Enable configuration for an obsoleted system. If you attempt to -configure GCC for a system (build, host, or target) which has been -obsoleted, and you do not specify this flag, configure will halt with an -error message. - -All support for systems which have been obsoleted in one release of GCC -is removed entirely in the next major release, unless someone steps -forward to maintain the port. -@end table - -Some options which only apply to building cross compilers: -@table @code -@item --with-headers=@var{dir} -Specifies a directory -which has target include files. -@emph{This option is required} when building a cross -compiler, if @file{@var{prefix}/@var{target}/sys-include} doesn't pre-exist. -These include files will be copied into the @file{gcc} install directory. -@command{fixincludes} will be run on these files to make them compatible with -GCC. -@item --with-libs=``@var{dir1} @var{dir2} @dots{} @var{dirN}'' -Specifies a list of directories which contain the target runtime -libraries. These libraries will be copied into the @file{gcc} install -directory. -@item --with-newlib -Specifies that @samp{newlib} is -being used as the target C library. This causes @code{__eprintf} to be -omitted from @file{libgcc.a} on the assumption that it will be provided by -@samp{newlib}. -@end table - -Note that each @option{--enable} option has a corresponding -@option{--disable} option and that each @option{--with} option has a -corresponding @option{--without} option. - -@html -<hr /> -<p> -@end html -@ifhtml -@uref{./index.html,,Return to the GCC Installation page} -@end ifhtml -@end ifset - -@c ***Building**************************************************************** -@ifnothtml -@comment node-name, next, previous, up -@node Building, Testing, Configuration, Installing GCC -@end ifnothtml -@ifset buildhtml -@ifnothtml -@chapter Building -@end ifnothtml -@cindex Installing GCC: Building - -Now that GCC is configured, you are ready to build the compiler and -runtime libraries. - -We @strong{highly} recommend that GCC be built using GNU make; -other versions may work, then again they might not. -GNU make is required for compiling GNAT (the Ada compiler) and the Java -runtime library. - -(For example, many broken versions of make will fail if you use the -recommended setup where @var{objdir} is different from @var{srcdir}. -Other broken versions may recompile parts of the compiler when -installing the compiler.) - -Some commands executed when making the compiler may fail (return a -nonzero status) and be ignored by @code{make}. These failures, which -are often due to files that were not found, are expected, and can safely -be ignored. - -It is normal to have compiler warnings when compiling certain files. -Unless you are a GCC developer, you can generally ignore these warnings -unless they cause compilation to fail. - -On certain old systems, defining certain environment variables such as -@env{CC} can interfere with the functioning of @command{make}. - -If you encounter seemingly strange errors when trying to build the -compiler in a directory other than the source directory, it could be -because you have previously configured the compiler in the source -directory. Make sure you have done all the necessary preparations. - -If you build GCC on a BSD system using a directory stored in an old System -V file system, problems may occur in running @command{fixincludes} if the -System V file system doesn't support symbolic links. These problems -result in a failure to fix the declaration of @code{size_t} in -@file{sys/types.h}. If you find that @code{size_t} is a signed type and -that type mismatches occur, this could be the cause. - -The solution is not to use such a directory for building GCC@. - -When building from CVS or snapshots, or if you modify parser sources, -you need the Bison parser generator installed. Any version 1.25 or -later should work; older versions may also work. If you do not modify -parser sources, releases contain the Bison-generated files and you do -not need Bison installed to build them. - -When building from CVS or snapshots, or if you modify Texinfo -documentation, you need version 4.1 or later of Texinfo installed if you -want Info documentation to be regenerated. Releases contain Info -documentation pre-built for the unmodified documentation in the release. - -@section Building a native compiler - -For a native build issue the command @samp{make bootstrap}. This -will build the entire GCC system, which includes the following steps: - -@itemize @bullet -@item -Build host tools necessary to build the compiler such as texinfo, bison, -gperf. - -@item -Build target tools for use by the compiler such as binutils (bfd, -binutils, gas, gprof, ld, and opcodes) -if they have been individually linked -or moved into the top level GCC source tree before configuring. - -@item -Perform a 3-stage bootstrap of the compiler. - -@item -Perform a comparison test of the stage2 and stage3 compilers. - -@item -Build runtime libraries using the stage3 compiler from the previous step. - -@end itemize - -If you are short on disk space you might consider @samp{make -bootstrap-lean} instead. This is identical to @samp{make -bootstrap} except that object files from the stage1 and -stage2 of the 3-stage bootstrap of the compiler are deleted as -soon as they are no longer needed. - -If you want to save additional space during the bootstrap and in -the final installation as well, you can build the compiler binaries -without debugging information as in the following example. This will save -roughly 40% of disk space both for the bootstrap and the final installation. -(Libraries will still contain debugging information.) - -@example - make CFLAGS='-O' LIBCFLAGS='-g -O2' \ - LIBCXXFLAGS='-g -O2 -fno-implicit-templates' bootstrap -@end example - -If you wish to use non-default GCC flags when compiling the stage2 and -stage3 compilers, set @code{BOOT_CFLAGS} on the command line when doing -@samp{make bootstrap}. Non-default optimization flags are less well -tested here than the default of @samp{-g -O2}, but should still work. -In a few cases, you may find that you need to specify special flags such -as @option{-msoft-float} here to complete the bootstrap; or, if the -native compiler miscompiles the stage1 compiler, you may need to work -around this, by choosing @code{BOOT_CFLAGS} to avoid the parts of the -stage1 compiler that were miscompiled, or by using @samp{make -bootstrap4} to increase the number of stages of bootstrap. - -If you used the flag @option{--enable-languages=@dots{}} to restrict -the compilers to be built, only those you've actually enabled will be -built. This will of course only build those runtime libraries, for -which the particular compiler has been built. Please note, -that re-defining @env{LANGUAGES} when calling @samp{make bootstrap} -@strong{does not} work anymore! - -If the comparison of stage2 and stage3 fails, this normally indicates -that the stage2 compiler has compiled GCC incorrectly, and is therefore -a potentially serious bug which you should investigate and report. (On -a few systems, meaningful comparison of object files is impossible; they -always appear ``different''. If you encounter this problem, you will -need to disable comparison in the @file{Makefile}.) - -@section Building a cross compiler - -We recommend reading the -@uref{http://www.objsw.com/CrossGCC/,,crossgcc FAQ} -for information about building cross compilers. - -When building a cross compiler, it is not generally possible to do a -3-stage bootstrap of the compiler. This makes for an interesting problem -as parts of GCC can only be built with GCC@. - -To build a cross compiler, we first recommend building and installing a -native compiler. You can then use the native GCC compiler to build the -cross compiler. The installed native compiler needs to be GCC version -2.95 or later. - -Assuming you have already installed a native copy of GCC and configured -your cross compiler, issue the command @command{make}, which performs the -following steps: - -@itemize @bullet -@item -Build host tools necessary to build the compiler such as texinfo, bison, -gperf. - -@item -Build target tools for use by the compiler such as binutils (bfd, -binutils, gas, gprof, ld, and opcodes) -if they have been individually linked or moved into the top level GCC source -tree before configuring. - -@item -Build the compiler (single stage only). - -@item -Build runtime libraries using the compiler from the previous step. -@end itemize - -Note that if an error occurs in any step the make process will exit. - -@section Building in parallel - -If you have a multiprocessor system you can use @samp{make bootstrap -MAKE="make -j 2" -j 2} or just @samp{make -j 2 bootstrap} -for GNU Make 3.79 and above instead of just @samp{make bootstrap} -when building GCC@. You can use a bigger number instead of two if -you like. In most cases, it won't help to use a number bigger than -the number of processors in your machine. - -@section Building the Ada compiler - -In order to build GNAT, the Ada compiler, you need a working GNAT -compiler (GNAT version 3.13 or later, or GCC version 3.1 or later), -since the Ada front end is written in Ada (with some -GNAT-specific extensions), and GNU make. - -However, you do not need a full installation of GNAT, just the GNAT -binary @file{gnat1}, a copy of @file{gnatbind}, and a compiler driver -which can deal with Ada input (by invoking the @file{gnat1} binary). -You can specify this compiler driver by setting the @env{ADAC} -environment variable at the configure step. @command{configure} can -detect the driver automatically if it has got a common name such as -@command{gcc} or @command{gnatgcc}. Of course, you still need a working -C compiler (the compiler driver can be different or not). -@command{configure} does not test whether the GNAT installation works -and has a sufficiently recent version; if too old a GNAT version is -installed, the build will fail unless @option{--enable-languages} is -used to disable building the Ada front end. - -Additional build tools (such as @command{gnatmake}) or a working GNAT -run-time library installation are usually @emph{not} required. However, -if you want to bootstrap the compiler using a minimal version of GNAT, -you have to issue the following commands before invoking @samp{make -bootstrap} (this assumes that you start with an unmodified and consistent -source distribution): - -@example - cd @var{srcdir}/gcc/ada - touch treeprs.ads [es]info.h nmake.ad[bs] -@end example - -At the moment, the GNAT library and several tools for GNAT are not built -by @samp{make bootstrap}. You have to invoke -@samp{make gnatlib_and_tools} in the @file{@var{objdir}/gcc} -subdirectory before proceeding with the next steps. - -For example, you can build a native Ada compiler by issuing the -following commands (assuming @command{make} is GNU make): - -@example - cd @var{objdir} - @var{srcdir}/configure --enable-languages=c,ada - cd @var{srcdir}/gcc/ada - touch treeprs.ads [es]info.h nmake.ad[bs] - cd @var{objdir} - make bootstrap - cd gcc - make gnatlib_and_tools - cd .. -@end example - -Currently, when compiling the Ada front end, you cannot use the parallel -build feature described in the previous section. - -@html -<hr /> -<p> -@end html -@ifhtml -@uref{./index.html,,Return to the GCC Installation page} -@end ifhtml -@end ifset - -@c ***Testing***************************************************************** -@ifnothtml -@comment node-name, next, previous, up -@node Testing, Final install, Building, Installing GCC -@end ifnothtml -@ifset testhtml -@ifnothtml -@chapter Installing GCC: Testing -@end ifnothtml -@cindex Testing -@cindex Installing GCC: Testing -@cindex Testsuite - -Before you install GCC, we encourage you to run the testsuites and to -compare your results with results from a similar configuration that have -been submitted to the -@uref{http://gcc.gnu.org/ml/gcc-testresults/,,gcc-testresults mailing list}. -This step is optional and may require you to download additional software, -but it can give you confidence in your new GCC installation or point out -problems before you install and start using your new GCC. - -First, you must have @uref{download.html,,downloaded the testsuites}. -These are part of the full distribution, but if you downloaded the -``core'' compiler plus any front ends, you must download the testsuites -separately. - -Second, you must have the testing tools installed. This includes -a @uref{http://www.gnu.org/software/dejagnu/,,current version of DejaGnu}; -dejagnu 1.3 is not sufficient. -It also includes Tcl and Expect; the DejaGnu site has links to these. - -Now you may need specific preparations: - -@itemize @bullet - -@item -The following environment variables may need to be set appropriately, as in -the following example (which assumes that DejaGnu has been installed -under @file{/usr/local}): - -@example - TCL_LIBRARY = /usr/local/share/tcl8.0 - DEJAGNULIBS = /usr/local/share/dejagnu -@end example - -On systems such as Cygwin, these paths are required to be actual -paths, not mounts or links; presumably this is due to some lack of -portability in the DejaGnu code. - -If the directories where @command{runtest} and @command{expect} were -installed are in the @env{PATH}, it should not be necessary to set these -environment variables. - -@end itemize - -Finally, you can run the testsuite (which may take a long time): -@example - cd @var{objdir}; make -k check -@end example - -The testing process will try to test as many components in the GCC -distribution as possible, including the C, C++, Objective-C and Fortran -compilers as well as the C++ and Java runtime libraries. - -While running the testsuite, DejaGnu might emit messages resembling -@samp{WARNING: Couldn't find the global config file.} or -@samp{WARNING: Couldn't find tool init file}. -These messages are harmless and do not affect the validity of the tests. - -@section How can I run the test suite on selected tests? - -As a first possibility to cut down the number of tests that are run it is -possible to use @samp{make check-gcc} or @samp{make check-g++} -in the @file{gcc} subdirectory of the object directory. To further cut down the -tests the following is possible: - -@example - make check-gcc RUNTESTFLAGS="execute.exp @var{other-options}" -@end example - -This will run all @command{gcc} execute tests in the testsuite. - -@example - make check-g++ RUNTESTFLAGS="old-deja.exp=9805* @var{other-options}" -@end example - -This will run the @command{g++} ``old-deja'' tests in the testsuite where the filename -matches @samp{9805*}. - -The @file{*.exp} files are located in the testsuite directories of the GCC -source, the most important ones being @file{compile.exp}, -@file{execute.exp}, @file{dg.exp} and @file{old-deja.exp}. -To get a list of the possible @file{*.exp} files, pipe the -output of @samp{make check} into a file and look at the -@samp{Running @dots{} .exp} lines. - -To run only the tests for a library, run @samp{make check} from the -the library's testsuite in a subdirectory of the object directory: -@file{libstdc++-v3/testsuite} or @file{libcgj/testsuite}. - -@section Additional testing for Java Class Libraries - -The @uref{http://sources.redhat.com/mauve/,,Mauve Project} provides -a suite of tests for the Java Class Libraries. This suite can be run -as part of libgcj testing by specifying the location of the Mauve tree -when invoking @samp{make}, as in @samp{make MAUVEDIR=~/mauve check}. - -@section How to interpret test results - -After the testsuite has run you'll find various @file{*.sum} and @file{*.log} -files in the testsuite subdirectories. The @file{*.log} files contain a -detailed log of the compiler invocations and the corresponding -results, the @file{*.sum} files summarize the results. These summaries list -all the tests that have been run with a corresponding status code: - -@itemize @bullet -@item -PASS: the test passed as expected -@item -XPASS: the test unexpectedly passed -@item -FAIL: the test unexpectedly failed -@item -XFAIL: the test failed as expected -@item -UNSUPPORTED: the test is not supported on this platform -@item -ERROR: the testsuite detected an error -@item -WARNING: the testsuite detected a possible problem -@end itemize - -It is normal for some tests to report unexpected failures. At the -current time our testing harness does not allow fine grained control -over whether or not a test is expected to fail. We expect to fix this -problem in future releases. - - -@section Submitting test results - -If you want to report the results to the GCC project, use the -@file{contrib/test_summary} shell script. Start it in the @var{objdir} with - -@example - @var{srcdir}/contrib/test_summary -p your_commentary.txt \ - -m gcc-testresults@@gcc.gnu.org |sh -@end example - -This script uses the @command{Mail} program to send the results, so -make sure it is in your @env{PATH}. The file @file{your_commentary.txt} is -prepended to the testsuite summary and should contain any special -remarks you have on your results or your build environment. Please -do not edit the testsuite result block or the subject line, as these -messages are automatically parsed and presented at the -@uref{http://gcc.gnu.org/testresults/,,GCC testresults} web -page. Here you can also gather information on how specific tests -behave on different platforms and compare them with your results. A -few failing testcases are possible even on released versions and you -should look here first if you think your results are unreasonable. - -@html -<hr /> -<p> -@end html -@ifhtml -@uref{./index.html,,Return to the GCC Installation page} -@end ifhtml -@end ifset - -@c ***Final install*********************************************************** -@ifnothtml -@comment node-name, next, previous, up -@node Final install, , Testing, Installing GCC -@end ifnothtml -@ifset finalinstallhtml -@ifnothtml -@chapter Installing GCC: Final installation -@end ifnothtml - -Now that GCC has been built (and optionally tested), you can install it with -@example -cd @var{objdir}; make install -@end example - -We strongly recommend to install into a target directory where there is -no previous version of GCC present. - -That step completes the installation of GCC; user level binaries can -be found in @file{@var{prefix}/bin} where @var{prefix} is the value you -specified with the @option{--prefix} to configure (or @file{/usr/local} -by default). (If you specified @option{--bindir}, that directory will -be used instead; otherwise, if you specified @option{--exec-prefix}, -@file{@var{exec-prefix}/bin} will be used.) Headers for the C++ and -Java libraries are installed in @file{@var{prefix}/include}; libraries -in @file{@var{libdir}} (normally @file{@var{prefix}/lib}); internal -parts of the compiler in @file{@var{libdir}/gcc-lib}; documentation in -info format in @file{@var{infodir}} (normally @file{@var{prefix}/info}). - -If you built a released version of GCC using @samp{make bootstrap} then please -quickly review the build status page for your release, available from -@uref{http://gcc.gnu.org/buildstat.html}. -If your system is not listed for the version of GCC that you built, -send a note to -@email{gcc@@gcc.gnu.org} indicating -that you successfully built and installed GCC. -Include the following information: - -@itemize @bullet -@item -Output from running @file{@var{srcdir}/config.guess}. Do not send us -that file itself, just the one-line output from running it. - -@item -The output of @samp{gcc -v} for your newly installed gcc. -This tells us which version of GCC you built and the options you passed to -configure. - -@item -Whether you enabled all languages or a subset of them. If you used a -full distribution then this information is part of the configure -options in the output of @samp{gcc -v}, but if you downloaded the -``core'' compiler plus additional front ends then it isn't apparent -which ones you built unless you tell us about it. - -@item -If the build was for GNU/Linux, also include: -@itemize @bullet -@item -The distribution name and version (e.g., Red Hat 7.1 or Debian 2.2.3); -this information should be available from @file{/etc/issue}. - -@item -The version of the Linux kernel, available from @samp{uname --version} -or @samp{uname -a}. - -@item -The version of glibc you used; for RPM-based systems like Red Hat, -Mandrake, and SuSE type @samp{rpm -q glibc} to get the glibc version, -and on systems like Debian and Progeny use @samp{dpkg -l libc6}. -@end itemize -For other systems, you can include similar information if you think it is -relevant. - -@item -Any other information that you think would be useful to people building -GCC on the same configuration. The new entry in the build status list -will include a link to the archived copy of your message. -@end itemize - -We'd also like to know if the -@ifnothtml -@ref{Specific, host/target specific installation notes} -@end ifnothtml -@ifhtml -@uref{specific.html,,host/target specific installation notes} -@end ifhtml -didn't include your host/target information or if that information is -incomplete or out of date. Send a note to -@email{gcc@@gcc.gnu.org} telling us how the information should be changed. - -If you find a bug, please report it following our -@uref{../bugs.html,,bug reporting guidelines}. - -If you want to print the GCC manuals, do @samp{cd @var{objdir}; make -dvi}. You will need to have @command{texi2dvi} (version at least 4.1) -and @TeX{} installed. This creates a number of @file{.dvi} files in -subdirectories of @file{@var{objdir}}; these may be converted for -printing with programs such as @command{dvips}. You can also -@uref{http://www.gnu.org/order/order.html,,buy printed manuals from the -Free Software Foundation}, though such manuals may not be for the most -recent version of GCC@. - -@html -<hr /> -<p> -@end html -@ifhtml -@uref{./index.html,,Return to the GCC Installation page} -@end ifhtml -@end ifset - -@c ***Binaries**************************************************************** -@ifnothtml -@comment node-name, next, previous, up -@node Binaries, Specific, Installing GCC, Top -@end ifnothtml -@ifset binarieshtml -@ifnothtml -@chapter Installing GCC: Binaries -@end ifnothtml -@cindex Binaries -@cindex Installing GCC: Binaries - -We are often asked about pre-compiled versions of GCC@. While we cannot -provide these for all platforms, below you'll find links to binaries for -various platforms where creating them by yourself is not easy due to various -reasons. - -Please note that we did not create these binaries, nor do we -support them. If you have any problems installing them, please -contact their makers. - -@itemize -@item -AIX: -@itemize -@item -@uref{http://www.bullfreeware.com,,Bull's Freeware and Shareware Archive for AIX}; - -@item -@uref{http://aixpdslib.seas.ucla.edu,,UCLA Software Library for AIX}. -@end itemize - -@item -DOS---@uref{http://www.delorie.com/djgpp/,,DJGPP}. - -@item -Hitachi H8/300[HS]---@uref{http://h8300-hms.sourceforge.net/,,GNU -Development Tools for the Hitachi H8/300[HS] Series}. - -@item -HP-UX: -@itemize -@item -@uref{http://hpux.cae.wisc.edu/,,HP-UX Porting Center}; - -@item -@uref{ftp://sunsite.informatik.rwth-aachen.de/pub/packages/gcc_hpux/,,Binaries for HP-UX 11.00 at Aachen University of Technology}. -@end itemize - -@item -@uref{http://www.sco.com/skunkware/devtools/index.html#gcc,,SCO -OpenServer/Unixware}. - -@item -Sinix/Reliant Unix---@uref{ftp://ftp.siemens.de/sni/mr/pd/gnu/gcc,,Siemens}. - -@item -Solaris 2 (SPARC, Intel)---@uref{http://www.sunfreeware.com/,,Sunfreeware}. - -@item -SGI---@uref{http://freeware.sgi.com/,,SGI Freeware}. - -@item -Windows 95, 98, and NT: -@itemize -@item -The @uref{http://sources.redhat.com/cygwin/,,Cygwin} project; -@item -The @uref{http://www.mingw.org/,,MinGW} project. -@end itemize - -@item -@uref{ftp://ftp.thewrittenword.com/packages/free/by-name/,,The -Written Word} offers binaries for Solaris 2.5.1, 2.6, 2.7/SPARC, 2.7/Intel, -IRIX 6.2, 6.5, Digital UNIX 4.0D, HP-UX 10.20, and HP-UX 11.00. - -@end itemize - -In addition to those specific offerings, you can get a binary -distribution CD-ROM from the -@uref{http://www.fsf.org/order/order.html,,Free Software Foundation}. -It contains binaries for a number of platforms, and -includes not only GCC, but other stuff as well. The current CD does -not contain the latest version of GCC, but it should allow -bootstrapping the compiler. An updated version of that disk is in the -works. - -@html -<hr /> -<p> -@end html -@ifhtml -@uref{./index.html,,Return to the GCC Installation page} -@end ifhtml -@end ifset - -@c ***Specific**************************************************************** -@ifnothtml -@comment node-name, next, previous, up -@node Specific, Old, Binaries, Top -@end ifnothtml -@ifset specifichtml -@ifnothtml -@chapter Host/target specific installation notes for GCC -@end ifnothtml -@cindex Specific -@cindex Specific installation notes -@cindex Target specific installation -@cindex Host specific installation -@cindex Target specific installation notes - -Please read this document carefully @emph{before} installing the -GNU Compiler Collection on your machine. - -@ifhtml -@itemize -@item -@uref{#1750a-*-*,,1750a-*-*} -@item -@uref{#a29k,,a29k} -@item -@uref{#a29k-*-bsd,,a29k-*-bsd} -@item -@uref{#alpha*-*-*,,alpha*-*-*} -@item -@uref{#alpha*-dec-osf*,,alpha*-dec-osf*} -@item -@uref{#alphaev5-cray-unicosmk*,,alphaev5-cray-unicosmk*} -@item -@uref{#arc-*-elf,,arc-*-elf} -@item -@uref{#arm-*-aout,,arm-*-aout} -@item -@uref{#arm-*-elf,,arm-*-elf} -@item -@uref{#arm*-*-linux-gnu,,arm*-*-linux-gnu} -@item -@uref{#arm-*-riscix,,arm-*-riscix} -@item -@uref{#avr,,avr} -@item -@uref{#c4x,,c4x} -@item -@uref{#dos,,DOS} -@item -@uref{#dsp16xx,,dsp16xx} -@item -@uref{#elxsi-elxsi-bsd,,elxsi-elxsi-bsd} -@item -@uref{#*-*-freebsd*,,*-*-freebsd*} -@item -@uref{#h8300-hms,,h8300-hms} -@item -@uref{#hppa*-hp-hpux*,,hppa*-hp-hpux*} -@item -@uref{#hppa*-hp-hpux9,,hppa*-hp-hpux9} -@item -@uref{#hppa*-hp-hpux10,,hppa*-hp-hpux10} -@item -@uref{#hppa*-hp-hpux11,,hppa*-hp-hpux11} -@item -@uref{#i370-*-*,,i370-*-*} -@item -@uref{#*-*-linux-gnu,,*-*-linux-gnu} -@item -@uref{#ix86-*-linux*oldld,,i?86-*-linux*oldld} -@item -@uref{#ix86-*-linux*aout,,i?86-*-linux*aout} -@item -@uref{#ix86-*-linux*,,i?86-*-linux*} -@item -@uref{#ix86-*-sco,,i?86-*-sco} -@item -@uref{#ix86-*-sco3.2v4,,i?86-*-sco3.2v4} -@item -@uref{#ix86-*-sco3.2v5*,,i?86-*-sco3.2v5*} -@item -@uref{#ix86-*-udk,,i?86-*-udk} -@item -@uref{#ix86-*-isc,,i?86-*-isc} -@item -@uref{#ix86-*-esix,,i?86-*-esix} -@item -@uref{#ix86-ibm-aix,,i?86-ibm-aix} -@item -@uref{#ix86-sequent-bsd,,i?86-sequent-bsd} -@item -@uref{#ix86-sequent-ptx1*,,i?86-sequent-ptx1*, i?86-sequent-ptx2*, i?86-sequent-sysv3*} -@item -@uref{#i860-intel-osf*,,i860-intel-osf*} -@item -@uref{#ia64-*-linux,,ia64-*-linux} -@item -@uref{#*-lynx-lynxos,,*-lynx-lynxos} -@item -@uref{#*-ibm-aix*,,*-ibm-aix*} -@item -@uref{#m32r-*-elf,,m32r-*-elf} -@item -@uref{#m68000-hp-bsd,,m68000-hp-bsd} -@item -@uref{#m6811-elf,,m6811-elf} -@item -@uref{#m6812-elf,,m6812-elf} -@item -@uref{#m68k-altos,,m68k-altos} -@item -@uref{#m68k-apple-aux,,m68k-apple-aux} -@item -@uref{#m68k-att-sysv,,m68k-att-sysv} -@item -@uref{#m68k-bull-sysv,,m68k-bull-sysv} -@item -@uref{#m68k-crds-unos,,m68k-crds-unos} -@item -@uref{#m68k-hp-hpux,,m68k-hp-hpux} -@item -@uref{#m68k-*-nextstep*,,m68k-*-nextstep*} -@item -@uref{#m68k-ncr-*,,m68k-ncr-*} -@item -@uref{#m68k-sun,,m68k-sun} -@item -@uref{#m68k-sun-sunos4.1.1,,m68k-sun-sunos4.1.1} -@item -@uref{#m88k-*-svr3,,m88k-*-svr3} -@item -@uref{#m88k-*-dgux,,m88k-*-dgux} -@item -@uref{#m88k-tektronix-sysv3,,m88k-tektronix-sysv3} -@item -@uref{#mips-*-*,,mips-*-*} -@item -@uref{#mips-dec-*,,mips-dec-*} -@item -@uref{#mips-mips-bsd,,mips-mips-bsd} -@item -@uref{#mips-mips-riscos*,,mips-mips-riscos*} -@item -@uref{#mips-sgi-irix4,,mips-sgi-irix4} -@item -@uref{#mips-sgi-irix5,,mips-sgi-irix5} -@item -@uref{#mips-sgi-irix6,,mips-sgi-irix6} -@item -@uref{#mips-sony-sysv,,mips-sony-sysv} -@item -@uref{#ns32k-encore,,ns32k-encore} -@item -@uref{#ns32k-*-genix,,ns32k-*-genix} -@item -@uref{#ns32k-sequent,,ns32k-sequent} -@item -@uref{#ns32k-utek,,ns32k-utek} -@item -@uref{#powerpc*-*-*,,powerpc*-*-*, powerpc-*-sysv4} -@item -@uref{#powerpc-*-darwin*,,powerpc-*-darwin*} -@item -@uref{#powerpc-*-elf,,powerpc-*-elf, powerpc-*-sysv4} -@item -@uref{#powerpc-*-linux-gnu*,,powerpc-*-linux-gnu*} -@item -@uref{#powerpc-*-netbsd*,,powerpc-*-netbsd*} -@item -@uref{#powerpc-*-eabiaix,,powerpc-*-eabiaix} -@item -@uref{#powerpc-*-eabisim,,powerpc-*-eabisim} -@item -@uref{#powerpc-*-eabi,,powerpc-*-eabi} -@item -@uref{#powerpcle-*-elf,,powerpcle-*-elf, powerpcle-*-sysv4} -@item -@uref{#powerpcle-*-eabisim,,powerpcle-*-eabisim} -@item -@uref{#powerpcle-*-eabi,,powerpcle-*-eabi} -@item -@uref{#powerpcle-*-winnt,,powerpcle-*-winnt, powerpcle-*-pe} -@item -@uref{#romp-*-aos,,romp-*-aos, romp-*-mach} -@item -@uref{#s390-*-linux*} -@item -@uref{#s390x-*-linux*} -@item -@uref{#*-*-solaris2*,,*-*-solaris2*} -@item -@uref{#sparc-sun-solaris2*,,sparc-sun-solaris2*} -@item -@uref{#sparc-sun-solaris2.7,,sparc-sun-solaris2.7} -@item -@uref{#sparc-sun-sunos4*,,sparc-sun-sunos4*} -@item -@uref{#sparc-unknown-linux-gnulibc1,,sparc-unknown-linux-gnulibc1} -@item -@uref{#sparc-*-linux*,,sparc-*-linux*} -@item -@uref{#sparc64-*-*,,sparc64-*-*} -@item -@uref{#sparcv9-*-solaris2*,,sparcv9-*-solaris2*} -@item -@uref{#*-*-sysv*,,*-*-sysv*} -@item -@uref{#vax-dec-ultrix,,vax-dec-ultrix} -@item -@uref{#we32k-*-*,,we32k-*-*} -@item -@uref{#xtensa-*-elf,,xtensa-*-elf} -@item -@uref{#xtensa-*-linux*,,xtensa-*-linux*} -@item -@uref{#windows,,Microsoft Windows} -@item -@uref{#os2,,OS/2} -@item -@uref{#older,,Older systems} -@end itemize - -@itemize -@item -@uref{#elf_targets,,all ELF targets} (SVR4, Solaris 2, etc.) -@end itemize -@end ifhtml - - -@html -<!-- -------- host/target specific issues start here ---------------- --> -<hr /> -@end html -@heading @anchor{1750a-*-*}1750a-*-* -MIL-STD-1750A processors. This target is obsoleted in GCC 3.1. - -The MIL-STD-1750A cross configuration produces output for -@code{as1750}, an assembler/linker available under the GNU General Public -License for the 1750A@. @code{as1750} can be obtained at -@uref{ftp://ftp.fta-berlin.de/pub/crossgcc/1750gals/}. -A similarly licensed simulator for -the 1750A is available from same address. - -You should ignore a fatal error during the building of @samp{libgcc} -(@samp{libgcc} is not yet implemented for the 1750A@.) - -The @code{as1750} assembler requires the file @file{ms1750.inc}, which is -found in the directory @file{gcc/config/1750a}. - -GCC produced the same sections as the Fairchild F9450 C Compiler, -namely: - -@table @code -@item Normal -The program code section. - -@item Static -The read/write (RAM) data section. - -@item Konst -The read-only (ROM) constants section. - -@item Init -Initialization section (code to copy KREL to SREL)@. -@end table - -The smallest addressable unit is 16 bits (@code{BITS_PER_UNIT} is 16). This -means that type @code{char} is represented with a 16-bit word per character. -The 1750A's ``Load/Store Upper/Lower Byte'' instructions are not used by -GCC@. - -@html -<hr /> -@end html -@heading @anchor{a29k}a29k -AMD Am29k-family processors. These are normally used in embedded -applications. This configuration corresponds to AMD's standard calling -sequence and binary interface and is compatible with other 29k tools. - -AMD has abandoned this processor. All existing a29k targets are obsoleted -in GCC 3.1. - -You may need to make a variant of the file @file{a29k.h} for your -particular configuration. - -@html -<hr /> -@end html -@heading @anchor{a29k-*-bsd}a29k-*-bsd -AMD Am29050 used in a system running a variant of BSD Unix. - -@html -<hr /> -@end html -@heading @anchor{alpha*-*-*}alpha*-*-* - -This section contains general configuration information for all -alpha-based platforms using ELF (in particular, ignore this section for -DEC OSF/1, Digital UNIX and Tru64 UNIX)@. In addition to reading this -section, please read all other sections that match your target. - -We require binutils 2.11.2 or newer. -Previous binutils releases had a number of problems with DWARF 2 -debugging information, not the least of which is incorrect linking of -shared libraries. - -@html -<hr /> -@end html -@heading @anchor{alpha*-dec-osf*}alpha*-dec-osf* -Systems using processors that implement the DEC Alpha architecture and -are running the DEC/Compaq Unix (DEC OSF/1, Digital UNIX, or Compaq -Tru64 UNIX) operating system, for example the DEC Alpha AXP systems. - -Support for versions before @code{alpha*-dec-osf4} is obsoleted in GCC -3.1. (These are the versions which identify themselves as DEC OSF/1.) - -In Digital Unix V4.0, virtual memory exhausted bootstrap failures -may be fixed by configuring with @option{--with-gc=simple}, -reconfiguring Kernel Virtual Memory and Swap parameters -per the @command{/usr/sbin/sys_check} Tuning Suggestions, -or applying the patch in -@uref{http://gcc.gnu.org/ml/gcc/2002-08/msg00822.html}. - -In Tru64 UNIX V5.1, Compaq introduced a new assembler that does not -currently (2001-06-13) work with @command{mips-tfile}. As a workaround, -we need to use the old assembler, invoked via the barely documented -@option{-oldas} option. To bootstrap GCC, you either need to use the -Compaq C Compiler: - -@example - % CC=cc @var{srcdir}/configure [@var{options}] [@var{target}] -@end example - -or you can use a copy of GCC 2.95.3 or higher built on Tru64 UNIX V4.0: - -@example - % CC=gcc -Wa,-oldas @var{srcdir}/configure [@var{options}] [@var{target}] -@end example - -As of GNU binutils 2.11.2, neither GNU @command{as} nor GNU @command{ld} -are supported on Tru64 UNIX, so you must not configure GCC with -@option{--with-gnu-as} or @option{--with-gnu-ld}. - -The @option{--enable-threads} options isn't supported yet. A patch is -in preparation for a future release. - -GCC writes a @samp{.verstamp} directive to the assembler output file -unless it is built as a cross-compiler. It gets the version to use from -the system header file @file{/usr/include/stamp.h}. If you install a -new version of DEC Unix, you should rebuild GCC to pick up the new version -stamp. - -Note that since the Alpha is a 64-bit architecture, cross-compilers from -32-bit machines will not generate code as efficient as that generated -when the compiler is running on a 64-bit machine because many -optimizations that depend on being able to represent a word on the -target in an integral value on the host cannot be performed. Building -cross-compilers on the Alpha for 32-bit machines has only been tested in -a few cases and may not work properly. - -@code{make compare} may fail on old versions of DEC Unix unless you add -@option{-save-temps} to @code{CFLAGS}. On these systems, the name of the -assembler input file is stored in the object file, and that makes -comparison fail if it differs between the @code{stage1} and -@code{stage2} compilations. The option @option{-save-temps} forces a -fixed name to be used for the assembler input file, instead of a -randomly chosen name in @file{/tmp}. Do not add @option{-save-temps} -unless the comparisons fail without that option. If you add -@option{-save-temps}, you will have to manually delete the @samp{.i} and -@samp{.s} files after each series of compilations. - -GCC now supports both the native (ECOFF) debugging format used by DBX -and GDB and an encapsulated STABS format for use only with GDB@. See the -discussion of the @option{--with-stabs} option of @file{configure} above -for more information on these formats and how to select them. - -There is a bug in DEC's assembler that produces incorrect line numbers -for ECOFF format when the @samp{.align} directive is used. To work -around this problem, GCC will not emit such alignment directives -while writing ECOFF format debugging information even if optimization is -being performed. Unfortunately, this has the very undesirable -side-effect that code addresses when @option{-O} is specified are -different depending on whether or not @option{-g} is also specified. - -To avoid this behavior, specify @option{-gstabs+} and use GDB instead of -DBX@. DEC is now aware of this problem with the assembler and hopes to -provide a fix shortly. - -@html -<hr /> -@end html -@heading @anchor{alphaev5-cray-unicosmk*}alphaev5-cray-unicosmk* -Cray T3E systems running Unicos/Mk. - -This port is incomplete and has many known bugs. We hope to improve the -support for this target soon. Currently, only the C front end is supported, -and it is not possible to build parallel applications. Cray modules are not -supported; in particular, Craylibs are assumed to be in -@file{/opt/ctl/craylibs/craylibs}. - -You absolutely @strong{must} use GNU make on this platform. Also, you -need to tell GCC where to find the assembler and the linker. The -simplest way to do so is by providing @option{--with-as} and -@option{--with-ld} to @file{configure}, e.g.@: - -@example - configure --with-as=/opt/ctl/bin/cam --with-ld=/opt/ctl/bin/cld \ - --enable-languages=c -@end example - -The comparison test during @samp{make bootstrap} fails on Unicos/Mk -because the assembler inserts timestamps into object files. You should -be able to work around this by doing @samp{make all} after getting this -failure. - -@html -<hr /> -@end html -@heading @anchor{arc-*-elf}arc-*-elf -Argonaut ARC processor. -This configuration is intended for embedded systems. - -@html -<hr /> -@end html -@heading @anchor{arm-*-aout}arm-*-aout -Advanced RISC Machines ARM-family processors. These are often used in -embedded applications. There are no standard Unix configurations. -This configuration corresponds to the basic instruction sequences and will -produce @file{a.out} format object modules. - -You may need to make a variant of the file @file{arm.h} for your particular -configuration. - -@html -<hr /> -@end html -@heading @anchor{arm-*-elf}arm-*-elf -This configuration is intended for embedded systems. - -@html -<hr /> -@end html -@heading @anchor{arm*-*-linux-gnu}arm*-*-linux-gnu - -We require GNU binutils 2.10 or newer. - -@html -<hr /> -@end html -@heading @anchor{arm-*-riscix}arm-*-riscix -The ARM2 or ARM3 processor running RISC iX, Acorn's port of BSD Unix. -This configuration is obsoleted in GCC 3.1. - -If you are running a version of RISC iX prior to 1.2 then you must -specify the version number during configuration. Note that the -assembler shipped with RISC iX does not support stabs debugging -information; a new version of the assembler, with stabs support -included, is now available from Acorn and via ftp -@uref{ftp://ftp.acorn.com/pub/riscix/as+xterm.tar.Z}. To enable stabs -debugging, pass @option{--with-gnu-as} to configure. - -You will need to install GNU @command{sed} before you can run configure. - -@html -<hr /> -@end html -@heading @anchor{avr}avr - -ATMEL AVR-family micro controllers. These are used in embedded -applications. There are no standard Unix configurations. -@ifnothtml -@xref{AVR Options,, AVR Options, gcc, Using and Porting the GNU Compiler -Collection (GCC)}, -@end ifnothtml -@ifhtml -See ``AVR Options'' in the main manual -@end ifhtml -for the list of supported MCU types. - -Use @samp{configure --target=avr --enable-languages="c"} to configure GCC@. - -Further installation notes and other useful information about AVR tools -can also be obtained from: - -@itemize @bullet -@item -@uref{http://home.overta.ru/users/denisc,,http://home.overta.ru/users/denisc} -@item -@uref{http://www.amelek.gda.pl/avr,,http://www.amelek.gda.pl/avr} -@end itemize - -We @emph{strongly} recommend using binutils 2.11 or newer. - -The following error: -@example - Error: register required -@end example - -indicates that you should upgrade to a newer version of the binutils. - -@html -<hr /> -@end html -@heading @anchor{c4x}c4x - -Texas Instruments TMS320C3x and TMS320C4x Floating Point Digital Signal -Processors. These are used in embedded applications. There are no -standard Unix configurations. -@ifnothtml -@xref{TMS320C3x/C4x Options,, TMS320C3x/C4x Options, gcc, Using and -Porting the GNU Compiler Collection (GCC)}, -@end ifnothtml -@ifhtml -See ``TMS320C3x/C4x Options'' in the main manual -@end ifhtml -for the list of supported MCU types. - -GCC can be configured as a cross compiler for both the C3x and C4x -architectures on the same system. Use @samp{configure --target=c4x ---enable-languages="c,c++"} to configure. - - -Further installation notes and other useful information about C4x tools -can also be obtained from: - -@itemize @bullet -@item -@uref{http://www.elec.canterbury.ac.nz/c4x/,,http://www.elec.canterbury.ac.nz/c4x/} -@end itemize - -@html -<hr /> -@end html -@heading @anchor{cris}CRIS - -CRIS is the CPU architecture in Axis Communications ETRAX system-on-a-chip -series. These are used in embedded applications. - -@ifnothtml -@xref{CRIS Options,, CRIS Options, gcc, Using and Porting the GNU Compiler -Collection (GCC)}, -@end ifnothtml -@ifhtml -See ``CRIS Options'' in the main manual -@end ifhtml -for a list of CRIS-specific options. - -There are a few different CRIS targets: -@table @code -@item cris-axis-aout -Old target. Includes a multilib for the @samp{elinux} a.out-based -target. No multilibs for newer architecture variants. -@item cris-axis-elf -Mainly for monolithic embedded systems. Includes a multilib for the -@samp{v10} core used in @samp{ETRAX 100 LX}. -@item cris-axis-linux-gnu -A GNU/Linux port for the CRIS architecture, currently targeting -@samp{ETRAX 100 LX} by default. -@end table - -For @code{cris-axis-aout} and @code{cris-axis-elf} you need binutils 2.11 -or newer. For @code{cris-axis-linux-gnu} you need binutils 2.12 or newer. - -Pre-packaged tools can be obtained from -@uref{ftp://ftp.axis.com/pub/axis/tools/cris/compiler-kit/}. More -information about this platform is available at -@uref{http://developer.axis.com/}. - -@html -<hr /> -@end html -@heading @anchor{dos}DOS - -Please have a look at our @uref{binaries.html,,binaries page}. - -You cannot install GCC by itself on MSDOS; it will not compile under -any MSDOS compiler except itself. You need to get the complete -compilation package DJGPP, which includes binaries as well as sources, -and includes all the necessary compilation tools and libraries. - -@html -<hr /> -@end html -@heading @anchor{dsp16xx}dsp16xx -A port to the AT&T DSP1610 family of processors. - -@html -<hr /> -@end html -@heading @anchor{*-*-freebsd*}*-*-freebsd* - -The version of binutils installed in @file{/usr/bin} is known to work unless -otherwise specified in any per-architecture notes. However, binutils -2.12.1 or greater is known to improve overall testsuite results. - -For FreeBSD 1, FreeBSD 2 or any mutant a.out versions of FreeBSD 3: All -configuration support and files as shipped with GCC 2.95 are still in -place. FreeBSD 2.2.7 has been known to bootstrap completely; however, -it is unknown which version of binutils was used (it is assumed that it -was the system copy in @file{/usr/bin}) and C++ EH failures were noted. - -Support for FreeBSD 1 is obsoleted in GCC 3.1. - -For FreeBSD using the ELF file format: DWARF 2 debugging is now the -default for all CPU architectures. It had been the default on -FreeBSD/alpha since its inception. You may use @option{-gstabs} instead -of @option{-g}, if you really want the old debugging format. There are -no known issues with mixing object files and libraries with different -debugging formats. Otherwise, this release of GCC should now match more -of the configuration used in the stock FreeBSD configuration of GCC. In -particular, @option{--enable-threads} is now configured by default. -However, as a general user, do not attempt to replace the system -compiler with this release. Known to bootstrap and check with good -results on FreeBSD 3.0, 3.4, 4.0, 4.2, 4.3, 4.4, 4.5-STABLE and 5-CURRENT@. - -In principle, @option{--enable-threads} is now compatible with -@option{--enable-libgcj} on FreeBSD@. However, it has only been built -and tested on @samp{i386-*-freebsd4.5} and @samp{alpha-*-freebsd5.0}. -The static -library may be incorrectly built (symbols are missing at link time). -There is a rare timing-based startup hang (probably involves an -assupmtion about the thread library). Multi-threaded boehm-gc (required for -libjava) exposes severe threaded signal-handling bugs on FreeBSD before -4.5-RELEASE. The alpha port may not fully bootstrap without some manual -intervention: @command{gcjh} will crash with a floating-point exception while -generating @file{java/lang/Double.h} (just copy the version built on -@samp{i386-*-freebsd*} and rerun the top-level @command{gmake} with no -arguments and it -should properly complete the bootstrap). Other CPU architectures -supported by FreeBSD will require additional configuration tuning in, at -the very least, both boehm-gc and libffi. - -Shared @file{libgcc_s.so} is now built and installed by default. - -@html -<hr /> -@end html -@heading @anchor{elxsi-elxsi-bsd}elxsi-elxsi-bsd -The Elxsi's C compiler has known limitations that prevent it from -compiling GCC@. Please contact @email{mrs@@wrs.com} for more details. - -Support for this processor is obsoleted in GCC 3.1. - -@html -<hr /> -@end html -@heading @anchor{h8300-hms}h8300-hms -Hitachi H8/300 series of processors. - -Please have a look at our @uref{binaries.html,,binaries page}. - -The calling convention and structure layout has changed in release 2.6. -All code must be recompiled. The calling convention now passes the -first three arguments in function calls in registers. Structures are no -longer a multiple of 2 bytes. - -@html -<hr /> -@end html -@heading @anchor{hppa*-hp-hpux*}hppa*-hp-hpux* - -We @emph{highly} recommend using gas/binutils 2.8 or newer on all hppa -platforms; you may encounter a variety of problems when using the HP -assembler. The HP assembler does not work with the @samp{hppa64-hp-hpux11*} -port. - -Specifically, @option{-g} does not work on HP-UX (since that system -uses a peculiar debugging format which GCC does not know about), unless you -use GAS and GDB and configure GCC with the -@uref{./configure.html#with-gnu-as,,@option{--with-gnu-as}} and -@option{--with-as=@dots{}} options. - -If you wish to use the pa-risc 2.0 architecture support with a 32-bit -runtime, you must use either the HP assembler, gas/binutils 2.11 or newer, -or a recent -@uref{ftp://sources.redhat.com/pub/binutils/snapshots,,snapshot of gas}. - -More specific information to @samp{hppa*-hp-hpux*} targets follows. - -@html -<hr /> -@end html -@heading @anchor{hppa*-hp-hpux9}hppa*-hp-hpux9 - -The HP assembler has major problems on this platform. We've tried to work -around the worst of the problems. However, those workarounds may be causing -linker crashes in some circumstances; the workarounds also probably prevent -shared libraries from working. Use the GNU assembler to avoid these problems. - - -The configuration scripts for GCC will also trigger a bug in the hpux9 -shell. To avoid this problem set @env{CONFIG_SHELL} to @file{/bin/ksh} -and @env{SHELL} to @file{/bin/ksh} in your environment. - - -@html -<hr /> -@end html -@heading @anchor{hppa*-hp-hpux10}hppa*-hp-hpux10 - -For hpux10.20, we @emph{highly} recommend you pick up the latest sed patch -@code{PHCO_19798} from HP@. HP has two sites which provide patches free of -charge: - -@itemize @bullet -@item -@html -<a href="http://us-support.external.hp.com">US, Canada, Asia-Pacific, and -Latin-America</a> -@end html -@ifnothtml -@uref{http://us-support.external.hp.com,,}US, Canada, Asia-Pacific, and -Latin-America -@end ifnothtml -@item -@uref{http://europe-support.external.hp.com,,Europe} -@end itemize - -The HP assembler on these systems is much better than the hpux9 assembler, -but still has some problems. Most notably the assembler inserts timestamps -into each object file it creates, causing the 3-stage comparison test to fail -during a @samp{make bootstrap}. You should be able to continue by -saying @samp{make all} after getting the failure from @samp{make -bootstrap}. - - -@html -<hr /> -@end html -@heading @anchor{hppa*-hp-hpux11}hppa*-hp-hpux11 - -GCC 3.0 and up support HP-UX 11. On 64-bit capable systems, there -are two distinct ports. The @samp{hppa2.0w-hp-hpux11*} port generates -code for the 32-bit pa-risc runtime architecture. It uses the HP -linker and is currently the default selected by config.guess. The -optional @samp{hppa64-hp-hpux11*} port generates 64-bit code for the -pa-risc 2.0 architecture. It must be explicitly selected using the -@samp{--host=hppa64-hp-hpux11*} configure option. Different prefixes -must be used if both ports are to be installed on the same system. - -You must use GNU binutils 2.11 or above with the 32-bit port. Thread -support is not currently implemented, so @option{--enable-threads} does -not work. See: - -@itemize -@item @uref{http://gcc.gnu.org/ml/gcc-prs/2002-01/msg00551.html} -@item @uref{http://gcc.gnu.org/ml/gcc-bugs/2002-01/msg00663.html}. -@end itemize - -GCC 2.95.x is not supported under HP-UX 11 and cannot be used to -compile GCC 3.0 and up. Refer to @uref{binaries.html,,binaries} for -information about obtaining precompiled GCC binaries for HP-UX. - -GNU binutils 2.13 or later is recommended with the 64-bit port. -The HP assembler is not supported. It is @emph{highly} recommended -that the GNU linker be used as well. Either binutils must be built -prior to gcc, or a binary distribution of gcc or binutils must be -obtained for the initial builds. When starting with a HP compiler, -it is preferable to use the ANSI compiler as the bundled compiler -only supports traditional C. Bootstrapping with the bundled compiler -is tested infrequently and problems often arise because of the subtle -differences in semantics between traditional and ISO C. There also -have been problems reported with various binary distributions. This -port still is undergoing significant development. - -@html -<hr /> -@end html -@heading @anchor{i370-*-*}i370-*-* -This port is very preliminary and has many known bugs. We hope to -have a higher-quality port for this machine soon. - -@html -<hr /> -@end html -@heading @anchor{*-*-linux-gnu}*-*-linux-gnu - -If you use glibc 2.2 (or 2.1.9x), GCC 2.95.2 won't install -out-of-the-box. You'll get compile errors while building @samp{libstdc++}. -The patch @uref{glibc-2.2.patch,,glibc-2.2.patch}, that is to be -applied in the GCC source tree, fixes the compatibility problems. - -@html -@end html - -@html -<p> -@end html - -Currently Glibc 2.2.3 (and older releases) and GCC 3.0 are out of sync -since the latest exception handling changes for GCC@. Compiling glibc -with GCC 3.0 will give a binary incompatible glibc and therefore cause -lots of problems and might make your system completly unusable. This -will definitly need fixes in glibc but might also need fixes in GCC@. We -strongly advise to wait for glibc 2.2.4 and to read the release notes of -glibc 2.2.4 whether patches for GCC 3.0 are needed. You can use glibc -2.2.3 with GCC 3.0, just do not try to recompile it. - -@html -<hr /> -@end html -@heading @anchor{ix86-*-linux*oldld}i?86-*-linux*oldld -Use this configuration to generate @file{a.out} binaries on Linux-based -GNU systems if you do not have gas/binutils version 2.5.2 or later -installed. - -This configuration is obsoleted in GCC 3.1. - -@html -<hr /> -@end html -@heading @anchor{ix86-*-linux*aout}i?86-*-linux*aout -Use this configuration to generate @file{a.out} binaries on Linux-based -GNU systems. This configuration is being superseded. You must use -gas/binutils version 2.5.2 or later. - -@html -<hr /> -@end html -@heading @anchor{ix86-*-linux*}i?86-*-linux* - -You will need binutils 2.9.1.0.15 or newer for exception handling to work. - -If you receive Signal 11 errors when building on GNU/Linux, then it is -possible you have a hardware problem. Further information on this can be -found on @uref{http://www.bitwizard.nl/sig11/,,www.bitwizard.nl}. - -@html -<hr /> -@end html -@heading @anchor{ix86-*-sco}i?86-*-sco -Compilation with RCC is recommended. Also, it may be a good idea to -link with GNU malloc instead of the malloc that comes with the system. - -@html -<hr /> -@end html -@heading @anchor{ix86-*-sco3.2v4}i?86-*-sco3.2v4 -Use this configuration for SCO release 3.2 version 4. - -@html -<hr /> -@end html -@heading @anchor{ix86-*-sco3.2v5*}i?86-*-sco3.2v5* -Use this for the SCO OpenServer Release 5 family of operating systems. - -Unlike earlier versions of GCC, the ability to generate COFF with this -target is no longer provided. - -Earlier versions of GCC emitted DWARF 1 when generating ELF to allow -the system debugger to be used. That support was too burdensome to -maintain. GCC now emits only DWARF 2 for this target. This means you -may use either the UDK debugger or GDB to debug programs built by this -version of GCC@. - -Use of the @option{-march=pentiumpro} flag can result in -unrecognized opcodes when using the native assembler on OS versions before -5.0.6. (Support for P6 opcodes was added to the native ELF assembler in -that version.) While it's rather rare to see these emitted by GCC yet, -errors of the basic form: - -@example - /usr/tmp/ccaNlqBc.s:22:unknown instruction: fcomip - /usr/tmp/ccaNlqBc.s:50:unknown instruction: fucomip -@end example - -are symptoms of this problem. You may work around this by not -building affected files with that flag, by using the GNU assembler, or -by using the assembler provided with the current version of the OS@. -Users of GNU assembler should see the note below for hazards on doing -so. - -The native SCO assembler that is provided with the OS at no -charge is normally required. If, however, you must be able to use -the GNU assembler (perhaps you're compiling code with asms that -require GAS syntax) you may configure this package using the flags -@uref{./configure.html#with-gnu-as,,@option{--with-gnu-as}}. You must -use a recent version of GNU binutils; versions past 2.9.1 seem to work -well. - -In general, the @option{--with-gnu-as} option isn't as well tested -as the native assembler. - -Look in @file{gcc/config/i386/sco5.h} (search for ``messy'') for -additional OpenServer-specific flags. - -Systems based on OpenServer before 5.0.4 (@samp{uname -X} -will tell you what you're running) require TLS597 from -@uref{ftp://ftp.sco.com/TLS/,,ftp://ftp.sco.com/TLS/} -for C++ constructors and destructors to work right. - -The system linker in (at least) 5.0.4 and 5.0.5 will sometimes -do the wrong thing for a construct that GCC will emit for PIC -code. This can be seen as execution testsuite failures when using -@option{-fPIC} on @file{921215-1.c}, @file{931002-1.c}, @file{nestfunc-1.c}, and @file{gcov-1.c}. -For 5.0.5, an updated linker that will cure this problem is -available. You must install both -@uref{ftp://ftp.sco.com/Supplements/rs505a/,,ftp://ftp.sco.com/Supplements/rs505a/} -and @uref{ftp://ftp.sco.com/SLS/,,OSS499A}. - -The dynamic linker in OpenServer 5.0.5 (earlier versions may show -the same problem) aborts on certain G77-compiled programs. It's particularly -likely to be triggered by building Fortran code with the @option{-fPIC} flag. -Although it's conceivable that the error could be triggered by other -code, only G77-compiled code has been observed to cause this abort. -If you are getting core dumps immediately upon execution of your -G77 program---and especially if it's compiled with @option{-fPIC}---try applying -@uref{sco_osr5_g77.patch,,@file{sco_osr5_g77.patch}} to your @samp{libf2c} and -rebuilding GCC@. -Affected faults, when analyzed in a debugger, will show a stack -backtrace with a fault occurring in @code{rtld()} and the program -running as @file{/usr/lib/ld.so.1}. This problem has been reported to SCO -engineering and will hopefully be addressed in later releases. - - -@html -<hr /> -@end html -@heading @anchor{ix86-*-udk}i?86-*-udk - -This target emulates the SCO Universal Development Kit and requires that -package be installed. (If it is installed, you will have a -@file{/udk/usr/ccs/bin/cc} file present.) It's very much like the -@samp{i?86-*-unixware7*} target -but is meant to be used when hosting on a system where UDK isn't the -default compiler such as OpenServer 5 or Unixware 2. This target will -generate binaries that will run on OpenServer, Unixware 2, or Unixware 7, -with the same warnings and caveats as the SCO UDK@. - -This target is a little tricky to build because we have to distinguish -it from the native tools (so it gets headers, startups, and libraries -from the right place) while making the tools not think we're actually -building a cross compiler. The easiest way to do this is with a configure -command like this: - -@example - CC=/udk/usr/ccs/bin/cc @var{/your/path/to}/gcc/configure \ - --host=i686-pc-udk --target=i686-pc-udk --program-prefix=udk- -@end example - -@emph{You should substitute @samp{i686} in the above command with the appropriate -processor for your host.} - -After the usual @samp{make bootstrap} and -@samp{make install}, you can then access the UDK-targeted GCC -tools by adding @command{udk-} before the commonly known name. For -example, to invoke the C compiler, you would use @command{udk-gcc}. -They will coexist peacefully with any native-target GCC tools you may -have installed. - - -@html -<hr /> -@end html -@heading @anchor{ix86-*-isc}i?86-*-isc -This configuration is obsoleted in GCC 3.1. - -It may be a good idea to link with GNU malloc instead of the malloc that -comes with the system. - -In ISC version 4.1, @command{sed} core dumps when building -@file{deduced.h}. Use the version of @command{sed} from version 4.0. - -@html -<hr /> -@end html -@heading @anchor{ix86-ibm-aix}i?86-ibm-aix -This configuration is obsoleted in GCC 3.1. - -You need to use GAS version 2.1 or later, and LD from -GNU binutils version 2.2 or later. - -@html -<hr /> -@end html -@heading @anchor{ix86-sequent-bsd}i?86-sequent-bsd -This configuration is obsoleted in GCC 3.1. - -Go to the Berkeley universe before compiling. - -@html -<hr /> -@end html -@heading @anchor{ix86-sequent-ptx1*}i?86-sequent-ptx1*, i?86-sequent-ptx2*, i?86-sequent-sysv3* -This configuration is obsoleted in GCC 3.1. - -You must install GNU @command{sed} before running @command{configure}. - -The @code{fixproto} shell script may trigger a bug in the system shell. -If you encounter this problem, upgrade your operating system or -use @command{bash} (the GNU shell) to run @code{fixproto}. - -@html -<hr /> -@end html -@heading @anchor{i860-intel-osf*}i860-intel-osf* -All support for the i860 processor is obsoleted in GCC 3.1. - -On the Intel Paragon (an i860 machine), if you are using operating -system version 1.0, you will get warnings or errors about redefinition -of @code{va_arg} when you build GCC@. - -If this happens, then you need to link most programs with the library -@file{iclib.a}. You must also modify @file{stdio.h} as follows: before -the lines - -@example -#if defined(__i860__) && !defined(_VA_LIST) -#include <va_list.h> -@end example - -@noindent -insert the line - -@example -#if __PGC__ -@end example - -@noindent -and after the lines - -@example -extern int vprintf(const char *, va_list ); -extern int vsprintf(char *, const char *, va_list ); -#endif -@end example - -@noindent -insert the line - -@example -#endif /* __PGC__ */ -@end example - -These problems don't exist in operating system version 1.1. - -@html -<hr /> -@end html -@heading @anchor{ia64-*-linux}ia64-*-linux -IA-64 processor (also known as IPF, or Itanium Processor Family) -running GNU/Linux. - -The toolchain is not completely finished, so requirements will continue -to change. -GCC 3.0.1 and later require glibc 2.2.4. -GCC 3.0.2 requires binutils from 2001-09-05 or later. -GCC 3.0.1 requires binutils 2.11.1 or later. - -None of the following versions of GCC has an ABI that is compatible -with any of the other versions in this list, with the exception that -Red Hat 2.96 and Trillian 000171 are compatible with each other: -3.0.2, 3.0.1, 3.0, Red Hat 2.96, and Trillian 000717. -This primarily affects C++ programs and programs that create shared libraries. -Because of these ABI incompatibilities, GCC 3.0.2 is not recommended for -user programs on GNU/Linux systems built using earlier compiler releases. -GCC 3.0.2 is recommended for compiling linux, the kernel. -GCC 3.0.2 is believed to be fully ABI compliant, and hence no more major -ABI changes are expected. - -@html -<hr /> -@end html -@heading @anchor{*-lynx-lynxos}*-lynx-lynxos -LynxOS 2.2 and earlier comes with GCC 1.x already installed as -@file{/bin/gcc}. You should compile with this instead of @file{/bin/cc}. -You can tell GCC to use the GNU assembler and linker, by specifying -@samp{--with-gnu-as --with-gnu-ld} when configuring. These will produce -COFF format object files and executables; otherwise GCC will use the -installed tools, which produce @file{a.out} format executables. - -@html -<hr /> -<!-- rs6000-ibm-aix*, powerpc-ibm-aix* --> -@end html -@heading @anchor{*-ibm-aix*}*-ibm-aix* - -AIX Make frequently has problems with GCC makefiles. GNU Make 3.76 or -newer is recommended to build on this platform. - -Errors involving @code{alloca} when building GCC generally are due -to an incorrect definition of @code{CC} in the Makefile or mixing files -compiled with the native C compiler and GCC@. During the stage1 phase of -the build, the native AIX compiler @strong{must} be invoked as @command{cc} -(not @command{xlc}). Once @command{configure} has been informed of -@command{xlc}, one needs to use @samp{make distclean} to remove the -configure cache files and ensure that @env{CC} environment variable -does not provide a definition that will confuse @command{configure}. -If this error occurs during stage2 or later, then the problem most likely -is the version of Make (see above). - -The GNU Assembler incorrectly reports that it supports WEAK symbols on -AIX which causes GCC to try to utilize weak symbol functionality which -is not really supported on the platform. The native @command{as} and -@command{ld} still are recommended. The native AIX tools do -interoperate with GCC@. - -Building @file{libstdc++.a} requires a fix for a AIX Assembler bug -APAR IY26685 (AIX 4.3) or APAR IY25528 (AIX 5.1). - -@samp{libstdc++} in GCC 3.2 increments the major version number of the -shared object and GCC installation places the @file{libstdc++.a} -shared library in a common location which will overwrite the GCC 3.1 -version of the shared library. Applications either need to be -re-linked against the new shared library or the GCC 3.1 version of the -@samp{libstdc++} shared object needs to be available to the AIX -runtime loader. The GCC 3.1 @samp{libstdc++.so.4} shared object can -be installed for runtime dynamic loading using the following steps to -set the @samp{F_LOADONLY} flag in the shared object for @emph{each} -multilib @file{libstdc++.a} installed: - -Extract the shared object from each the GCC 3.1 @file{libstdc++.a} -archive: -@example - % ar -x libstdc++.a libstdc++.so.4 -@end example - -Enable the @samp{F_LOADONLY} flag so that the shared object will be -available for runtime dynamic loading, but not linking: -@example - % strip -e libstdc++.so.4 -@end example - -Archive the runtime-only shared object in the GCC 3.2 -@file{libstdc++.a} archive: -@example - % ar -q libstdc++.a libstdc++.so.4 -@end example - -Linking executables and shared libraries may produce warnings of -duplicate symbols. The assembly files generated by GCC for AIX always -have included multiple symbol definitions for certain global variable -and function declarations in the original program. The warnings should -not prevent the linker from producing a correct library or runnable -executable. - -AIX 4.3 utilizes a ``large format'' archive to support both 32-bit and -64-bit object modules. The routines provided in AIX 4.3.0 and AIX 4.3.1 -to parse archive libraries did not handle the new format correctly. -These routines are used by GCC and result in error messages during -linking such as ``not a COFF file''. The version of the routines shipped -with AIX 4.3.1 should work for a 32-bit environment. The @option{-g} -option of the archive command may be used to create archives of 32-bit -objects using the original ``small format''. A correct version of the -routines is shipped with AIX 4.3.2 and above. - -Some versions of the AIX binder (linker) can fail with a relocation -overflow severe error when the @option{-bbigtoc} option is used to link -GCC-produced object files into an executable that overflows the TOC@. A fix -for APAR IX75823 (OVERFLOW DURING LINK WHEN USING GCC AND -BBIGTOC) is -available from IBM Customer Support and from its -@uref{http://techsupport.services.ibm.com/,,techsupport.services.ibm.com} -website as PTF U455193. - -The AIX 4.3.2.1 linker (bos.rte.bind_cmds Level 4.3.2.1) will dump core -with a segmentation fault when invoked by any version of GCC@. A fix for -APAR IX87327 is available from IBM Customer Support and from its -@uref{http://techsupport.services.ibm.com/,,techsupport.services.ibm.com} -website as PTF U461879. This fix is incorporated in AIX 4.3.3 and above. - -The initial assembler shipped with AIX 4.3.0 generates incorrect object -files. A fix for APAR IX74254 (64BIT DISASSEMBLED OUTPUT FROM COMPILER FAILS -TO ASSEMBLE/BIND) is available from IBM Customer Support and from its -@uref{http://techsupport.services.ibm.com/,,techsupport.services.ibm.com} -website as PTF U453956. This fix is incorporated in AIX 4.3.1 and above. - -AIX provides National Language Support (NLS)@. Compilers and assemblers -use NLS to support locale-specific representations of various data -formats including floating-point numbers (e.g., @samp{.} vs @samp{,} for -separating decimal fractions). There have been problems reported where -GCC does not produce the same floating-point formats that the assembler -expects. If one encounters this problem, set the @env{LANG} -environment variable to @samp{C} or @samp{En_US}. - -By default, GCC for AIX 4.1 and above produces code that can be used on -both Power or PowerPC processors. - -A default can be specified with the @option{-mcpu=@var{cpu_type}} -switch and using the configure option @option{--with-cpu-@var{cpu_type}}. - -@html -<hr /> -@end html -@heading @anchor{m32r-*-elf}m32r-*-elf -Mitsubishi M32R processor. -This configuration is intended for embedded systems. - -@html -<hr /> -@end html -@heading @anchor{m68000-hp-bsd}m68000-hp-bsd -HP 9000 series 200 running BSD@. Note that the C compiler that comes -with this system cannot compile GCC; contact @email{law@@cygnus.com} -to get binaries of GCC for bootstrapping. - -@html -<hr /> -@end html -@heading @anchor{m6811-elf}m6811-elf -Motorola 68HC11 family micro controllers. These are used in embedded -applications. There are no standard Unix configurations. - -@html -<hr /> -@end html -@heading @anchor{m6812-elf}m6812-elf -Motorola 68HC12 family micro controllers. These are used in embedded -applications. There are no standard Unix configurations. - -@html -<hr /> -@end html -@heading @anchor{m68k-altos}m68k-altos -Altos 3068. This configuration is obsoleted in GCC 3.1. - -You must use the GNU assembler, linker and debugger. -Also, you must fix a kernel bug. - -@html -<hr /> -@end html -@heading @anchor{m68k-apple-aux}m68k-apple-aux -Apple Macintosh running A/UX@. -This configuration is obsoleted in GCC 3.1. - -You may configure GCC to use either the system assembler and -linker or the GNU assembler and linker. You should use the GNU configuration -if you can, especially if you also want to use G++. You enable -that configuration with the @option{--with-gnu-as} and @option{--with-gnu-ld} -options to @code{configure}. - -Note the C compiler that comes -with this system cannot compile GCC@. You can find binaries of GCC -for bootstrapping on @code{jagubox.gsfc.nasa.gov}. -You will also a patched version of @file{/bin/ld} there that -raises some of the arbitrary limits found in the original. - -@html -<hr /> -@end html -@heading @anchor{m68k-att-sysv}m68k-att-sysv -AT&T 3b1, a.k.a.@: 7300 PC@. This version of GCC cannot -be compiled with the system C compiler, which is too buggy. -You will need to get a previous version of GCC and use it to -bootstrap. Binaries are available from the OSU-CIS archive, at -@uref{ftp://archive.cis.ohio-state.edu/pub/att7300/}. - -@html -<hr /> -@end html -@heading @anchor{m68k-bull-sysv}m68k-bull-sysv -Bull DPX/2 series 200 and 300 with BOS-2.00.45 up to BOS-2.01. -This configuration is obsoleted in GCC 3.1. - -GCC works -either with native assembler or GNU assembler. You can use -GNU assembler with native COFF generation by providing @option{--with-gnu-as} to -the configure script or use GNU assembler with stabs-in-COFF encapsulation -by providing @samp{--with-gnu-as --stabs}. For any problem with the native -assembler or for availability of the DPX/2 port of GAS, contact -@email{F.Pierresteguy@@frcl.bull.fr}. - -@html -<hr /> -@end html -@heading @anchor{m68k-crds-unos}m68k-crds-unos -Use @samp{configure unos} for building on Unos. - -The Unos assembler is named @code{casm} instead of @code{as}. For some -strange reason linking @file{/bin/as} to @file{/bin/casm} changes the -behavior, and does not work. So, when installing GCC, you should -install the following script as @file{as} in the subdirectory where -the passes of GCC are installed: - -@example -#!/bin/sh -casm $* -@end example - -The default Unos library is named @file{libunos.a} instead of -@file{libc.a}. To allow GCC to function, either change all -references to @option{-lc} in @file{gcc.c} to @option{-lunos} or link -@file{/lib/libc.a} to @file{/lib/libunos.a}. - -@cindex @code{alloca}, for Unos -When compiling GCC with the standard compiler, to overcome bugs in -the support of @code{alloca}, do not use @option{-O} when making stage 2. -Then use the stage 2 compiler with @option{-O} to make the stage 3 -compiler. This compiler will have the same characteristics as the usual -stage 2 compiler on other systems. Use it to make a stage 4 compiler -and compare that with stage 3 to verify proper compilation. - -(Perhaps simply defining @code{ALLOCA} in @file{x-crds} as described in -the comments there will make the above paragraph superfluous. Please -inform us of whether this works.) - -Unos uses memory segmentation instead of demand paging, so you will need -a lot of memory. 5 Mb is barely enough if no other tasks are running. -If linking @file{cc1} fails, try putting the object files into a library -and linking from that library. - -@html -<hr /> -@end html -@heading @anchor{m68k-hp-hpux}m68k-hp-hpux -HP 9000 series 300 or 400 running HP-UX@. HP-UX version 8.0 has a bug in -the assembler that prevents compilation of GCC@. This -bug manifests itself during the first stage of compilation, while -building @file{libgcc2.a}: - -@smallexample -_floatdisf -cc1: warning: `-g' option not supported on this version of GCC -cc1: warning: `-g1' option not supported on this version of GCC -./xgcc: Internal compiler error: program as got fatal signal 11 -@end smallexample - -A patched version of the assembler is available as the file -@uref{ftp://altdorf.ai.mit.edu/archive/cph/hpux-8.0-assembler}. If you -have HP software support, the patch can also be obtained directly from -HP, as described in the following note: - -@quotation -This is the patched assembler, to patch SR#1653-010439, where the -assembler aborts on floating point constants. - -The bug is not really in the assembler, but in the shared library -version of the function ``cvtnum(3c)''. The bug on ``cvtnum(3c)'' is -SR#4701-078451. Anyway, the attached assembler uses the archive -library version of ``cvtnum(3c)'' and thus does not exhibit the bug. -@end quotation - -This patch is also known as PHCO_4484. - -In addition, if you wish to use gas, you must use -gas version 2.1 or later, and you must use the GNU linker version 2.1 or -later. Earlier versions of gas relied upon a program which converted the -gas output into the native HP-UX format, but that program has not been -kept up to date. gdb does not understand that native HP-UX format, so -you must use gas if you wish to use gdb. - -On HP-UX version 8.05, but not on 8.07 or more recent versions, the -@code{fixproto} shell script triggers a bug in the system shell. If you -encounter this problem, upgrade your operating system or use BASH (the -GNU shell) to run @code{fixproto}. This bug will cause the fixproto -program to report an error of the form: - -@example -./fixproto: sh internal 1K buffer overflow -@end example - -To fix this, you can also change the first line of the fixproto script -to look like: - -@example -#!/bin/ksh -@end example - - -@html -<hr /> -@end html -@heading @anchor{m68k-*-nextstep*}m68k-*-nextstep* -These configurations are obsoleted in GCC 3.1. - -Current GCC versions probably do not work on version 2 of the NeXT -operating system. - -On NeXTStep 3.0, the Objective-C compiler does not work, due, -apparently, to a kernel bug that it happens to trigger. This problem -does not happen on 3.1. - -You absolutely @strong{must} use GNU sed and GNU make on this platform. - - -On NeXTSTEP 3.x where x < 3 the build of GCC will abort during -stage1 with an error message like this: - -@example - _eh - /usr/tmp/ccbbsZ0U.s:987:Unknown pseudo-op: .section - /usr/tmp/ccbbsZ0U.s:987:Rest of line ignored. 1st junk character - valued 95 (_). -@end example - -The reason for this is the fact that NeXT's assembler for these -versions of the operating system does not support the @samp{.section} -pseudo op that's needed for full C++ exception functionality. - -As NeXT's assembler is a derived work from GNU as, a free -replacement that does can be obtained at -@uref{ftp://ftp.next.peak.org:/next-ftp/next/apps/devtools/as.3.3.NIHS.s.tar.gz,,ftp://ftp.next.peak.org:/next-ftp/next/apps/devtools/as.3.3.NIHS.s.tar.gz}. - -If you try to build the integrated C++ & C++ runtime libraries on this system -you will run into trouble with include files. The way to get around this is -to use the following sequence. Note you must have write permission to -the directory @var{prefix} you specified in the configuration process of GCC -for this sequence to work. - -@example - cd bld-gcc - make all-texinfo all-bison all-byacc all-binutils all-gas all-ld - cd gcc - make bootstrap - make install-headers-tar - cd .. - make bootstrap3 -@end example - -@html -<hr /> -@end html -@heading @anchor{m68k-ncr-*}m68k-ncr-* -On the Tower models 4@var{n}0 and 6@var{n}0, by default a process is not -allowed to have more than one megabyte of memory. GCC cannot compile -itself (or many other programs) with @option{-O} in that much memory. - -To solve this problem, reconfigure the kernel adding the following line -to the configuration file: - -@smallexample -MAXUMEM = 4096 -@end smallexample - - -@html -<hr /> -@end html -@heading @anchor{m68k-sun}m68k-sun -Sun 3. We do not provide a configuration file to use the Sun FPA by -default, because programs that establish signal handlers for floating -point traps inherently cannot work with the FPA@. - -@html -<hr /> -@end html -@heading @anchor{m68k-sun-sunos4.1.1}m68k-sun-sunos4.1.1 - -It is reported that you may need the GNU assembler on this platform. - - -@html -<hr /> -@end html -@heading @anchor{m88k-*-svr3}m88k-*-svr3 -Motorola m88k running the AT&T/Unisoft/Motorola V.3 reference port. -These configurations are obsoleted in GCC 3.1. - -These systems tend to use the Green Hills C, revision 1.8.5, as the -standard C compiler. There are apparently bugs in this compiler that -result in object files differences between stage 2 and stage 3. If this -happens, make the stage 4 compiler and compare it to the stage 3 -compiler. If the stage 3 and stage 4 object files are identical, this -suggests you encountered a problem with the standard C compiler; the -stage 3 and 4 compilers may be usable. - -It is best, however, to use an older version of GCC for bootstrapping -if you have one. - -@html -<hr /> -@end html -@heading @anchor{m88k-*-dgux}m88k-*-dgux -Motorola m88k running DG/UX@. -These configurations are obsoleted in GCC 3.1. - -To build 88open BCS native or cross -compilers on DG/UX, specify the configuration name as -@samp{m88k-*-dguxbcs} and build in the 88open BCS software development -environment. To build ELF native or cross compilers on DG/UX, specify -@samp{m88k-*-dgux} and build in the DG/UX ELF development environment. -You set the software development environment by issuing -@samp{sde-target} command and specifying either @samp{m88kbcs} or -@samp{m88kdguxelf} as the operand. - -If you do not specify a configuration name, @file{configure} guesses the -configuration based on the current software development environment. - -@html -<hr /> -@end html -@heading @anchor{m88k-tektronix-sysv3}m88k-tektronix-sysv3 -Tektronix XD88 running UTekV 3.2e. -These configurations are obsoleted in GCC 3.1. - -Do not turn on -optimization while building stage1 if you bootstrap with -the buggy Green Hills compiler. Also, the bundled LAI -System V NFS is buggy so if you build in an NFS mounted -directory, start from a fresh reboot, or avoid NFS all together. -Otherwise you may have trouble getting clean comparisons -between stages. - -@html -<hr /> -@end html -@heading @anchor{mips-*-*}mips-*-* -If you use the 1.31 version of the MIPS assembler (such as was shipped -with Ultrix 3.1), you will need to use the @option{-fno-delayed-branch} switch -when optimizing floating point code. Otherwise, the assembler will -complain when the GCC compiler fills a branch delay slot with a -floating point instruction, such as @code{add.d}. - -If on a MIPS system you get an error message saying ``does not have gp -sections for all it's [sic] sectons [sic]'', don't worry about it. This -happens whenever you use GAS with the MIPS linker, but there is not -really anything wrong, and it is okay to use the output file. You can -stop such warnings by installing the GNU linker. - -It would be nice to extend GAS to produce the gp tables, but they are -optional, and there should not be a warning about their absence. - -Users have reported some problems with version 2.0 of the MIPS -compiler tools that were shipped with Ultrix 4.1. Version 2.10 -which came with Ultrix 4.2 seems to work fine. - -Users have also reported some problems with version 2.20 of the -MIPS compiler tools that were shipped with RISC/os 4.x. The earlier -version 2.11 seems to work fine. - -Some versions of the MIPS linker will issue an assertion failure -when linking code that uses @code{alloca} against shared -libraries on RISC-OS 5.0, and DEC's OSF/1 systems. This is a bug -in the linker, that is supposed to be fixed in future revisions. -To protect against this, GCC passes @option{-non_shared} to the -linker unless you pass an explicit @option{-shared} or -@option{-call_shared} switch. - -@heading @anchor{mips-mips-bsd}mips-mips-bsd -MIPS machines running the MIPS operating system in BSD mode. -These configurations are obsoleted in GCC 3.1. - -It's possible that some old versions of the system lack the functions -@code{memcpy}, @code{memmove}, @code{memcmp}, and @code{memset}. If your -system lacks these, you must remove or undo the definition of -@code{TARGET_MEM_FUNCTIONS} in @file{mips-bsd.h}. - -If you use the MIPS C compiler to bootstrap, it may be necessary -to increase its table size for switch statements with the -@option{-Wf,-XNg1500} option. If you use the @option{-O2} -optimization option, you also need to use @option{-Olimit 3000}. -Both of these options are automatically generated in the -@file{Makefile} that the shell script @file{configure} builds. -If you override the @code{CC} make variable and use the MIPS -compilers, you may need to add @option{-Wf,-XNg1500 -Olimit 3000}. - -@html -<hr /> -@end html -@heading @anchor{mips-dec-*}mips-dec-* -These configurations are obsoleted in GCC 3.1. - -MIPS-based DECstations can support three different personalities: -Ultrix, DEC OSF/1, and OSF/rose. (Alpha-based DECstation products have -a configuration name beginning with @samp{alpha*-dec}.) To configure GCC -for these platforms use the following configurations: - -@table @samp -@item mips-dec-ultrix -Ultrix configuration. - -@item mips-dec-osf1 -DEC's version of OSF/1. - -@item mips-dec-osfrose -Open Software Foundation reference port of OSF/1 which uses the -OSF/rose object file format instead of ECOFF@. Normally, you -would not select this configuration. -@end table - -If you use the MIPS C compiler to bootstrap, it may be necessary -to increase its table size for switch statements with the -@option{-Wf,-XNg1500} option. If you use the @option{-O2} -optimization option, you also need to use @option{-Olimit 3000}. -Both of these options are automatically generated in the -@file{Makefile} that the shell script @file{configure} builds. -If you override the @code{CC} make variable and use the MIPS -compilers, you may need to add @option{-Wf,-XNg1500 -Olimit 3000}. - -@html -<hr /> -@end html -@heading @anchor{mips-mips-riscos*}mips-mips-riscos* -These configurations are obsoleted in GCC 3.1. - -If you use the MIPS C compiler to bootstrap, it may be necessary -to increase its table size for switch statements with the -@option{-Wf,-XNg1500} option. If you use the @option{-O2} -optimization option, you also need to use @option{-Olimit 3000}. -Both of these options are automatically generated in the -@file{Makefile} that the shell script @file{configure} builds. -If you override the @code{CC} make variable and use the MIPS -compilers, you may need to add @samp{-Wf,-XNg1500 -Olimit 3000}. - -MIPS computers running RISC-OS can support four different -personalities: default, BSD 4.3, System V.3, and System V.4 -(older versions of RISC-OS don't support V.4). To configure GCC -for these platforms use the following configurations: - -@table @samp -@item mips-mips-riscos@var{rev} -Default configuration for RISC-OS, revision @var{rev}. - -@item mips-mips-riscos@var{rev}bsd -BSD 4.3 configuration for RISC-OS, revision @var{rev}. - -@item mips-mips-riscos@var{rev}sysv4 -System V.4 configuration for RISC-OS, revision @var{rev}. - -@html -<hr /> -@end html -@item mips-mips-riscos@var{rev}sysv -System V.3 configuration for RISC-OS, revision @var{rev}. -@end table - -The revision @code{rev} mentioned above is the revision of -RISC-OS to use. You must reconfigure GCC when going from a -RISC-OS revision 4 to RISC-OS revision 5. This has the effect of -avoiding a linker bug. - -@html -<hr /> -@end html -@heading @anchor{mips-sgi-irix4}mips-sgi-irix4 -This configuration is obsoleted in GCC 3.1. - -In order to compile GCC on an SGI running IRIX 4, the ``c.hdr.lib'' -option must be installed from the CD-ROM supplied from Silicon Graphics. -This is found on the 2nd CD in release 4.0.1. - -On IRIX version 4.0.5F, and perhaps on some other versions as well, -there is an assembler bug that reorders instructions incorrectly. To -work around it, specify the target configuration -@samp{mips-sgi-irix4loser}. This configuration inhibits assembler -optimization. - -In a compiler configured with target @samp{mips-sgi-irix4}, you can turn -off assembler optimization by using the @option{-noasmopt} option. This -compiler option passes the option @option{-O0} to the assembler, to -inhibit reordering. - -The @option{-noasmopt} option can be useful for testing whether a problem -is due to erroneous assembler reordering. Even if a problem does not go -away with @option{-noasmopt}, it may still be due to assembler -reordering---perhaps GCC itself was miscompiled as a result. - -You may get the following warning on IRIX 4 platforms, it can be safely -ignored. -@example - warning: foo.o does not have gp tables for all its sections. -@end example - -@html -<hr /> -@end html -@heading @anchor{mips-sgi-irix5}mips-sgi-irix5 - -This configuration has considerable problems, which will be fixed in a -future release. - -In order to compile GCC on an SGI running IRIX 5, the ``compiler_dev.hdr'' -subsystem must be installed from the IDO CD-ROM supplied by Silicon -Graphics. It is also available for download from -@uref{http://www.sgi.com/developers/devtools/apis/ido.html,,http://www.sgi.com/developers/devtools/apis/ido.html}. - -@code{make compare} may fail on version 5 of IRIX unless you add -@option{-save-temps} to @code{CFLAGS}. On these systems, the name of the -assembler input file is stored in the object file, and that makes -comparison fail if it differs between the @code{stage1} and -@code{stage2} compilations. The option @option{-save-temps} forces a -fixed name to be used for the assembler input file, instead of a -randomly chosen name in @file{/tmp}. Do not add @option{-save-temps} -unless the comparisons fail without that option. If you do you -@option{-save-temps}, you will have to manually delete the @samp{.i} and -@samp{.s} files after each series of compilations. - -If you use the MIPS C compiler to bootstrap, it may be necessary -to increase its table size for switch statements with the -@option{-Wf,-XNg1500} option. If you use the @option{-O2} -optimization option, you also need to use @option{-Olimit 3000}. - -To enable debugging under IRIX 5, you must use GNU @command{as} 2.11.2 -or later, -and use the @option{--with-gnu-as} configure option when configuring GCC. -GNU @command{as} is distributed as part of the binutils package. -When using release 2.11.2, you need to apply a patch -@uref{http://sources.redhat.com/ml/binutils/2001-07/msg00352.html,,http://sources.redhat.com/ml/binutils/2001-07/msg00352.html} -which will be included in the next release of binutils. - -When building GCC, the build process loops rebuilding @command{cc1} over -and over again. This happens on @samp{mips-sgi-irix5.2}, and possibly -other platforms. It has been reported that this is a known bug in the -@command{make} shipped with IRIX 5.2. We recommend you use GNU -@command{make} instead of the vendor supplied @command{make} program; -however, you may have success with @command{smake} on IRIX 5.2 if you do -not have GNU @command{make} available. - -@html -<hr /> -@end html -@heading @anchor{mips-sgi-irix6}mips-sgi-irix6 - -If you are using IRIX @command{cc} as your bootstrap compiler, you must -ensure that the N32 ABI is in use. To test this, compile a simple C -file with @command{cc} and then run @command{file} on the -resulting object file. The output should look like: - -@example -test.o: ELF N32 MSB @dots{} -@end example - -If you see: - -@example -test.o: ELF 32-bit MSB @dots{} -@end example - -or - -@example -test.o: ELF 64-bit MSB @dots{} -@end example - -then your version of @command{cc} uses the O32 or N64 ABI by default. You -should set the environment variable @env{CC} to @samp{cc -n32} -before configuring GCC@. - -If you want the resulting @command{gcc} to run on old 32-bit systems -with the MIPS R4400 CPU, you need to ensure that only code for the mips3 -instruction set architecture (ISA) is generated. While GCC 3.x does -this correctly, both GCC 2.95 and SGI's MIPSpro @command{cc} may change -the ISA depending on the machine where GCC is built. Using one of them -as the bootstrap compiler may result in mips4 code, which won't run at -all on mips3-only systems. For the test program above, you should see: - -@example -test.o: ELF N32 MSB mips-3 @dots{} -@end example - -If you get: - -@example -test.o: ELF N32 MSB mips-4 @dots{} -@end example - -instead, you should set the environment variable @env{CC} to @samp{cc --n32 -mips3} or @samp{gcc -mips3} respectively before configuring GCC@. - -GCC on IRIX 6 is usually built to support both the N32 and N64 ABIs. If -you build GCC on a system that doesn't have the N64 libraries installed, -you need to configure with @option{--disable-multilib} so GCC doesn't -try to use them. Look for @file{/usr/lib64/libc.so.1} to see if you -have the 64-bit libraries installed. - -You must @emph{not} use GNU @command{as} (which isn't built anyway as of -binutils 2.11.2) on IRIX 6 platforms; doing so will only cause problems. - -GCC does not currently support generating O32 ABI binaries in the -@samp{mips-sgi-irix6} configurations. It is possible to create a GCC -with O32 ABI only support by configuring it for the @samp{mips-sgi-irix5} -target and using a patched GNU @command{as} 2.11.2 as documented in the -@uref{#mips-sgi-irix5,,@samp{mips-sgi-irix5}} section above. Using the -native assembler requires patches to GCC which will be included in a -future release. It is -expected that O32 ABI support will be available again in a future release. - -The @option{--enable-threads} option doesn't currently work, a patch is -in preparation for a future release. The @option{--enable-libgcj} -option is disabled by default: IRIX 6 uses a very low default limit -(20480) for the command line length. Although libtool contains a -workaround for this problem, at least the N64 @samp{libgcj} is known not -to build despite this, running into an internal error of the native -@command{ld}. A sure fix is to increase this limit (@samp{ncargs}) to -its maximum of 262144 bytes. If you have root access, you can use the -@command{systune} command to do this. - -GCC does not correctly pass/return structures which are -smaller than 16 bytes and which are not 8 bytes. The problem is very -involved and difficult to fix. It affects a number of other targets also, -but IRIX 6 is affected the most, because it is a 64-bit target, and 4 byte -structures are common. The exact problem is that structures are being padded -at the wrong end, e.g.@: a 4 byte structure is loaded into the lower 4 bytes -of the register when it should be loaded into the upper 4 bytes of the -register. - -GCC is consistent with itself, but not consistent with the SGI C compiler -(and the SGI supplied runtime libraries), so the only failures that can -happen are when there are library functions that take/return such -structures. There are very few such library functions. Currently this -is known to affect @code{inet_ntoa}, @code{inet_lnaof}, -@code{inet_netof}, @code{inet_makeaddr}, and @code{semctl}. Until the -bug is fixed, GCC contains workarounds for the known affected functions. - -See @uref{http://freeware.sgi.com/,,http://freeware.sgi.com/} for more -information about using GCC on IRIX platforms. - -@html -<hr /> -@end html -@heading @anchor{mips-sony-sysv}mips-sony-sysv -Sony MIPS NEWS@. This configuration is obsoleted in GCC 3.1. - -This works in NEWSOS 5.0.1, but not in 5.0.2 (which uses ELF instead of -COFF)@. In particular, the linker does not like the code generated by -GCC when shared libraries are linked in. - -@html -<hr /> -@end html -@heading @anchor{ns32k-encore}ns32k-encore -This configuration is obsoleted in GCC 3.1. - -Encore ns32000 system. Encore systems are supported only under BSD@. - -@html -<hr /> -@end html -@heading @anchor{ns32k-*-genix}ns32k-*-genix -National Semiconductor ns32000 system. This configuration is obsoleted -in GCC 3.1. - -Genix has bugs in @code{alloca} and @code{malloc}; you must get the -compiled versions of these from GNU Emacs. - -@html -<hr /> -@end html -@heading @anchor{ns32k-sequent}ns32k-sequent -This configuration is obsoleted in GCC 3.1. - -Go to the Berkeley universe before compiling. - -@html -<hr /> -@end html -@heading @anchor{ns32k-utek}ns32k-utek -UTEK ns32000 system (``merlin''). This configuration is obsoleted in -GCC 3.1. - -The C compiler that comes with this system cannot compile GCC; contact -@samp{tektronix!reed!mason} to get binaries of GCC for bootstrapping. - - -@html -<hr /> -@end html -@heading @anchor{powerpc*-*-*}powerpc-*-* - -You can specify a default version for the @option{-mcpu=@var{cpu_type}} -switch by using the configure option @option{--with-cpu-@var{cpu_type}}. - -@html -<hr /> -@end html -@heading @anchor{powerpc-*-darwin*}powerpc-*-darwin* -PowerPC running Darwin (Mac OS X kernel). - -GCC 3.0 does not support Darwin, but 3.1 and later releases will work. - -Pre-installed versions of Mac OS X may not include any developer tools, -meaning that you will not be able to build GCC from source. Tool -binaries are available at -@uref{http://www.opensource.apple.com/projects/darwin} (free -registration required). - -Versions of the assembler prior to ``cctools-364'' cannot handle the -4-argument form of @code{rlwinm} and related mask-using instructions. Darwin -1.3 (Mac OS X 10.0) uses cctools-353 for instance. To get cctools-364, -check out @file{cctools} with tag @samp{Apple-364}, build it, and -install the assembler as @file{usr/bin/as}. See -@uref{http://www.opensource.apple.com/tools/cvs/docs.html} for details. - -Also, the default stack limit of 512K is too small, and a bootstrap will -typically fail when self-compiling @file{expr.c}. Set the stack to 800K -or more, for instance by doing @samp{limit stack 800}. It's also -convenient to use the GNU preprocessor instead of Apple's during the -first stage of bootstrapping; this is automatic when doing @samp{make -bootstrap}, but to do it from the toplevel objdir you will need to say -@samp{make CC='cc -no-cpp-precomp' bootstrap}. - -Note that the version of GCC shipped by Apple typically includes a -number of extensions not available in a standard GCC release. These -extensions are generally specific to Mac programming. - -@html -<hr /> -@end html -@heading @anchor{powerpc-*-elf}powerpc-*-elf, powerpc-*-sysv4 -PowerPC system in big endian mode, running System V.4. - -@html -<hr /> -@end html -@heading @anchor{powerpc-*-linux-gnu*}powerpc-*-linux-gnu* - -You will need -@uref{ftp://ftp.kernel.org/pub/linux/devel/binutils,,binutils 2.13.90.0.10} -or newer for a working GCC@. - -@html -<hr /> -@end html -@heading @anchor{powerpc-*-netbsd*}powerpc-*-netbsd* -PowerPC system in big endian mode running NetBSD@. To build the -documentation you will need Texinfo version 4.1 (NetBSD 1.5.1 included -Texinfo version 3.12). - -@html -<hr /> -@end html -@heading @anchor{powerpc-*-eabiaix}powerpc-*-eabiaix -Embedded PowerPC system in big endian mode with @option{-mcall-aix} selected as -the default. - -@html -<hr /> -@end html -@heading @anchor{powerpc-*-eabisim}powerpc-*-eabisim -Embedded PowerPC system in big endian mode for use in running under the -PSIM simulator. - -@html -<hr /> -@end html -@heading @anchor{powerpc-*-eabi}powerpc-*-eabi -Embedded PowerPC system in big endian mode. - -@html -<hr /> -@end html -@heading @anchor{powerpcle-*-elf}powerpcle-*-elf, powerpcle-*-sysv4 -PowerPC system in little endian mode, running System V.4. - -@html -<hr /> -@end html -@heading @anchor{powerpcle-*-eabisim}powerpcle-*-eabisim -Embedded PowerPC system in little endian mode for use in running under -the PSIM simulator. - -@html -<hr /> -@end html -@heading @anchor{powerpcle-*-eabi}powerpcle-*-eabi -Embedded PowerPC system in little endian mode. - -@html -<hr /> -@end html -@heading @anchor{powerpcle-*-winnt}powerpcle-*-winnt, powerpcle-*-pe -PowerPC system in little endian mode running Windows NT@. - -@html -<hr /> -@end html -@heading @anchor{romp-*-aos}romp-*-aos, romp-*-mach -These configurations are obsoleted in GCC 3.1. - -We recommend you compile GCC with an earlier version of itself; if you -compile GCC with @command{hc}, the Metaware compiler, it will work, but -you will get mismatches between the stage 2 and stage 3 compilers in -various files. These errors are minor differences in some -floating-point constants and can be safely ignored; the stage 3 compiler -is correct. - -@html -<hr /> -@end html -@heading @anchor{s390-*-linux*}s390-*-linux* -S/390 system running Linux for S/390@. - -@html -<hr /> -@end html -@heading @anchor{s390x-*-linux*}s390x-*-linux* -zSeries system (64-bit) running Linux for zSeries@. - -@html -<hr /> -@end html -@c Please use Solaris 2 to refer to all release of Solaris, starting -@c with 2.0 until 2.6, 7, and 8. Solaris 1 was a marketing name for -@c SunOS 4 releases which we don't use to avoid confusion. Solaris -@c alone is too unspecific and must be avoided. -@heading @anchor{*-*-solaris2*}*-*-solaris2* - -Sun does not ship a C compiler with Solaris 2. To bootstrap and install -GCC you first have to install a pre-built compiler, see our -@uref{binaries.html,,binaries page} for details. - -The Solaris 2 @command{/bin/sh} will often fail to configure -@file{libstdc++-v3}, @file{boehm-gc} or -@file{libjava}. If you encounter this problem, set @env{CONFIG_SHELL} to -@command{/bin/ksh} in your environment before running @command{configure}. - -Solaris 2 comes with a number of optional OS packages. Some of these -packages are needed to use GCC fully, namely @code{SUNWarc}, -@code{SUNWbtool}, @code{SUNWesu}, @code{SUNWhea}, @code{SUNWlibm}, -@code{SUNWsprot}, and @code{SUNWtoo}. If you did not install all -optional packages when installing Solaris 2, you will need to verify that -the packages that GCC needs are installed. - -To check whether an optional package is installed, use -the @command{pkginfo} command. To add an optional package, use the -@command{pkgadd} command. For further details, see the Solaris 2 -documentation. - -Trying to use the linker and other tools in -@file{/usr/ucb} to install GCC has been observed to cause trouble. -For example, the linker may hang indefinitely. The fix is to remove -@file{/usr/ucb} from your @env{PATH}. - -All releases of GNU binutils prior to 2.11.2 have known bugs on this -platform. We recommend the use of GNU binutils 2.11.2 or the vendor -tools (Sun @command{as}, Sun @command{ld}). - -Sun bug 4296832 turns up when compiling X11 headers with GCC 2.95 or -newer: @command{g++} will complain that types are missing. These headers assume -that omitting the type means @code{int}; this assumption worked for C89 but -is wrong for C++, and is now wrong for C99 also. - -@command{g++} accepts such (invalid) constructs with the option -@option{-fpermissive}; it -will assume that any missing type is @code{int} (as defined by C89). - -There are patches for Solaris 2.6 (105633-56 or newer for SPARC, -106248-42 or newer for Intel), Solaris 7 (108376-21 or newer for SPARC, -108377-20 for Intel), and Solaris 8 (108652-24 or newer for SPARC, -108653-22 for Intel) that fix this bug. - -@html -<hr /> -@end html -@heading @anchor{sparc-sun-solaris2*}sparc-sun-solaris2* - -When GCC is configured to use binutils 2.11.2 or later the binaries -produced are smaller than the ones produced using Sun's native tools; -this difference is quite significant for binaries containing debugging -information. - -Sun @command{as} 4.x is broken in that it cannot cope with long symbol names. -A typical error message might look similar to the following: - -@smallexample -/usr/ccs/bin/as: "/var/tmp/ccMsw135.s", line 11041: error: - can't compute value of an expression involving an external symbol. -@end smallexample - -This is Sun bug 4237974. This is fixed with patch 108908-02 for Solaris -2.6 and has been fixed in later (5.x) versions of the assembler, -starting with Solaris 7. - -Starting with Solaris 7, the operating system is capable of executing -64-bit SPARC V9 binaries. GCC 3.1 and later properly supports -this; the @option{-m64} option enables 64-bit code generation. -However, if all you want is code tuned for the UltraSPARC CPU, you -should try the @option{-mtune=ultrasparc} option instead, which produces -code that, unlike full 64-bit code, can still run on non-UltraSPARC -machines. - -When configuring on a Solaris 7 or later system that is running a kernel -that supports only 32-bit binaries, one must configure with -@option{--disable-multilib}, since we will not be able to build the -64-bit target libraries. - -@html -<hr /> -@end html -@heading @anchor{sparc-sun-solaris2.7}sparc-sun-solaris2.7 - -Sun patch 107058-01 (1999-01-13) for Solaris 7/SPARC triggers a bug in -the dynamic linker. This problem (Sun bug 4210064) affects GCC 2.8 -and later, including all EGCS releases. Sun formerly recommended -107058-01 for all Solaris 7 users, but around 1999-09-01 it started to -recommend it only for people who use Sun's compilers. - -Here are some workarounds to this problem: -@itemize @bullet -@item -Do not install Sun patch 107058-01 until after Sun releases a -complete patch for bug 4210064. This is the simplest course to take, -unless you must also use Sun's C compiler. Unfortunately 107058-01 -is preinstalled on some new Solaris 7-based hosts, so you may have to -back it out. - -@item -Copy the original, unpatched Solaris 7 -@command{/usr/ccs/bin/as} into -@command{/usr/local/lib/gcc-lib/sparc-sun-solaris2.7/3.1/as}, -adjusting the latter name to fit your local conventions and software -version numbers. - -@item -Install Sun patch 106950-03 (1999-05-25) or later. Nobody with -both 107058-01 and 106950-03 installed has reported the bug with GCC -and Sun's dynamic linker. This last course of action is riskiest, -for two reasons. First, you must install 106950 on all hosts that -run code generated by GCC; it doesn't suffice to install it only on -the hosts that run GCC itself. Second, Sun says that 106950-03 is -only a partial fix for bug 4210064, but Sun doesn't know whether the -partial fix is adequate for GCC@. Revision -08 or later should fix -the bug. The current (as of 2001-09-24) revision is -14, and is included in -the Solaris 7 Recommended Patch Cluster. -@end itemize - - -@html -<p> -<hr /> -@end html -@heading @anchor{sparc-sun-sunos4*}sparc-sun-sunos4* - -A bug in the SunOS 4 linker will cause it to crash when linking -@option{-fPIC} compiled objects (and will therefore not allow you to build -shared libraries). - -To fix this problem you can either use the most recent version of -binutils or get the latest SunOS 4 linker patch (patch ID 100170-10) -from Sun's patch site. - -Sometimes on a Sun 4 you may observe a crash in the program -@command{genflags} or @command{genoutput} while building GCC. This is said to -be due to a bug in @command{sh}. You can probably get around it by running -@command{genflags} or @command{genoutput} manually and then retrying the -@command{make}. - -@html -<hr /> -@end html -@heading @anchor{sparc-unknown-linux-gnulibc1}sparc-unknown-linux-gnulibc1 - -It has been reported that you might need -@uref{ftp://ftp.yggdrasil.com/private/hjl,,binutils 2.8.1.0.23} -for this platform, too. - - -@html -<hr /> -@end html -@heading @anchor{sparc-*-linux*}sparc-*-linux* - -GCC versions 3.0 and higher require binutils 2.11.2 and glibc 2.2.4 -or newer on this platform. All earlier binutils and glibc -releases mishandled unaligned relocations on @code{sparc-*-*} targets. - - -@html -<hr /> -@end html -@heading @anchor{sparc64-*-*}sparc64-*-* - -GCC version 2.95 is not able to compile code correctly for -@code{sparc64} targets. Users of the Linux kernel, at least, -can use the @code{sparc32} program to start up a new shell -invocation with an environment that causes @command{configure} to -recognize (via @samp{uname -a}) the system as @samp{sparc-*-*} instead. - -@html -<hr /> -@end html -@heading @anchor{sparcv9-*-solaris2*}sparcv9-*-solaris2* - -The following compiler flags must be specified in the configure -step in order to bootstrap this target with the Sun compiler: - -@example - % CC="cc -xildoff -xarch=v9" @var{srcdir}/configure [@var{options}] [@var{target}] -@end example - -@option{-xildoff} turns off the incremental linker, and @option{-xarch=v9} -specifies the v9 architecture to the Sun linker and assembler. - -@html -<hr /> -@end html -@heading @anchor{#*-*-sysv*}*-*-sysv* -On System V release 3, you may get this error message -while linking: - -@smallexample -ld fatal: failed to write symbol name @var{something} - in strings table for file @var{whatever} -@end smallexample - -This probably indicates that the disk is full or your ulimit won't allow -the file to be as large as it needs to be. - -This problem can also result because the kernel parameter @code{MAXUMEM} -is too small. If so, you must regenerate the kernel and make the value -much larger. The default value is reported to be 1024; a value of 32768 -is said to work. Smaller values may also work. - -On System V, if you get an error like this, - -@example -/usr/local/lib/bison.simple: In function `yyparse': -/usr/local/lib/bison.simple:625: virtual memory exhausted -@end example - -@noindent -that too indicates a problem with disk space, ulimit, or @code{MAXUMEM}. - -On a System V release 4 system, make sure @file{/usr/bin} precedes -@file{/usr/ucb} in @code{PATH}. The @code{cc} command in -@file{/usr/ucb} uses libraries which have bugs. - -@html -<hr /> -@end html -@heading @anchor{vax-dec-ultrix}vax-dec-ultrix -Don't try compiling with VAX C (@code{vcc}). It produces incorrect code -in some cases (for example, when @code{alloca} is used). - -@html -<hr /> -@end html -@heading @anchor{we32k-*-*}we32k-*-* -These computers are also known as the 3b2, 3b5, 3b20 and other similar -names. (However, the 3b1 is actually a 68000.) -These configurations are obsoleted in GCC 3.1. - -Don't use @option{-g} when compiling with the system's compiler. The -system's linker seems to be unable to handle such a large program with -debugging information. - -The system's compiler runs out of capacity when compiling @file{stmt.c} -in GCC@. You can work around this by building @file{cpp} in GCC -first, then use that instead of the system's preprocessor with the -system's C compiler to compile @file{stmt.c}. Here is how: - -@smallexample -mv /lib/cpp /lib/cpp.att -cp cpp /lib/cpp.gnu -echo '/lib/cpp.gnu -traditional $@{1+"$@@"@}' > /lib/cpp -chmod +x /lib/cpp -@end smallexample - -The system's compiler produces bad code for some of the GCC -optimization files. So you must build the stage 2 compiler without -optimization. Then build a stage 3 compiler with optimization. -That executable should work. Here are the necessary commands: - -@smallexample -make LANGUAGES=c CC=stage1/xgcc CFLAGS="-Bstage1/ -g" -make stage2 -make CC=stage2/xgcc CFLAGS="-Bstage2/ -g -O" -@end smallexample - -You may need to raise the ULIMIT setting to build a C++ compiler, -as the file @file{cc1plus} is larger than one megabyte. - -@html -<hr /> -@end html -@heading @anchor{xtensa-*-elf}xtensa-*-elf - -This target is intended for embedded Xtensa systems using the -@samp{newlib} C library. It uses ELF but does not support shared -objects. Designed-defined instructions specified via the -Tensilica Instruction Extension (TIE) language are only supported -through inline assembly. - -The Xtensa configuration information must be specified prior to -building GCC@. The @file{gcc/config/xtensa/xtensa-config.h} header -file contains the configuration information. If you created your -own Xtensa configuration with the Xtensa Processor Generator, the -downloaded files include a customized copy of this header file, -which you can use to replace the default header file. - -@html -<hr /> -@end html -@heading @anchor{xtensa-*-linux*}xtensa-*-linux* - -This target is for Xtensa systems running GNU/Linux. It supports ELF -shared objects and the GNU C library (glibc). It also generates -position-independent code (PIC) regardless of whether the -@option{-fpic} or @option{-fPIC} options are used. In other -respects, this target is the same as the -@uref{#xtensa-*-elf,,@samp{xtensa-*-elf}} target. - -@html -<hr /> -@end html -@heading @anchor{windows}Microsoft Windows (32-bit) - -A port of GCC 2.95.x is included with the -@uref{http://www.cygwin.com/,,Cygwin environment}. - -Current (as of early 2001) snapshots of GCC will build under Cygwin -without modification. - -@html -<hr /> -@end html -@heading @anchor{os2}OS/2 - -GCC does not currently support OS/2. However, Andrew Zabolotny has been -working on a generic OS/2 port with pgcc. The current code can be found -at @uref{http://www.goof.com/pcg/os2/,,http://www.goof.com/pcg/os2/}. - -An older copy of GCC 2.8.1 is included with the EMX tools available at -@uref{ftp://ftp.leo.org/pub/comp/os/os2/leo/devtools/emx+gcc/,, -ftp://ftp.leo.org/pub/comp/os/os2/leo/devtools/emx+gcc/}. - -@html -<hr /> -@end html -@heading @anchor{older}Older systems - -GCC contains support files for many older (1980s and early -1990s) Unix variants. For the most part, support for these systems -has not been deliberately removed, but it has not been maintained for -several years and may suffer from bitrot. Support from some systems -has been removed from GCC 3: fx80, ns32-ns-genix, pyramid, tahoe, -gmicro, spur; most of these targets had not been updated since GCC -version 1. - -We are planning to remove support for more older systems, starting in -GCC 3.1. Each release will have a list of ``obsoleted'' systems. -Support for these systems is still present in that release, but -@command{configure} will fail unless the @option{--enable-obsolete} -option is given. Unless a maintainer steps forward, support for -these systems will be removed from the next release of GCC@. - -Support for older systems as targets for cross-compilation is less -problematic than support for them as hosts for GCC; if an enthusiast -wishes to make such a target work again (including resurrecting any -of the targets that never worked with GCC 2, starting from the last -CVS version before they were removed), patches -@uref{../contribute.html,,following the usual requirements} -would be likely to be accepted, since they should not affect the -support for more modern targets. - -Support for old systems as hosts for GCC can cause problems if the -workarounds for compiler, library and operating system bugs affect the -cleanliness or maintainability of the rest of GCC@. In some cases, to -bring GCC up on such a system, if still possible with current GCC, may -require first installing an old version of GCC which did work on that -system, and using it to compile a more recent GCC, to avoid bugs in -the vendor compiler. Old releases of GCC 1 and GCC 2 are available in -the @file{old-releases} directory on the -@uref{../mirrors.html,,GCC mirror sites}. Header bugs may generally -be avoided using @command{fixincludes}, but bugs or deficiencies in -libraries and the operating system may still cause problems. - -For some systems, old versions of GNU binutils may also be useful, -and are available from @file{pub/binutils/old-releases} on -@uref{http://sources.redhat.com/mirrors.html,,sources.redhat.com mirror sites}. - -Some of the information on specific systems above relates to -such older systems, but much of the information -about GCC on such systems (which may no longer be applicable to -current GCC) is to be found in the GCC texinfo manual. - -@html -<hr /> -@end html -@heading @anchor{elf_targets}all ELF targets (SVR4, Solaris 2, etc.) - -C++ support is significantly better on ELF targets if you use the -@uref{./configure.html#with-gnu-ld,,GNU linker}; duplicate copies of -inlines, vtables and template instantiations will be discarded -automatically. - - -@html -<hr /> -<p> -@end html -@ifhtml -@uref{./index.html,,Return to the GCC Installation page} -@end ifhtml -@end ifset - -@c ***Old documentation****************************************************** -@ifset oldhtml -@include install-old.texi -@html -<hr /> -<p> -@end html -@ifhtml -@uref{./index.html,,Return to the GCC Installation page} -@end ifhtml -@end ifset - -@c ***GFDL******************************************************************** -@ifset gfdlhtml -@include fdl.texi -@html -<hr /> -<p> -@end html -@ifhtml -@uref{./index.html,,Return to the GCC Installation page} -@end ifhtml -@end ifset - -@c *************************************************************************** -@c Part 6 The End of the Document -@ifinfo -@comment node-name, next, previous, up -@node Concept Index, , GNU Free Documentation License, Top -@end ifinfo - -@ifinfo -@unnumbered Concept Index - -@printindex cp - -@contents -@end ifinfo -@bye diff --git a/contrib/gcc/doc/install.texi2html b/contrib/gcc/doc/install.texi2html deleted file mode 100755 index 3917e2a..0000000 --- a/contrib/gcc/doc/install.texi2html +++ /dev/null @@ -1,31 +0,0 @@ -#!/bin/sh -# -# Convert the GCC install documentation from texinfo format to HTML. -# -# $SOURCEDIR and $DESTDIR, resp., refer to the directory containing -# the texinfo source and the directory to put the HTML version in. -# -# (C) 2001 Free Software Foundation -# Originally by Gerald Pfeifer <pfeifer@dbai.tuwien.ac.at>, June 2001. -# -# This script is Free Software, and it can be copied, distributed and -# modified as defined in the GNU General Public License. A copy of -# its license can be downloaded from http://www.gnu.org/copyleft/gpl.html - -SOURCEDIR=${SOURCEDIR-.} -DESTDIR=${DESTDIR-HTML} - -MAKEINFO=${MAKEINFO-makeinfo} - -if [ ! -d $DESTDIR ]; then - mkdir -p $DESTDIR -fi - -for x in index.html specific.html download.html configure.html \ - build.html test.html finalinstall.html binaries.html old.html \ - gfdl.html -do - define=`echo $x | sed -e 's/\.//g'` - echo "define = $define" - $MAKEINFO -I $SOURCEDIR -I $SOURCEDIR/include $SOURCEDIR/install.texi --html --no-split -D$define -o$DESTDIR/$x -done diff --git a/contrib/gcc/doschk.c b/contrib/gcc/doschk.c deleted file mode 100644 index d024efc..0000000 --- a/contrib/gcc/doschk.c +++ /dev/null @@ -1,360 +0,0 @@ -/* -** DosFCheck - check file names for DOS consistency -** -** Distribute freely, it only encourages DOS compatibility! -** - DJ Delorie -*/ - -/* This file is not part of GCC. */ - -#include <stdio.h> -#ifdef __MSDOS__ -#include <alloc.h> -#else -#include <malloc.h> -#endif -#include <ctype.h> -#include <string.h> - -typedef struct ENT -{ - struct ENT *next; - char *dos_name; - char *full_name; - char *path; - int tagged; -} ENT; - -ENT *eroot = 0; - -int first_inv = 1; -int first_msg = 1; - -/****************************************************************\ - * Utility routines * -\****************************************************************/ - -void -invalid_msg () -{ - if (first_inv) - { - if (first_msg) - first_msg = 0; - else - putchar ('\n'); - printf ("The following files are not valid DOS file names:\n"); - first_inv = 0; - } -} - -ENT * -alloc_ent () -{ - ENT *rv = (ENT *)malloc (sizeof (ENT)); - if (rv == 0) - { - fprintf (stderr, "Unable to allocate memory for an ENT\n"); - exit (1); - } - memset (rv, 0, sizeof (ENT)); - return rv; -} - -void -fill_ent (ent, path) -ENT *ent; -char *path; -{ - char *first = path; - char *null = path+strlen (path); - char *last_slash = strrchr (path, '/'); - char *cp, *dp; - int dots_seen, chars_seen; - - if (last_slash+1 == null) - { - * --null = '\0'; - last_slash = strrchr (path, '/'); - } - - if (!last_slash) - { - last_slash = first-1; - } - - if (null-last_slash < 13) - ent->dos_name = (char *)malloc (null-last_slash); - else - ent->dos_name = (char *)malloc (13); - ent->full_name = (char *)malloc (null-last_slash); - ent->path = (char *)malloc (last_slash-first+1); - - strcpy (ent->full_name, last_slash+1); - if (last_slash > first) - { - strncpy (ent->path, first, last_slash-first); - ent->path[last_slash-first] = '\0'; - } - else - *ent->path = '\0'; - - cp = last_slash+1; - dp = ent->dos_name; - dots_seen = 0; - chars_seen = 0; - while (1) - { - if (! *cp) - break; - switch (*cp) - { - case '.': - if (cp == last_slash+1 && strcmp (last_slash+1, ".")) - { - invalid_msg (); - printf ("%s - file name cannot start with dot\n", path); - *dp = 0; - break; - } - if (dots_seen == 1) - { - invalid_msg (); - printf ("%s - too many dots\n", path); - *dp = '\0'; - break; - } - *dp++ = '.'; - chars_seen = 0; - dots_seen++; - break; - case '"': - case '*': - case '+': - case ',': - case ';': - case '<': - case '=': - case '>': - case '?': - case '[': - case '\\': - case ']': - case '|': - invalid_msg (); - printf ("%s - invalid character `%c'\n", path, *cp); - *dp++ = '?'; - chars_seen++; - break; - default: - if (dots_seen) - { - if (chars_seen >= 3) - break; - } - else - if (chars_seen >= 8) - break; - if ((*cp <= ' ') || (*cp >= 0x7f)) - { - invalid_msg (); - printf ("%s - invalid character `%c'\n", path, *cp); - *dp++ = '?'; - chars_seen++; - break; - } - if (islower (*cp)) - *dp++ = toupper (*cp); - else - *dp++ = *cp; - chars_seen++; - break; - } - cp++; - } - *dp++ = '\0'; -} - -int -compare_ent_dosname (e1, e2) -ENT **e1; -ENT **e2; -{ - int r = strcmp ((*e1)->dos_name, (*e2)->dos_name); - if (r == 0) - r = strcmp ((*e1)->path, (*e2)->path); - if (r == 0) - r = strcmp ((*e1)->full_name, (*e2)->full_name); - return r; -} - -int -compare_ent_fullname (e1, e2) -ENT **e1; -ENT **e2; -{ - int r = strncmp ((*e1)->full_name, (*e2)->full_name, 14); - if (r == 0) - r = strcmp ((*e1)->path, (*e2)->path); - if (r == 0) - r = strcmp ((*e1)->full_name, (*e2)->full_name); - return r; -} - -char * -mpath (ent) -ENT *ent; -{ - static char buf[500]; - if (ent->path && ent->path[0]) - sprintf (buf, "%s/%s", ent->path, ent->full_name); - else - return ent->full_name; - return buf; -} - -/****************************************************************\ - * List handling routines * -\****************************************************************/ - -void -add_ent (ent) -ENT *ent; -{ - ent->next = eroot; - eroot = ent; -} - -void -handle_input (line) -char *line; -{ - ENT *ent = alloc_ent (); - fill_ent (ent, line); - add_ent (ent); -} - -void -display_problems () -{ - ENT **elist, *ent; - int ecount, i, first, first_err; - - for (ecount=0, ent=eroot; ent; ent=ent->next, ecount++); - elist = (ENT **)malloc (sizeof (ENT *) * ecount); - for (ecount=0, ent=eroot; ent; ent=ent->next, ecount++) - elist[ecount] = ent; - - qsort (elist, ecount, sizeof (ENT *), compare_ent_dosname); - - first = 1; - first_err = 1; - for (i=0; i<ecount-1; i++) - { - if ((strcmp (elist[i]->dos_name, elist[i+1]->dos_name) == 0) - && (strcmp (elist[i]->path, elist[i+1]->path) == 0)) - { - if (first_err) - { - if (first_msg) - first_msg = 0; - else - putchar ('\n'); - printf ("The following resolve to the same DOS file names:\n"); - first_err = 0; - } - if (first) - { - printf ("%14s : %s\n", elist[i]->dos_name, mpath (elist[i])); - first = 0; - } - printf ("\t\t %s\n", mpath (elist[i+1])); - } - else - first = 1; - } - - qsort (elist, ecount, sizeof (ENT *), compare_ent_fullname); - - first = 1; - first_err = 1; - for (i=0; i<ecount-1; i++) - { - if ((strncmp (elist[i]->full_name, elist[i+1]->full_name, 14) == 0) - && (strcmp (elist[i]->path, elist[i+1]->path) == 0)) - { - if (first_err) - { - if (first_msg) - first_msg = 0; - else - putchar ('\n'); - printf ("The following resolve to the same SysV file names:\n"); - first_err = 0; - } - if (first) - { - printf ("%.14s : %s\n", elist[i]->full_name, mpath (elist[i])); - first = 0; - elist[i]->tagged = 1; - } - printf ("\t\t %s\n", mpath (elist[i+1])); - elist[i+1]->tagged = 1; - } - else - first = 1; - } - - first_err = 1; - for (i=0; i<ecount; i++) - { - if ((strlen (elist[i]->full_name) > 14) && !elist[i]->tagged) - { - if (first_err) - { - if (first_msg) - first_msg = 0; - else - putchar ('\n'); - printf ("The following file names are too long for SysV:\n"); - first_err = 0; - } - printf ("%.14s : %s\n", elist[i]->full_name, mpath (elist[i])); - } - } -} - -/****************************************************************\ - * Main entry point * -\****************************************************************/ - -main (argc, argv) -int argc; -char **argv; -{ - FILE *input = stdin; - if (argc > 1) - { - input = fopen (argv[1], "r"); - if (!input) - { - perror (argv[1]); - exit (1); - } - } - while (1) - { - char line[500]; - char *lp; - fgets (line, 500, input); - if (feof (input)) - break; - lp = line+strlen (line); - while ((lp != line) && (*lp <= ' ')) - lp--; - lp[1] = 0; - handle_input (line); - } - display_problems (); -} - diff --git a/contrib/gcc/f/README b/contrib/gcc/f/README deleted file mode 100644 index fdebfdc..0000000 --- a/contrib/gcc/f/README +++ /dev/null @@ -1,7 +0,0 @@ -1995-02-15 - -This directory is the f/ subdirectory, which is designed to -be a subdirectory in a gcc development tree, i.e. named gcc/f/. - -Please see gcc/README.g77 for information on the contents of this -directory. diff --git a/contrib/gcc/f/lang-options.h b/contrib/gcc/f/lang-options.h deleted file mode 100644 index b2821ed..0000000 --- a/contrib/gcc/f/lang-options.h +++ /dev/null @@ -1,239 +0,0 @@ -/* lang-options.h file for Fortran - Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000 Free Software Foundation, Inc. - Contributed by James Craig Burley. - -This file is part of GNU Fortran. - -GNU Fortran 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 Fortran 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 Fortran; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA -02111-1307, USA. - -*/ - -/* This is the contribution to the `documented_lang_options' array in - toplev.c for g77. */ - -#ifdef __STDC__ /* To be consistent with lang-specs.h. Maybe avoid - overflowing some old compiler's tables, etc. */ - -DEFINE_LANG_NAME ("Fortran") - - { "-fversion", - N_("Print g77-specific compiler version info, run internal tests") }, -/*"-fident",*/ -/*"-fno-ident",*/ - { "-ff66", - N_("Program is written in typical FORTRAN 66 dialect") }, - { "-fno-f66", "" }, - { "-ff77", - N_("Program is written in typical Unix f77 dialect") }, - { "-fno-f77", - N_("Program does not use Unix-f77 dialectal features") }, - { "-ff90", - N_("Program is written in Fortran-90-ish dialect") }, - { "-fno-f90", "" }, - { "-fautomatic", "" }, - { "-fno-automatic", - N_("Treat local vars and COMMON blocks as if they were named in SAVE statements") }, - { "-fdollar-ok", - N_("Allow $ in symbol names") }, - { "-fno-dollar-ok", "" }, - { "-ff2c", "" }, - { "-fno-f2c", - N_("f2c-compatible code need not be generated") }, - { "-ff2c-library", "" }, - { "-fno-f2c-library", - N_("Unsupported; do not generate libf2c-calling code") }, - { "-fflatten-arrays", - N_("Unsupported; affects code-generation of arrays") }, - { "-fno-flatten-arrays", "" }, - { "-ffree-form", - N_("Program is written in Fortran-90-ish free form") }, - { "-fno-free-form", "" }, - { "-ffixed-form", "" }, - { "-fno-fixed-form", "" }, - { "-fpedantic", - N_("Warn about use of (only a few for now) Fortran extensions") }, - { "-fno-pedantic", "" }, - { "-fvxt", - N_("Program is written in VXT (Digital-like) FORTRAN") }, - { "-fno-vxt", "" }, - { "-fno-ugly", - N_("Disallow all ugly features") }, - { "-fugly-args", "" }, - { "-fno-ugly-args", - N_("Hollerith and typeless constants not passed as arguments") }, - { "-fugly-assign", - N_("Allow ordinary copying of ASSIGN'ed vars") }, - { "-fno-ugly-assign", "" }, - { "-fugly-assumed", - N_("Dummy array dimensioned to (1) is assumed-size") }, - { "-fno-ugly-assumed", "" }, - { "-fugly-comma", - N_("Trailing comma in procedure call denotes null argument") }, - { "-fno-ugly-comma", "" }, - { "-fugly-complex", - N_("Allow REAL(Z) and AIMAG(Z) given DOUBLE COMPLEX Z") }, - { "-fno-ugly-complex", "" }, - { "-fugly-init", "" }, - { "-fno-ugly-init", - N_("Initialization via DATA and PARAMETER is type-compatible") }, - { "-fugly-logint", - N_("Allow INTEGER and LOGICAL interchangeability") }, - { "-fno-ugly-logint", "" }, - { "-fxyzzy", - N_("Print internal debugging-related info") }, - { "-fno-xyzzy", "" }, - { "-finit-local-zero", - N_("Initialize local vars and arrays to zero") }, - { "-fno-init-local-zero", "" }, - { "-fbackslash", "" }, - { "-fno-backslash", - N_("Backslashes in character/hollerith constants not special (C-style)") }, - { "-femulate-complex", - N_("Have front end emulate COMPLEX arithmetic to avoid bugs") }, - { "-fno-emulate-complex", "" }, - { "-funderscoring", "" }, - { "-fno-underscoring", - N_("Disable the appending of underscores to externals") }, - { "-fsecond-underscore", "" }, - { "-fno-second-underscore", - N_("Never append a second underscore to externals") }, - { "-fintrin-case-initcap", - N_("Intrinsics spelled as e.g. SqRt") }, - { "-fintrin-case-upper", - N_("Intrinsics in uppercase") }, - { "-fintrin-case-lower", "" }, - { "-fintrin-case-any", - N_("Intrinsics letters in arbitrary cases") }, - { "-fmatch-case-initcap", - N_("Language keywords spelled as e.g. IOStat") }, - { "-fmatch-case-upper", - N_("Language keywords in uppercase") }, - { "-fmatch-case-lower", "" }, - { "-fmatch-case-any", - N_("Language keyword letters in arbitrary cases") }, - { "-fsource-case-upper", - N_("Internally convert most source to uppercase") }, - { "-fsource-case-lower", "" }, - { "-fsource-case-preserve", - N_("Internally preserve source case") }, - { "-fsymbol-case-initcap", - N_("Symbol names spelled in mixed case") }, - { "-fsymbol-case-upper", - N_("Symbol names in uppercase") }, - { "-fsymbol-case-lower", - N_("Symbol names in lowercase") }, - { "-fsymbol-case-any", "" }, - { "-fcase-strict-upper", - N_("Program written in uppercase") }, - { "-fcase-strict-lower", - N_("Program written in lowercase") }, - { "-fcase-initcap", - N_("Program written in strict mixed-case") }, - { "-fcase-upper", - N_("Compile as if program written in uppercase") }, - { "-fcase-lower", - N_("Compile as if program written in lowercase") }, - { "-fcase-preserve", - N_("Preserve all spelling (case) used in program") }, - { "-fbadu77-intrinsics-delete", - N_("Delete libU77 intrinsics with bad interfaces") }, - { "-fbadu77-intrinsics-disable", - N_("Disable libU77 intrinsics with bad interfaces") }, - { "-fbadu77-intrinsics-enable", "" }, - { "-fbadu77-intrinsics-hide", - N_("Hide libU77 intrinsics with bad interfaces") }, - { "-ff2c-intrinsics-delete", - N_("Delete non-FORTRAN-77 intrinsics f2c supports") }, - { "-ff2c-intrinsics-disable", - N_("Disable non-FORTRAN-77 intrinsics f2c supports") }, - { "-ff2c-intrinsics-enable", "" }, - { "-ff2c-intrinsics-hide", - N_("Hide non-FORTRAN-77 intrinsics f2c supports") }, - { "-ff90-intrinsics-delete", - N_("Delete non-FORTRAN-77 intrinsics F90 supports") }, - { "-ff90-intrinsics-disable", - N_("Disable non-FORTRAN-77 intrinsics F90 supports") }, - { "-ff90-intrinsics-enable", "" }, - { "-ff90-intrinsics-hide", - N_("Hide non-FORTRAN-77 intrinsics F90 supports") }, - { "-fgnu-intrinsics-delete", - N_("Delete non-FORTRAN-77 intrinsics g77 supports") }, - { "-fgnu-intrinsics-disable", - N_("Disable non-FORTRAN 77 intrinsics F90 supports") }, - { "-fgnu-intrinsics-enable", "" }, - { "-fgnu-intrinsics-hide", - N_("Hide non-FORTRAN 77 intrinsics F90 supports") }, - { "-fmil-intrinsics-delete", - N_("Delete MIL-STD 1753 intrinsics") }, - { "-fmil-intrinsics-disable", - N_("Disable MIL-STD 1753 intrinsics") }, - { "-fmil-intrinsics-enable", "" }, - { "-fmil-intrinsics-hide", - N_("Hide MIL-STD 1753 intrinsics") }, - { "-funix-intrinsics-delete", - N_("Delete libU77 intrinsics") }, - { "-funix-intrinsics-disable", - N_("Disable libU77 intrinsics") }, - { "-funix-intrinsics-enable", "" }, - { "-funix-intrinsics-hide", - N_("Hide libU77 intrinsics") }, - { "-fvxt-intrinsics-delete", - N_("Delete non-FORTRAN-77 intrinsics VXT FORTRAN supports") }, - { "-fvxt-intrinsics-disable", - N_("Disable non-FORTRAN-77 intrinsics VXT FORTRAN supports") }, - { "-fvxt-intrinsics-enable", "" }, - { "-fvxt-intrinsics-hide", - N_("Hide non-FORTRAN-77 intrinsics VXT FORTRAN supports") }, - { "-fzeros", - N_("Treat initial values of 0 like non-zero values") }, - { "-fno-zeros", "" }, - { "-fdebug-kludge", - N_("Emit special debugging information for COMMON and EQUIVALENCE (disabled)") }, - { "-fno-debug-kludge", "" }, - { "-fonetrip", - N_("Take at least one trip through each iterative DO loop") }, - { "-fno-onetrip", "" }, - { "-fsilent", "" }, - { "-fno-silent", - N_("Print names of program units as they are compiled") }, - { "-fglobals", "" }, - { "-fno-globals", - N_("Disable fatal diagnostics about inter-procedural problems") }, - { "-ftypeless-boz", - N_("Make prefix-radix non-decimal constants be typeless") }, - { "-fno-typeless-boz", "" }, - { "-fbounds-check", - N_("Generate code to check subscript and substring bounds") }, - { "-fno-bounds-check", "" }, - { "-ffortran-bounds-check", - N_("Fortran-specific form of -fbounds-check") }, - { "-fno-fortran-bounds-check", "" }, - { "-Wglobals", "" }, - { "-Wno-globals", - N_("Disable warnings about inter-procedural problems") }, -/*"-Wimplicit",*/ -/*"-Wno-implicit",*/ - { "-Wsurprising", - N_("Warn about constructs with surprising meanings") }, - { "-Wno-surprising", "" }, -/*"-Wall",*/ -/* Prefix options. */ - { "-I", - N_("Add a directory for INCLUDE searching") }, - { "-ffixed-line-length-", - N_("Set the maximum line length") }, - -#endif diff --git a/contrib/gcc/floatlib.c b/contrib/gcc/floatlib.c deleted file mode 100644 index 929aef7..0000000 --- a/contrib/gcc/floatlib.c +++ /dev/null @@ -1,944 +0,0 @@ -/* -** libgcc support for software floating point. -** Copyright (C) 1991 by Pipeline Associates, Inc. All rights reserved. -** Permission is granted to do *anything* you want with this file, -** commercial or otherwise, provided this message remains intact. So there! -** I would appreciate receiving any updates/patches/changes that anyone -** makes, and am willing to be the repository for said changes (am I -** making a big mistake?). - -Warning! Only single-precision is actually implemented. This file -won't really be much use until double-precision is supported. - -However, once that is done, this file might make possible -cross-compilation for an IEEE target machine from a non-IEEE -host such as a VAX. - -If you'd like to work on completing this, please talk to rms@gnu.ai.mit.edu. - ---> Double precision floating support added by James Carlson on 20 April 1998. - -** -** Pat Wood -** Pipeline Associates, Inc. -** pipeline!phw@motown.com or -** sun!pipeline!phw or -** uunet!motown!pipeline!phw -** -** 05/01/91 -- V1.0 -- first release to gcc mailing lists -** 05/04/91 -- V1.1 -- added float and double prototypes and return values -** -- fixed problems with adding and subtracting zero -** -- fixed rounding in truncdfsf2 -** -- fixed SWAP define and tested on 386 -*/ - -/* -** The following are routines that replace the libgcc soft floating point -** routines that are called automatically when -msoft-float is selected. -** The support single and double precision IEEE format, with provisions -** for byte-swapped machines (tested on 386). Some of the double-precision -** routines work at full precision, but most of the hard ones simply punt -** and call the single precision routines, producing a loss of accuracy. -** long long support is not assumed or included. -** Overall accuracy is close to IEEE (actually 68882) for single-precision -** arithmetic. I think there may still be a 1 in 1000 chance of a bit -** being rounded the wrong way during a multiply. I'm not fussy enough to -** bother with it, but if anyone is, knock yourself out. -** -** Efficiency has only been addressed where it was obvious that something -** would make a big difference. Anyone who wants to do this right for -** best speed should go in and rewrite in assembler. -** -** I have tested this only on a 68030 workstation and 386/ix integrated -** in with -msoft-float. -*/ - -/* the following deal with IEEE single-precision numbers */ -#define EXCESS 126 -#define SIGNBIT 0x80000000 -#define HIDDEN (1 << 23) -#define SIGN(fp) ((fp) & SIGNBIT) -#define EXP(fp) (((fp) >> 23) & 0xFF) -#define MANT(fp) (((fp) & 0x7FFFFF) | HIDDEN) -#define PACK(s,e,m) ((s) | ((e) << 23) | (m)) - -/* the following deal with IEEE double-precision numbers */ -#define EXCESSD 1022 -#define HIDDEND (1 << 20) -#define EXPD(fp) (((fp.l.upper) >> 20) & 0x7FF) -#define SIGND(fp) ((fp.l.upper) & SIGNBIT) -#define MANTD(fp) (((((fp.l.upper) & 0xFFFFF) | HIDDEND) << 10) | \ - (fp.l.lower >> 22)) -#define HIDDEND_LL ((long long)1 << 52) -#define MANTD_LL(fp) ((fp.ll & (HIDDEND_LL-1)) | HIDDEND_LL) -#define PACKD_LL(s,e,m) (((long long)((s)+((e)<<20))<<32)|(m)) - -/* define SWAP for 386/960 reverse-byte-order brain-damaged CPUs */ -union double_long { - double d; -#ifdef SWAP - struct { - unsigned long lower; - long upper; - } l; -#else - struct { - long upper; - unsigned long lower; - } l; -#endif - long long ll; -}; - -union float_long - { - float f; - long l; - }; - -/* add two floats */ -float -__addsf3 (float a1, float a2) -{ - long mant1, mant2; - union float_long fl1, fl2; - int exp1, exp2; - int sign = 0; - - fl1.f = a1; - fl2.f = a2; - - /* check for zero args */ - if (!fl1.l) { - fl1.f = fl2.f; - goto test_done; - } - if (!fl2.l) - goto test_done; - - exp1 = EXP (fl1.l); - exp2 = EXP (fl2.l); - - if (exp1 > exp2 + 25) - goto test_done; - if (exp2 > exp1 + 25) { - fl1.f = fl2.f; - goto test_done; - } - - /* do everything in excess precision so's we can round later */ - mant1 = MANT (fl1.l) << 6; - mant2 = MANT (fl2.l) << 6; - - if (SIGN (fl1.l)) - mant1 = -mant1; - if (SIGN (fl2.l)) - mant2 = -mant2; - - if (exp1 > exp2) - { - mant2 >>= exp1 - exp2; - } - else - { - mant1 >>= exp2 - exp1; - exp1 = exp2; - } - mant1 += mant2; - - if (mant1 < 0) - { - mant1 = -mant1; - sign = SIGNBIT; - } - else if (!mant1) { - fl1.f = 0; - goto test_done; - } - - /* normalize up */ - while (!(mant1 & 0xE0000000)) - { - mant1 <<= 1; - exp1--; - } - - /* normalize down? */ - if (mant1 & (1 << 30)) - { - mant1 >>= 1; - exp1++; - } - - /* round to even */ - mant1 += (mant1 & 0x40) ? 0x20 : 0x1F; - - /* normalize down? */ - if (mant1 & (1 << 30)) - { - mant1 >>= 1; - exp1++; - } - - /* lose extra precision */ - mant1 >>= 6; - - /* turn off hidden bit */ - mant1 &= ~HIDDEN; - - /* pack up and go home */ - fl1.l = PACK (sign, exp1, mant1); -test_done: - return (fl1.f); -} - -/* subtract two floats */ -float -__subsf3 (float a1, float a2) -{ - union float_long fl1, fl2; - - fl1.f = a1; - fl2.f = a2; - - /* check for zero args */ - if (!fl2.l) - return (fl1.f); - if (!fl1.l) - return (-fl2.f); - - /* twiddle sign bit and add */ - fl2.l ^= SIGNBIT; - return __addsf3 (a1, fl2.f); -} - -/* compare two floats */ -long -__cmpsf2 (float a1, float a2) -{ - union float_long fl1, fl2; - - fl1.f = a1; - fl2.f = a2; - - if (SIGN (fl1.l) && SIGN (fl2.l)) - { - fl1.l ^= SIGNBIT; - fl2.l ^= SIGNBIT; - } - if (fl1.l < fl2.l) - return (-1); - if (fl1.l > fl2.l) - return (1); - return (0); -} - -/* multiply two floats */ -float -__mulsf3 (float a1, float a2) -{ - union float_long fl1, fl2; - unsigned long result; - int exp; - int sign; - - fl1.f = a1; - fl2.f = a2; - - if (!fl1.l || !fl2.l) { - fl1.f = 0; - goto test_done; - } - - /* compute sign and exponent */ - sign = SIGN (fl1.l) ^ SIGN (fl2.l); - exp = EXP (fl1.l) - EXCESS; - exp += EXP (fl2.l); - - fl1.l = MANT (fl1.l); - fl2.l = MANT (fl2.l); - - /* the multiply is done as one 16x16 multiply and two 16x8 multiples */ - result = (fl1.l >> 8) * (fl2.l >> 8); - result += ((fl1.l & 0xFF) * (fl2.l >> 8)) >> 8; - result += ((fl2.l & 0xFF) * (fl1.l >> 8)) >> 8; - - result >>= 2; - if (result & 0x20000000) - { - /* round */ - result += 0x20; - result >>= 6; - } - else - { - /* round */ - result += 0x10; - result >>= 5; - exp--; - } - if (result & (HIDDEN<<1)) { - result >>= 1; - exp++; - } - - result &= ~HIDDEN; - - /* pack up and go home */ - fl1.l = PACK (sign, exp, result); -test_done: - return (fl1.f); -} - -/* divide two floats */ -float -__divsf3 (float a1, float a2) -{ - union float_long fl1, fl2; - int result; - int mask; - int exp, sign; - - fl1.f = a1; - fl2.f = a2; - - /* subtract exponents */ - exp = EXP (fl1.l) - EXP (fl2.l) + EXCESS; - - /* compute sign */ - sign = SIGN (fl1.l) ^ SIGN (fl2.l); - - /* divide by zero??? */ - if (!fl2.l) - /* return NaN or -NaN */ - return (sign ? 0xFFFFFFFF : 0x7FFFFFFF); - - /* numerator zero??? */ - if (!fl1.l) - return (0); - - /* now get mantissas */ - fl1.l = MANT (fl1.l); - fl2.l = MANT (fl2.l); - - /* this assures we have 25 bits of precision in the end */ - if (fl1.l < fl2.l) - { - fl1.l <<= 1; - exp--; - } - - /* now we perform repeated subtraction of fl2.l from fl1.l */ - mask = 0x1000000; - result = 0; - while (mask) - { - if (fl1.l >= fl2.l) - { - result |= mask; - fl1.l -= fl2.l; - } - fl1.l <<= 1; - mask >>= 1; - } - - /* round */ - result += 1; - - /* normalize down */ - exp++; - result >>= 1; - - result &= ~HIDDEN; - - /* pack up and go home */ - fl1.l = PACK (sign, exp, result); - return (fl1.f); -} - -/* convert int to double */ -double -__floatsidf (long a1) -{ - int sign = 0, exp = 31 + EXCESSD; - union double_long dl; - - if (!a1) - { - dl.l.upper = dl.l.lower = 0; - return (dl.d); - } - - if (a1 < 0) - { - sign = SIGNBIT; - a1 = -a1; - } - - while (a1 < 0x1000000) - { - a1 <<= 4; - exp -= 4; - } - - while (a1 < 0x40000000) - { - a1 <<= 1; - exp--; - } - - /* pack up and go home */ - dl.l.upper = sign; - dl.l.upper |= exp << 20; - dl.l.upper |= (a1 >> 10) & ~HIDDEND; - dl.l.lower = a1 << 22; - - return (dl.d); -} - -double -__floatdidf (long long a1) -{ - int exp = 63 + EXCESSD; - union double_long dl; - - dl.l.upper = dl.l.lower = 0; - if (a1 == 0) - return (dl.d); - - if (a1 < 0) { - dl.l.upper = SIGNBIT; - a1 = -a1; - } - - while (a1 < (long long)1<<54) { - a1 <<= 8; - exp -= 8; - } - while (a1 < (long long)1<<62) { - a1 <<= 1; - exp -= 1; - } - - /* pack up and go home */ - dl.ll |= (a1 >> 10) & ~HIDDEND_LL; - dl.l.upper |= exp << 20; - - return (dl.d); -} - -float -__floatsisf (long a1) -{ - (float)__floatsidf(a1); -} - -float -__floatdisf (long long a1) -{ - (float)__floatdidf(a1); -} - -/* negate a float */ -float -__negsf2 (float a1) -{ - union float_long fl1; - - fl1.f = a1; - if (!fl1.l) - return (0); - - fl1.l ^= SIGNBIT; - return (fl1.f); -} - -/* negate a double */ -double -__negdf2 (double a1) -{ - union double_long dl1; - - dl1.d = a1; - - if (!dl1.l.upper && !dl1.l.lower) - return (dl1.d); - - dl1.l.upper ^= SIGNBIT; - return (dl1.d); -} - -/* convert float to double */ -double -__extendsfdf2 (float a1) -{ - union float_long fl1; - union double_long dl; - int exp; - - fl1.f = a1; - - if (!fl1.l) - { - dl.l.upper = dl.l.lower = 0; - return (dl.d); - } - - dl.l.upper = SIGN (fl1.l); - exp = EXP (fl1.l) - EXCESS + EXCESSD; - dl.l.upper |= exp << 20; - dl.l.upper |= (MANT (fl1.l) & ~HIDDEN) >> 3; - dl.l.lower = MANT (fl1.l) << 29; - - return (dl.d); -} - -/* convert double to float */ -float -__truncdfsf2 (double a1) -{ - int exp; - long mant; - union float_long fl; - union double_long dl1; - - dl1.d = a1; - - if (!dl1.l.upper && !dl1.l.lower) - return (float)(0); - - exp = EXPD (dl1) - EXCESSD + EXCESS; - - /* shift double mantissa 6 bits so we can round */ - mant = MANTD (dl1) >> 6; - - /* now round and shift down */ - mant += 1; - mant >>= 1; - - /* did the round overflow? */ - if (mant & 0xFE000000) - { - mant >>= 1; - exp++; - } - - mant &= ~HIDDEN; - - /* pack up and go home */ - fl.l = PACK (SIGND (dl1), exp, mant); - return (fl.f); -} - -/* compare two doubles */ -long -__cmpdf2 (double a1, double a2) -{ - union double_long dl1, dl2; - - dl1.d = a1; - dl2.d = a2; - - if (SIGND (dl1) && SIGND (dl2)) - { - dl1.l.upper ^= SIGNBIT; - dl2.l.upper ^= SIGNBIT; - } - if (dl1.l.upper < dl2.l.upper) - return (-1); - if (dl1.l.upper > dl2.l.upper) - return (1); - if (dl1.l.lower < dl2.l.lower) - return (-1); - if (dl1.l.lower > dl2.l.lower) - return (1); - return (0); -} - -/* convert double to int */ -long -__fixdfsi (double a1) -{ - union double_long dl1; - int exp; - long l; - - dl1.d = a1; - - if (!dl1.l.upper && !dl1.l.lower) - return (0); - - exp = EXPD (dl1) - EXCESSD - 31; - l = MANTD (dl1); - - if (exp > 0) - return SIGND(dl1) ? (1<<31) : ((1ul<<31)-1); - - /* shift down until exp = 0 or l = 0 */ - if (exp < 0 && exp > -32 && l) - l >>= -exp; - else - return (0); - - return (SIGND (dl1) ? -l : l); -} - -/* convert double to int */ -long long -__fixdfdi (double a1) -{ - union double_long dl1; - int exp; - long long l; - - dl1.d = a1; - - if (!dl1.l.upper && !dl1.l.lower) - return (0); - - exp = EXPD (dl1) - EXCESSD - 64; - l = MANTD_LL(dl1); - - if (exp > 0) { - l = (long long)1<<63; - if (!SIGND(dl1)) - l--; - return l; - } - - /* shift down until exp = 0 or l = 0 */ - if (exp < 0 && exp > -64 && l) - l >>= -exp; - else - return (0); - - return (SIGND (dl1) ? -l : l); -} - -/* convert double to unsigned int */ -unsigned long -__fixunsdfsi (double a1) -{ - union double_long dl1; - int exp; - unsigned long l; - - dl1.d = a1; - - if (!dl1.l.upper && !dl1.l.lower) - return (0); - - exp = EXPD (dl1) - EXCESSD - 32; - l = (((((dl1.l.upper) & 0xFFFFF) | HIDDEND) << 11) | (dl1.l.lower >> 21)); - - if (exp > 0) - return (0xFFFFFFFFul); /* largest integer */ - - /* shift down until exp = 0 or l = 0 */ - if (exp < 0 && exp > -32 && l) - l >>= -exp; - else - return (0); - - return (l); -} - -/* convert double to unsigned int */ -unsigned long long -__fixunsdfdi (double a1) -{ - union double_long dl1; - int exp; - unsigned long long l; - - dl1.d = a1; - - if (dl1.ll == 0) - return (0); - - exp = EXPD (dl1) - EXCESSD - 64; - - l = dl1.ll; - - if (exp > 0) - return (unsigned long long)-1; - - /* shift down until exp = 0 or l = 0 */ - if (exp < 0 && exp > -64 && l) - l >>= -exp; - else - return (0); - - return (l); -} - -/* addtwo doubles */ -double -__adddf3 (double a1, double a2) -{ - long long mant1, mant2; - union double_long fl1, fl2; - int exp1, exp2; - int sign = 0; - - fl1.d = a1; - fl2.d = a2; - - /* check for zero args */ - if (!fl2.ll) - goto test_done; - if (!fl1.ll) { - fl1.d = fl2.d; - goto test_done; - } - - exp1 = EXPD(fl1); - exp2 = EXPD(fl2); - - if (exp1 > exp2 + 54) - goto test_done; - if (exp2 > exp1 + 54) { - fl1.d = fl2.d; - goto test_done; - } - - /* do everything in excess precision so's we can round later */ - mant1 = MANTD_LL(fl1) << 9; - mant2 = MANTD_LL(fl2) << 9; - - if (SIGND(fl1)) - mant1 = -mant1; - if (SIGND(fl2)) - mant2 = -mant2; - - if (exp1 > exp2) - mant2 >>= exp1 - exp2; - else { - mant1 >>= exp2 - exp1; - exp1 = exp2; - } - mant1 += mant2; - - if (mant1 < 0) { - mant1 = -mant1; - sign = SIGNBIT; - } else if (!mant1) { - fl1.d = 0; - goto test_done; - } - - /* normalize up */ - while (!(mant1 & ((long long)7<<61))) { - mant1 <<= 1; - exp1--; - } - - /* normalize down? */ - if (mant1 & ((long long)3<<62)) { - mant1 >>= 1; - exp1++; - } - - /* round to even */ - mant1 += (mant1 & (1<<9)) ? (1<<8) : ((1<<8)-1); - - /* normalize down? */ - if (mant1 & ((long long)3<<62)) { - mant1 >>= 1; - exp1++; - } - - /* lose extra precision */ - mant1 >>= 9; - - /* turn off hidden bit */ - mant1 &= ~HIDDEND_LL; - - /* pack up and go home */ - fl1.ll = PACKD_LL(sign,exp1,mant1); - -test_done: - return (fl1.d); -} - -/* subtract two doubles */ -double -__subdf3 (double a1, double a2) -{ - union double_long fl1, fl2; - - fl1.d = a1; - fl2.d = a2; - - /* check for zero args */ - if (!fl2.ll) - return (fl1.d); - /* twiddle sign bit and add */ - fl2.l.upper ^= SIGNBIT; - if (!fl1.ll) - return (fl2.d); - return __adddf3 (a1, fl2.d); -} - -/* multiply two doubles */ -double -__muldf3 (double a1, double a2) -{ - union double_long fl1, fl2; - unsigned long long result; - int exp; - int sign; - - fl1.d = a1; - fl2.d = a2; - - if (!fl1.ll || !fl2.ll) { - fl1.d = 0; - goto test_done; - } - - /* compute sign and exponent */ - sign = SIGND(fl1) ^ SIGND(fl2); - exp = EXPD(fl1) - EXCESSD; - exp += EXPD(fl2); - - fl1.ll = MANTD_LL(fl1); - fl2.ll = MANTD_LL(fl2); - - /* the multiply is done as one 31x31 multiply and two 31x21 multiples */ - result = (fl1.ll >> 21) * (fl2.ll >> 21); - result += ((fl1.ll & 0x1FFFFF) * (fl2.ll >> 21)) >> 21; - result += ((fl2.ll & 0x1FFFFF) * (fl1.ll >> 21)) >> 21; - - result >>= 2; - if (result & ((long long)1<<61)) { - /* round */ - result += 1<<8; - result >>= 9; - } else { - /* round */ - result += 1<<7; - result >>= 8; - exp--; - } - if (result & (HIDDEND_LL<<1)) { - result >>= 1; - exp++; - } - - result &= ~HIDDEND_LL; - - /* pack up and go home */ - fl1.ll = PACKD_LL(sign,exp,result); -test_done: - return (fl1.d); -} - -/* divide two doubles */ -double -__divdf3 (double a1, double a2) -{ - union double_long fl1, fl2; - long long mask,result; - int exp, sign; - - fl1.d = a1; - fl2.d = a2; - - /* subtract exponents */ - exp = EXPD(fl1) - EXPD(fl2) + EXCESSD; - - /* compute sign */ - sign = SIGND(fl1) ^ SIGND(fl2); - - /* numerator zero??? */ - if (fl1.ll == 0) { - /* divide by zero??? */ - if (fl2.ll == 0) - fl1.ll = ((unsigned long long)1<<63)-1; /* NaN */ - else - fl1.ll = 0; - goto test_done; - } - - /* return +Inf or -Inf */ - if (fl2.ll == 0) { - fl1.ll = PACKD_LL(SIGND(fl1),2047,0); - goto test_done; - } - - - /* now get mantissas */ - fl1.ll = MANTD_LL(fl1); - fl2.ll = MANTD_LL(fl2); - - /* this assures we have 54 bits of precision in the end */ - if (fl1.ll < fl2.ll) { - fl1.ll <<= 1; - exp--; - } - - /* now we perform repeated subtraction of fl2.ll from fl1.ll */ - mask = (long long)1<<53; - result = 0; - while (mask) { - if (fl1.ll >= fl2.ll) - { - result |= mask; - fl1.ll -= fl2.ll; - } - fl1.ll <<= 1; - mask >>= 1; - } - - /* round */ - result += 1; - - /* normalize down */ - exp++; - result >>= 1; - - result &= ~HIDDEND_LL; - - /* pack up and go home */ - fl1.ll = PACKD_LL(sign, exp, result); - -test_done: - return (fl1.d); -} - -int -__gtdf2 (double a1, double a2) -{ - return __cmpdf2 ((float) a1, (float) a2) > 0; -} - -int -__gedf2 (double a1, double a2) -{ - return (__cmpdf2 ((float) a1, (float) a2) >= 0) - 1; -} - -int -__ltdf2 (double a1, double a2) -{ - return - (__cmpdf2 ((float) a1, (float) a2) < 0); -} - -int -__ledf2 (double a1, double a2) -{ - return __cmpdf2 ((float) a1, (float) a2) > 0; -} - -int -__eqdf2 (double a1, double a2) -{ - return *(long long *) &a1 == *(long long *) &a2; -} - -int -__nedf2 (double a1, double a2) -{ - return *(long long *) &a1 != *(long long *) &a2; -} diff --git a/contrib/gcc/future.options b/contrib/gcc/future.options deleted file mode 100644 index 6654dd0b..0000000 --- a/contrib/gcc/future.options +++ /dev/null @@ -1,40 +0,0 @@ -From: friedman@gnu.ai.mit.edu (Noah Friedman) -To: roland@gnu.ai.mit.edu (Roland McGrath), - rms@gnu.ai.mit.edu (Richard Stallman), - jimb@gnu.ai.mit.edu (Jim Blandy), - mib@gnu.ai.mit.edu (Michael Bushnell) -Cc: cgw@sol.acs.unt.edu (chris williams), - clc@gnu.ai.mit.edu (Christian Longshore Claiborn) -Subject: Some gcc options we'd like to see. -Date: Mon, 28 Jun 93 00:45:09 EST -Reply-To: friedman@gnu.ai.mit.edu - --Waggravate-return --Wcast-spell --Wcaste-align --Win --Wmissing-protons --Wredundant-repetitions --antsy --fbungee-jump --fexpensive-operations --fextra-strength --fjesus-saves --fkeep-programmers-inline --fno-peeping-toms --fruit-roll-ups --fshort-enough --mno-dialogue --pedophile --vomit-frame-pointer - -From: Alexandre Oliva <aoliva@redhat.com> -Date: 06 Jan 2002 17:37:07 -0200 - -On Jan 2, 2002, in a long, heated thread concerning the interpretation -of certain passages of the C standard, jtv <jtv@xs4all.nl> wrote: - -> (Yes, I'm a pedant. I'm pining for the day when gcc will support the -> options "-ffascist -Wanal") - -How about introducing the options `-flame -War' :-) diff --git a/contrib/gcc/location.h b/contrib/gcc/location.h deleted file mode 100644 index 1864f29..0000000 --- a/contrib/gcc/location.h +++ /dev/null @@ -1,38 +0,0 @@ -/* Definition of location data type used in various part of GCC - Copyright (C) 2002 Free Software Foundation, Inc. - Contributed by Gabriel Dos Reis <gdr@codesourcery.com> - -This program is free software; you can redistribute it and/or modify it -under the terms of the GNU General Public License as published by the -Free Software Foundation; either version 2, or (at your option) any -later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - - In other words, you are welcome to use, share and improve this program. - You are forbidden to forbid anyone else to use, share and improve - what you give them. Help stamp out software-hoarding! */ - -#ifndef GCC_LOCATION_H -#define GCC_LOCATION_H - -/* The data structure used to record a location in a translation unit. */ -struct location_s GTY (()) -{ - /* The name of the source file involved. */ - const char *file; - - /* The line-location in the source file. */ - int line; -}; -typedef struct location_s location_t; - -#endif - diff --git a/contrib/gcc/mbchar.c b/contrib/gcc/mbchar.c deleted file mode 100644 index 4251736..0000000 --- a/contrib/gcc/mbchar.c +++ /dev/null @@ -1,334 +0,0 @@ -/* Multibyte Character Functions. - Copyright (C) 1998 Free Software Foundation, Inc. - -This file is part of GCC. - -GCC is free software; you can redistribute it and/or modify it under -the terms of the GNU General Public License as published by the Free -Software Foundation; either version 2, or (at your option) any later -version. - -GCC is distributed in the hope that it will be useful, but WITHOUT ANY -WARRANTY; without even the implied warranty of MERCHANTABILITY or -FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -for more details. - -You should have received a copy of the GNU General Public License -along with GCC; see the file COPYING. If not, write to the Free -Software Foundation, 59 Temple Place - Suite 330, Boston, MA -02111-1307, USA. */ - -/* Note regarding cross compilation: - - In general, translation of multibyte characters to wide characters can - only work in a native compiler since the translation function (mbtowc) - needs to know about both the source and target character encoding. However, - this particular implementation for JIS, SJIS and EUCJP source characters - will work for any compiler with a newlib target. Other targets may also - work provided that their wchar_t implementation is 2 bytes and the encoding - leaves the source character values unchanged (except for removing the - state shifting markers). */ - -#include "config.h" -#ifdef MULTIBYTE_CHARS -#include "system.h" -#include "mbchar.h" -#include <locale.h> - -typedef enum {ESCAPE, DOLLAR, BRACKET, AT, B, J, NUL, JIS_CHAR, OTHER, - JIS_C_NUM} JIS_CHAR_TYPE; - -typedef enum {ASCII, A_ESC, A_ESC_DL, JIS, JIS_1, JIS_2, J_ESC, J_ESC_BR, - J2_ESC, J2_ESC_BR, INV, JIS_S_NUM} JIS_STATE; - -typedef enum {COPYA, COPYJ, COPYJ2, MAKE_A, MAKE_J, NOOP, - EMPTY, ERROR} JIS_ACTION; - -/* State/action tables for processing JIS encoding: - - Where possible, switches to JIS are grouped with proceding JIS characters - and switches to ASCII are grouped with preceding JIS characters. - Thus, maximum returned length is: - 2 (switch to JIS) + 2 (JIS characters) + 2 (switch back to ASCII) = 6. */ - -static const JIS_STATE JIS_state_table[JIS_S_NUM][JIS_C_NUM] = { -/* ESCAPE DOLLAR BRACKET AT B J NUL JIS_CHAR OTH*/ -/*ASCII*/ { A_ESC, ASCII, ASCII, ASCII, ASCII, ASCII, ASCII,ASCII,ASCII}, -/*A_ESC*/ { ASCII, A_ESC_DL,ASCII, ASCII, ASCII, ASCII, ASCII,ASCII,ASCII}, -/*A_ESC_DL*/{ ASCII, ASCII, ASCII, JIS, JIS, ASCII, ASCII,ASCII,ASCII}, -/*JIS*/ { J_ESC, JIS_1, JIS_1, JIS_1, JIS_1, JIS_1, INV, JIS_1,INV }, -/*JIS_1*/ { INV, JIS_2, JIS_2, JIS_2, JIS_2, JIS_2, INV, JIS_2,INV }, -/*JIS_2*/ { J2_ESC,JIS, JIS, JIS, JIS, JIS, INV, JIS, JIS }, -/*J_ESC*/ { INV, INV, J_ESC_BR, INV, INV, INV, INV, INV, INV }, -/*J_ESC_BR*/{ INV, INV, INV, INV, ASCII, ASCII, INV, INV, INV }, -/*J2_ESC*/ { INV, INV, J2_ESC_BR,INV, INV, INV, INV, INV, INV }, -/*J2_ESC_BR*/{INV, INV, INV, INV, ASCII, ASCII, INV, INV, INV }, -}; - -static const JIS_ACTION JIS_action_table[JIS_S_NUM][JIS_C_NUM] = { -/* ESCAPE DOLLAR BRACKET AT B J NUL JIS_CHAR OTH */ -/*ASCII */ {NOOP, COPYA, COPYA, COPYA, COPYA, COPYA, EMPTY, COPYA, COPYA}, -/*A_ESC */ {COPYA, NOOP, COPYA, COPYA, COPYA, COPYA, COPYA, COPYA, COPYA}, -/*A_ESC_DL */{COPYA, COPYA, COPYA, MAKE_J, MAKE_J, COPYA, COPYA, COPYA, COPYA}, -/*JIS */ {NOOP, NOOP, NOOP, NOOP, NOOP, NOOP, ERROR, NOOP, ERROR}, -/*JIS_1 */ {ERROR, NOOP, NOOP, NOOP, NOOP, NOOP, ERROR, NOOP, ERROR}, -/*JIS_2 */ {NOOP, COPYJ2,COPYJ2,COPYJ2, COPYJ2, COPYJ2,ERROR, COPYJ2,COPYJ2}, -/*J_ESC */ {ERROR, ERROR, NOOP, ERROR, ERROR, ERROR, ERROR, ERROR, ERROR}, -/*J_ESC_BR */{ERROR, ERROR, ERROR, ERROR, NOOP, NOOP, ERROR, ERROR, ERROR}, -/*J2_ESC */ {ERROR, ERROR, NOOP, ERROR, ERROR, ERROR, ERROR, ERROR, ERROR}, -/*J2_ESC_BR*/{ERROR, ERROR, ERROR, ERROR, COPYJ, COPYJ, ERROR, ERROR, ERROR}, -}; - - -const char *literal_codeset = NULL; - -/* Store into *PWC (if PWC is not null) the wide character - corresponding to the multibyte character at the start of the - buffer S of size N. Return the number of bytes in the multibyte - character. Return -1 if the bytes do not form a valid character, - or 0 if S is null or points to a null byte. - - This function behaves like the Standard C function mbtowc, except - it treats locale names of the form "C-..." specially. */ - -int -local_mbtowc (pwc, s, n) - wchar_t *pwc; - const char *s; - size_t n; -{ - static JIS_STATE save_state = ASCII; - JIS_STATE curr_state = save_state; - const unsigned char *t = (const unsigned char *) s; - - if (s != NULL && n == 0) - return -1; - - if (literal_codeset == NULL || strlen (literal_codeset) <= 1) - /* This must be the "C" locale or unknown locale -- fall thru */ - ; - else if (! strcmp (literal_codeset, "C-SJIS")) - { - int char1; - if (s == NULL) - /* Not state-dependent. */ - return 0; - - char1 = *t; - if (ISSJIS1 (char1)) - { - int char2 = t[1]; - - if (n <= 1) - return -1; - - if (ISSJIS2 (char2)) - { - if (pwc != NULL) - *pwc = (((wchar_t) *t) << 8) + (wchar_t) (*(t + 1)); - return 2; - } - - return -1; - } - - if (pwc != NULL) - *pwc = (wchar_t) *t; - - if (*t == '\0') - return 0; - - return 1; - } - else if (! strcmp (literal_codeset, "C-EUCJP")) - { - int char1; - - if (s == NULL) - /* Not state-dependent. */ - return 0; - - char1 = *t; - if (ISEUCJP (char1)) - { - int char2 = t[1]; - - if (n <= 1) - return -1; - - if (ISEUCJP (char2)) - { - if (pwc != NULL) - *pwc = (((wchar_t) *t) << 8) + (wchar_t) (*(t + 1)); - return 2; - } - - return -1; - } - - if (pwc != NULL) - *pwc = (wchar_t) *t; - - if (*t == '\0') - return 0; - - return 1; - } - else if (! strcmp (literal_codeset, "C-JIS")) - { - JIS_ACTION action; - JIS_CHAR_TYPE ch; - const unsigned char *ptr; - size_t i, curr_ch; - - if (s == NULL) - { - save_state = ASCII; - /* State-dependent. */ - return 1; - } - - ptr = t; - - for (i = 0; i < n; i++) - { - curr_ch = t[i]; - switch (curr_ch) - { - case JIS_ESC_CHAR: - ch = ESCAPE; - break; - case '$': - ch = DOLLAR; - break; - case '@': - ch = AT; - break; - case '(': - ch = BRACKET; - break; - case 'B': - ch = B; - break; - case 'J': - ch = J; - break; - case '\0': - ch = NUL; - break; - default: - if (ISJIS (curr_ch)) - ch = JIS_CHAR; - else - ch = OTHER; - } - - action = JIS_action_table[curr_state][ch]; - curr_state = JIS_state_table[curr_state][ch]; - - switch (action) - { - case NOOP: - break; - - case EMPTY: - if (pwc != NULL) - *pwc = (wchar_t) 0; - - save_state = curr_state; - return i; - - case COPYA: - if (pwc != NULL) - *pwc = (wchar_t) *ptr; - save_state = curr_state; - return i + 1; - - case COPYJ: - if (pwc != NULL) - *pwc = (((wchar_t) *ptr) << 8) + (wchar_t) (*(ptr + 1)); - - save_state = curr_state; - return i + 1; - - case COPYJ2: - if (pwc != NULL) - *pwc = (((wchar_t) *ptr) << 8) + (wchar_t) (*(ptr + 1)); - - save_state = curr_state; - return ptr - t + 2; - - case MAKE_A: - case MAKE_J: - ptr = (const unsigned char *) (t + i + 1); - break; - - case ERROR: - default: - return -1; - } - } - - /* More than n bytes needed. */ - return -1; - } - -#ifdef CROSS_COMPILE - if (s == NULL) - /* Not state-dependent. */ - return 0; - - if (pwc != NULL) - *pwc = *s; - return 1; -#else - - /* This must be the "C" locale or unknown locale. */ - return mbtowc (pwc, s, n); -#endif -} - -/* Return the number of bytes in the multibyte character at the start - of the buffer S of size N. Return -1 if the bytes do not form a - valid character, or 0 if S is null or points to a null byte. - - This function behaves like the Standard C function mblen, except - it treats locale names of the form "C-..." specially. */ - -int -local_mblen (s, n) - const char *s; - size_t n; -{ - return local_mbtowc (NULL, s, n); -} - -/* Return the maximum mumber of bytes in a multibyte character. - - This function returns the same value as the Standard C macro MB_CUR_MAX, - except it treats locale names of the form "C-..." specially. */ - -int -local_mb_cur_max () -{ - if (literal_codeset == NULL || strlen (literal_codeset) <= 1) - ; - else if (! strcmp (literal_codeset, "C-SJIS")) - return 2; - else if (! strcmp (literal_codeset, "C-EUCJP")) - return 2; - else if (! strcmp (literal_codeset, "C-JIS")) - return 8; /* 3 + 2 + 3 */ - -#ifdef CROSS_COMPILE - return 1; -#else - if (MB_CUR_MAX > 0) - return MB_CUR_MAX; - - return 1; /* default */ -#endif -} -#else /* MULTIBYTE_CHARS */ -extern int dummy; /* silence 'ANSI C forbids an empty source file' warning */ -#endif /* MULTIBYTE_CHARS */ diff --git a/contrib/gcc/mbchar.h b/contrib/gcc/mbchar.h deleted file mode 100644 index 44f8398..0000000 --- a/contrib/gcc/mbchar.h +++ /dev/null @@ -1,41 +0,0 @@ -/* Various declarations for functions found in mbchar.c - Copyright (C) 1998, 1999, 2000 Free Software Foundation, Inc. - -This file is part of GCC. - -GCC is free software; you can redistribute it and/or modify it under -the terms of the GNU General Public License as published by the Free -Software Foundation; either version 2, or (at your option) any later -version. - -GCC is distributed in the hope that it will be useful, but WITHOUT ANY -WARRANTY; without even the implied warranty of MERCHANTABILITY or -FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -for more details. - -You should have received a copy of the GNU General Public License -along with GCC; see the file COPYING. If not, write to the Free -Software Foundation, 59 Temple Place - Suite 330, Boston, MA -02111-1307, USA. */ - -#ifndef GCC_MBCHAR_H -#define GCC_MBCHAR_H - -#ifdef MULTIBYTE_CHARS - -/* Escape character used for JIS encoding */ -#define JIS_ESC_CHAR 0x1b - -#define ISSJIS1(c) (((c) >= 0x81 && (c) <= 0x9f) || ((c) >= 0xe0 && (c) <= 0xef)) -#define ISSJIS2(c) (((c) >= 0x40 && (c) <= 0x7e) || ((c) >= 0x80 && (c) <= 0xfc)) -#define ISEUCJP(c) ((c) >= 0xa1 && (c) <= 0xfe) -#define ISJIS(c) ((c) >= 0x21 && (c) <= 0x7e) - -extern int local_mbtowc PARAMS ((wchar_t *, const char *, size_t)); -extern int local_mblen PARAMS ((const char *, size_t)); -extern int local_mb_cur_max PARAMS ((void)); - -/* The locale being used for multibyte characters in string/char literals. */ -extern const char *literal_codeset; -#endif /* MULTIBYTE_CHARS */ -#endif /* ! GCC_MBCHAR_H */ diff --git a/contrib/gcc/objc/lang-options.h b/contrib/gcc/objc/lang-options.h deleted file mode 100644 index 88e30e5..0000000 --- a/contrib/gcc/objc/lang-options.h +++ /dev/null @@ -1,43 +0,0 @@ -/* Switch definitions for the GNU compiler for the Objective-C language. - Copyright (C) 2000 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. */ - -/* This is the contribution to the `documented_lang_options' array in - toplev.c for Objective-C. */ - -DEFINE_LANG_NAME ("Objective C") - - { "-gen-decls", - N_("Dump decls to a .decl file") }, - { "-fgnu-runtime", - N_("Generate code for GNU runtime environment") }, - { "-fno-gnu-runtime", "" }, - { "-fnext-runtime", - N_("Generate code for NeXT runtime environment") }, - { "-fno-next-runtime", "" }, - { "-Wselector", - N_("Warn if a selector has multiple methods") }, - { "-Wno-selector", "" }, - { "-Wprotocol", "" }, - { "-Wno-protocol", - N_("Do not warn if inherited methods are unimplemented") }, - { "-print-objc-runtime-info", - N_("Generate C header of platform specific features") }, - { "-fconstant-string-class", - N_("Specify the name of the class for constant strings") }, diff --git a/contrib/gcc/profile.h b/contrib/gcc/profile.h deleted file mode 100644 index 609b0d3..0000000 --- a/contrib/gcc/profile.h +++ /dev/null @@ -1,54 +0,0 @@ -/* profile.h - Defines data exported from profile.c to other passes. - Copyright (C) 1998, 1999, 2000, 2001 Free Software Foundation, Inc. - -This file is part of GCC. - -GCC is free software; you can redistribute it and/or modify it under -the terms of the GNU General Public License as published by the Free -Software Foundation; either version 2, or (at your option) any later -version. - -GCC is distributed in the hope that it will be useful, but WITHOUT ANY -WARRANTY; without even the implied warranty of MERCHANTABILITY or -FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -for more details. - -You should have received a copy of the GNU General Public License -along with GCC; see the file COPYING. If not, write to the Free -Software Foundation, 59 Temple Place - Suite 330, Boston, MA -02111-1307, USA. */ - -#ifndef GCC_PROFILE_H -#define GCC_PROFILE_H - -struct profile_info - { - /* Used by final, for allocating the proper amount of storage for the - instrumented arc execution counts. */ - - int count_instrumented_edges; - - /* Used by final, for writing correct # of instrumented edges - in this function. */ - - int count_edges_instrumented_now; - - /* Checksum of the cfg. Used for 'identification' of code. - Used by final. */ - - long current_function_cfg_checksum; - - /* Max. value of counter in program corresponding to the profile data - for the current function. */ - - gcov_type max_counter_in_program; - - /* The number of profiles merged to form the profile data for the current - function. */ - int count_profiles_merged; - - }; - -extern struct profile_info profile_info; - -#endif diff --git a/contrib/gcc/ssa-ccp.c b/contrib/gcc/ssa-ccp.c deleted file mode 100644 index 44f4921..0000000 --- a/contrib/gcc/ssa-ccp.c +++ /dev/null @@ -1,1219 +0,0 @@ -/* Conditional constant propagation pass for the GNU compiler. - Copyright (C) 2000, 2001, 2002 Free Software Foundation, Inc. - Original framework by Daniel Berlin <dan@cgsoftware.com> - Fleshed out and major cleanups by Jeff Law <law@redhat.com> - -This file is part of GCC. - -GCC is free software; you can redistribute it and/or modify it under -the terms of the GNU General Public License as published by the Free -Software Foundation; either version 2, or (at your option) any later -version. - -GCC is distributed in the hope that it will be useful, but WITHOUT ANY -WARRANTY; without even the implied warranty of MERCHANTABILITY or -FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -for more details. - -You should have received a copy of the GNU General Public License -along with GCC; see the file COPYING. If not, write to the Free -Software Foundation, 59 Temple Place - Suite 330, Boston, MA -02111-1307, USA. */ - -/* Conditional constant propagation. - - References: - - Constant propagation with conditional branches, - Wegman and Zadeck, ACM TOPLAS 13(2):181-210. - - Building an Optimizing Compiler, - Robert Morgan, Butterworth-Heinemann, 1998, Section 8.9. - - Advanced Compiler Design and Implementation, - Steven Muchnick, Morgan Kaufmann, 1997, Section 12.6 - - The overall structure is as follows: - - 1. Run a simple SSA based DCE pass to remove any dead code. - 2. Run CCP to compute what registers are known constants - and what edges are not executable. Remove unexecutable - edges from the CFG and simplify PHI nodes. - 3. Replace registers with constants where possible. - 4. Remove unreachable blocks computed in step #2. - 5. Another simple SSA DCE pass to remove dead code exposed - by CCP. - - When we exit, we are still in SSA form. - - - Potential further enhancements: - - 1. Handle SUBREGs, STRICT_LOW_PART, etc in destinations more - gracefully. - - 2. Handle insns with multiple outputs more gracefully. - - 3. Handle CONST_DOUBLE and symbolic constants. - - 4. Fold expressions after performing constant substitutions. */ - - -#include "config.h" -#include "system.h" - -#include "rtl.h" -#include "hard-reg-set.h" -#include "basic-block.h" -#include "ssa.h" -#include "insn-config.h" -#include "recog.h" -#include "output.h" -#include "errors.h" -#include "ggc.h" -#include "df.h" -#include "function.h" - -/* Possible lattice values. */ - -typedef enum -{ - UNDEFINED, - CONSTANT, - VARYING -} latticevalue; - -/* Main structure for CCP. - - Contains the lattice value and, if it's a constant, the constant - value. */ -typedef struct -{ - latticevalue lattice_val; - rtx const_value; -} value; - -/* Array of values indexed by register number. */ -static value *values; - -/* A bitmap to keep track of executable blocks in the CFG. */ -static sbitmap executable_blocks; - -/* A bitmap for all executable edges in the CFG. */ -static sbitmap executable_edges; - -/* Array of edges on the work list. */ -static edge *edge_info; - -/* We need an edge list to be able to get indexes easily. */ -static struct edge_list *edges; - -/* For building/following use-def and def-use chains. */ -static struct df *df_analyzer; - -/* Current edge we are operating on, from the worklist */ -static edge flow_edges; - -/* Bitmap of SSA edges which will need reexamination as their definition - has changed. */ -static sbitmap ssa_edges; - -/* Simple macros to simplify code */ -#define SSA_NAME(x) REGNO (SET_DEST (x)) -#define EIE(x,y) EDGE_INDEX (edges, x, y) - -static void visit_phi_node PARAMS ((rtx, basic_block)); -static void visit_expression PARAMS ((rtx, basic_block)); -static void defs_to_undefined PARAMS ((rtx)); -static void defs_to_varying PARAMS ((rtx)); -static void examine_flow_edges PARAMS ((void)); -static int mark_references PARAMS ((rtx *, void *)); -static void follow_def_use_chains PARAMS ((void)); -static void optimize_unexecutable_edges PARAMS ((struct edge_list *, sbitmap)); -static void ssa_ccp_substitute_constants PARAMS ((void)); -static void ssa_ccp_df_delete_unreachable_insns PARAMS ((void)); -static void ssa_fast_dce PARAMS ((struct df *)); - -/* Loop through the PHI_NODE's parameters for BLOCK and compare their - lattice values to determine PHI_NODE's lattice value. */ -static void -visit_phi_node (phi_node, block) - rtx phi_node; - basic_block block; -{ - unsigned int i; - rtx phi_node_expr = NULL; - unsigned int phi_node_name = SSA_NAME (PATTERN (phi_node)); - latticevalue phi_node_lattice_val = UNDEFINED; - rtx pat = PATTERN (phi_node); - rtvec phi_vec = XVEC (SET_SRC (pat), 0); - unsigned int num_elem = GET_NUM_ELEM (phi_vec); - - for (i = 0; i < num_elem; i += 2) - { - if (TEST_BIT (executable_edges, - EIE (BASIC_BLOCK (INTVAL (RTVEC_ELT (phi_vec, i + 1))), - block))) - { - unsigned int current_parm - = REGNO (RTVEC_ELT (phi_vec, i)); - - latticevalue current_parm_lattice_val - = values[current_parm].lattice_val; - - /* If any node is VARYING, then new value of PHI_NODE - is VARYING. */ - if (current_parm_lattice_val == VARYING) - { - phi_node_lattice_val = VARYING; - phi_node_expr = NULL; - break; - } - - /* If we have more than one distinct constant, then the new - value of PHI_NODE is VARYING. */ - if (current_parm_lattice_val == CONSTANT - && phi_node_lattice_val == CONSTANT - && values[current_parm].const_value != phi_node_expr) - { - phi_node_lattice_val = VARYING; - phi_node_expr = NULL; - break; - } - - /* If the current value of PHI_NODE is UNDEFINED and one - node in PHI_NODE is CONSTANT, then the new value of the - PHI is that CONSTANT. Note this can turn into VARYING - if we find another distinct constant later. */ - if (phi_node_lattice_val == UNDEFINED - && phi_node_expr == NULL - && current_parm_lattice_val == CONSTANT) - { - phi_node_expr = values[current_parm].const_value; - phi_node_lattice_val = CONSTANT; - continue; - } - } - } - - /* If the value of PHI_NODE changed, then we will need to - re-execute uses of the output of PHI_NODE. */ - if (phi_node_lattice_val != values[phi_node_name].lattice_val) - { - values[phi_node_name].lattice_val = phi_node_lattice_val; - values[phi_node_name].const_value = phi_node_expr; - SET_BIT (ssa_edges, phi_node_name); - } -} - -/* Sets all defs in an insn to UNDEFINED. */ -static void -defs_to_undefined (insn) - rtx insn; -{ - struct df_link *currdef; - for (currdef = DF_INSN_DEFS (df_analyzer, insn); currdef; - currdef = currdef->next) - { - if (values[DF_REF_REGNO (currdef->ref)].lattice_val != UNDEFINED) - SET_BIT (ssa_edges, DF_REF_REGNO (currdef->ref)); - values[DF_REF_REGNO (currdef->ref)].lattice_val = UNDEFINED; - } -} - -/* Sets all defs in an insn to VARYING. */ -static void -defs_to_varying (insn) - rtx insn; -{ - struct df_link *currdef; - for (currdef = DF_INSN_DEFS (df_analyzer, insn); currdef; - currdef = currdef->next) - { - if (values[DF_REF_REGNO (currdef->ref)].lattice_val != VARYING) - SET_BIT (ssa_edges, DF_REF_REGNO (currdef->ref)); - values[DF_REF_REGNO (currdef->ref)].lattice_val = VARYING; - } -} - -/* Go through the expression, call the appropriate evaluation routines - to attempt cprop */ -static void -visit_expression (insn, block) - rtx insn; - basic_block block; -{ - rtx src, dest, set; - - - /* Ugh. CALL_INSNs may end a basic block and have multiple edges - leading out from them. - - Mark all the outgoing edges as executable, then fall into the - normal processing below. */ - if (GET_CODE (insn) == CALL_INSN && block->end == insn) - { - edge curredge; - - for (curredge = block->succ; curredge; - curredge = curredge->succ_next) - { - int index = EIE (curredge->src, curredge->dest); - - if (TEST_BIT (executable_edges, index)) - continue; - - SET_BIT (executable_edges, index); - edge_info[index] = flow_edges; - flow_edges = curredge; - } - } - - set = single_set (insn); - if (! set) - { - defs_to_varying (insn); - return; - } - - src = SET_SRC (set); - dest = SET_DEST (set); - - /* We may want to refine this some day. */ - if (GET_CODE (dest) != REG && dest != pc_rtx) - { - defs_to_varying (insn); - return; - } - - /* Hard registers are not put in SSA form and thus we must consider - them varying. All the more reason to avoid hard registers in - RTL until as late as possible in the compilation. */ - if (GET_CODE (dest) == REG && REGNO (dest) < FIRST_PSEUDO_REGISTER) - { - defs_to_varying (insn); - return; - } - - /* If this is assigning DEST to a constant, record that fact. */ - if (GET_CODE (src) == CONST_INT && GET_CODE (insn) == INSN) - { - unsigned int resultreg = REGNO (dest); - - values[resultreg].lattice_val = CONSTANT; - values[resultreg].const_value = SET_SRC (PATTERN (insn)); - SET_BIT (ssa_edges, resultreg); - } - - /* If this is a copy operation, then we can copy the lattice values. */ - else if (GET_CODE (src) == REG && GET_CODE (dest) == REG) - { - unsigned int old_value = REGNO (src); - latticevalue old_lattice_value = values[old_value].lattice_val; - unsigned int new_value = REGNO (dest); - - /* Unless the lattice value is going to change, don't bother - adding the "new value" into the worklist. */ - if (values[new_value].lattice_val != old_lattice_value - || values[new_value].const_value != values[old_value].const_value) - SET_BIT (ssa_edges, new_value); - - /* Copy the old lattice node info into the new value lattice node. */ - values[new_value].lattice_val = old_lattice_value; - values[new_value].const_value = values[old_value].const_value; - } - - /* Handle jumps. */ - else if (GET_CODE (insn) == JUMP_INSN) - { - rtx x = pc_set (insn); - if (GET_CODE (src) != IF_THEN_ELSE) - { - edge curredge; - - /* This is a computed jump, table jump, or an unconditional - jump. For all these cases we want to mark all successor - blocks as executable if they have not already been - marked. - - One day we may try do better with swtich tables and - other computed jumps. */ - for (curredge = block->succ; curredge; - curredge = curredge->succ_next) - { - int index = EIE (curredge->src, curredge->dest); - - if (TEST_BIT (executable_edges, index)) - continue; - - SET_BIT (executable_edges, index); - edge_info[index] = flow_edges; - flow_edges = curredge; - } - } - else - { - edge curredge; - enum rtx_code comparison_code; - rtx comparison_src0; - rtx comparison_src1; - - comparison_code = GET_CODE (XEXP (src, 0)); - comparison_src0 = XEXP (XEXP (src, 0), 0); - comparison_src1 = XEXP (XEXP (src, 0), 1); - - /* If either operand is undefined, then there is nothing to - do right now. If/when operands are later defined we will - revaluate the condition and take the appropriate action. */ - if ((GET_CODE (comparison_src0) == REG - && values[REGNO (comparison_src0)].lattice_val == UNDEFINED) - || (GET_CODE (comparison_src1) == REG - && values[REGNO (comparison_src1)].lattice_val == UNDEFINED)) - return; - - /* If either operand is varying, then we must consider all - paths as executable. */ - if ((GET_CODE (comparison_src0) == REG - && values[REGNO (comparison_src0)].lattice_val == VARYING) - || (GET_CODE (comparison_src1) == REG - && values[REGNO (comparison_src1)].lattice_val == VARYING)) - { - for (curredge = block->succ; curredge; - curredge = curredge->succ_next) - { - int index = EIE (curredge->src, curredge->dest); - - if (TEST_BIT (executable_edges, index)) - continue; - - SET_BIT (executable_edges, index); - edge_info[index] = flow_edges; - flow_edges = curredge; - } - return; - } - - /* Try to simplify the comparison. */ - if (GET_CODE (comparison_src0) == REG - && values[REGNO (comparison_src0)].lattice_val == CONSTANT) - comparison_src0 = values[REGNO (comparison_src0)].const_value; - - if (GET_CODE (comparison_src1) == REG - && values[REGNO (comparison_src1)].lattice_val == CONSTANT) - comparison_src1 = values[REGNO (comparison_src1)].const_value; - - x = simplify_ternary_operation (IF_THEN_ELSE, - VOIDmode, - GET_MODE (XEXP (src, 0)), - gen_rtx (comparison_code, - GET_MODE (XEXP (src, 0)), - comparison_src0, - comparison_src1), - XEXP (src, 1), - XEXP (src, 2)); - - /* Walk through all the outgoing edges from this block and see - which (if any) we should mark as executable. */ - for (curredge = block->succ; curredge; - curredge = curredge->succ_next) - { - int index = EIE (curredge->src, curredge->dest); - - if (TEST_BIT (executable_edges, index)) - continue; - - /* If we were unable to simplify the expression at this - point, it's highly unlikely we'll be able to simplify - it later. So consider all edges as executable if the - expression did not simplify. - - If the expression simplified to (pc), then we know we - will take the fall-thru edge, so mark it. Similarly, - if the expression simplified to (label_ref ...), then - we know the branch will be taken and we mark that - edge as taken. */ - if (!x - || (x == pc_rtx - && (curredge->flags & EDGE_FALLTHRU)) - || (GET_CODE (x) == LABEL_REF - && ! (curredge->flags & EDGE_FALLTHRU))) - { - SET_BIT (executable_edges, index); - edge_info[index] = flow_edges; - flow_edges = curredge; - } - } - } - } - else if (!PHI_NODE_P (insn)) - { - rtx simplified = NULL; - - /* We've got some kind of INSN. If it's simple, try to evaluate - it and record the results. - - We already know this insn is a single_set and that it sets - a pseudo register. So we just need to extract the source - arguments, simplify them to constants if possible, then - simplify the expression as a whole if possible. */ - switch (GET_RTX_CLASS (GET_CODE (src))) - { - case '<': - { - rtx src0 = XEXP (src, 0); - rtx src1 = XEXP (src, 1); - enum machine_mode mode; - - /* If either is undefined, then the result is undefined. */ - if ((GET_CODE (src0) == REG - && values[REGNO (src0)].lattice_val == UNDEFINED) - || (GET_CODE (src1) == REG - && values[REGNO (src1)].lattice_val == UNDEFINED)) - { - defs_to_undefined (insn); - break; - } - - /* Determine the mode for the operation before we simplify - our arguments to constants. */ - mode = GET_MODE (src0); - if (mode == VOIDmode) - mode = GET_MODE (src1); - - /* Simplify source operands to whatever known values they - may have. */ - if (GET_CODE (src0) == REG - && values[REGNO (src0)].lattice_val == CONSTANT) - src0 = values[REGNO (src0)].const_value; - - if (GET_CODE (src1) == REG - && values[REGNO (src1)].lattice_val == CONSTANT) - src1 = values[REGNO (src1)].const_value; - - /* See if the simplifier can determine if this operation - computes a constant value. */ - simplified = simplify_relational_operation (GET_CODE (src), - mode, src0, src1); - break; - - } - - case '1': - { - rtx src0 = XEXP (src, 0); - enum machine_mode mode0 = GET_MODE (src0); - - /* If the operand is undefined, then the result is undefined. */ - if (GET_CODE (src0) == REG - && values[REGNO (src0)].lattice_val == UNDEFINED) - { - defs_to_undefined (insn); - break; - } - - /* Simplify source operands to whatever known values they - may have. */ - if (GET_CODE (src0) == REG - && values[REGNO (src0)].lattice_val == CONSTANT) - src0 = values[REGNO (src0)].const_value; - - /* See if the simplifier can determine if this operation - computes a constant value. */ - simplified = simplify_unary_operation (GET_CODE (src), - GET_MODE (src), - src0, - mode0); - break; - } - - case '2': - case 'c': - { - rtx src0 = XEXP (src, 0); - rtx src1 = XEXP (src, 1); - - /* If either is undefined, then the result is undefined. */ - if ((GET_CODE (src0) == REG - && values[REGNO (src0)].lattice_val == UNDEFINED) - || (GET_CODE (src1) == REG - && values[REGNO (src1)].lattice_val == UNDEFINED)) - { - defs_to_undefined (insn); - break; - } - - /* Simplify source operands to whatever known values they - may have. */ - if (GET_CODE (src0) == REG - && values[REGNO (src0)].lattice_val == CONSTANT) - src0 = values[REGNO (src0)].const_value; - - if (GET_CODE (src1) == REG - && values[REGNO (src1)].lattice_val == CONSTANT) - src1 = values[REGNO (src1)].const_value; - - /* See if the simplifier can determine if this operation - computes a constant value. */ - simplified = simplify_binary_operation (GET_CODE (src), - GET_MODE (src), - src0, src1); - break; - } - - case '3': - case 'b': - { - rtx src0 = XEXP (src, 0); - rtx src1 = XEXP (src, 1); - rtx src2 = XEXP (src, 2); - - /* If either is undefined, then the result is undefined. */ - if ((GET_CODE (src0) == REG - && values[REGNO (src0)].lattice_val == UNDEFINED) - || (GET_CODE (src1) == REG - && values[REGNO (src1)].lattice_val == UNDEFINED) - || (GET_CODE (src2) == REG - && values[REGNO (src2)].lattice_val == UNDEFINED)) - { - defs_to_undefined (insn); - break; - } - - /* Simplify source operands to whatever known values they - may have. */ - if (GET_CODE (src0) == REG - && values[REGNO (src0)].lattice_val == CONSTANT) - src0 = values[REGNO (src0)].const_value; - - if (GET_CODE (src1) == REG - && values[REGNO (src1)].lattice_val == CONSTANT) - src1 = values[REGNO (src1)].const_value; - - if (GET_CODE (src2) == REG - && values[REGNO (src2)].lattice_val == CONSTANT) - src2 = values[REGNO (src2)].const_value; - - /* See if the simplifier can determine if this operation - computes a constant value. */ - simplified = simplify_ternary_operation (GET_CODE (src), - GET_MODE (src), - GET_MODE (src), - src0, src1, src2); - break; - } - - default: - defs_to_varying (insn); - } - - if (simplified && GET_CODE (simplified) == CONST_INT) - { - if (values[REGNO (dest)].lattice_val != CONSTANT - || values[REGNO (dest)].const_value != simplified) - SET_BIT (ssa_edges, REGNO (dest)); - - values[REGNO (dest)].lattice_val = CONSTANT; - values[REGNO (dest)].const_value = simplified; - } - else - defs_to_varying (insn); - } -} - -/* Iterate over the FLOW_EDGES work list. Simulate the target block - for each edge. */ -static void -examine_flow_edges () -{ - while (flow_edges != NULL) - { - basic_block succ_block; - rtx curr_phi_node; - - /* Pull the next block to simulate off the worklist. */ - succ_block = flow_edges->dest; - flow_edges = edge_info[EIE (flow_edges->src, flow_edges->dest)]; - - /* There is nothing to do for the exit block. */ - if (succ_block == EXIT_BLOCK_PTR) - continue; - - /* Always simulate PHI nodes, even if we have simulated this block - before. Note that all PHI nodes are consecutive within a block. */ - for (curr_phi_node = first_insn_after_basic_block_note (succ_block); - PHI_NODE_P (curr_phi_node); - curr_phi_node = NEXT_INSN (curr_phi_node)) - visit_phi_node (curr_phi_node, succ_block); - - /* If this is the first time we've simulated this block, then we - must simulate each of its insns. */ - if (!TEST_BIT (executable_blocks, succ_block->index)) - { - rtx currinsn; - edge succ_edge = succ_block->succ; - - /* Note that we have simulated this block. */ - SET_BIT (executable_blocks, succ_block->index); - - /* Simulate each insn within the block. */ - currinsn = succ_block->head; - while (currinsn != succ_block->end) - { - if (INSN_P (currinsn)) - visit_expression (currinsn, succ_block); - - currinsn = NEXT_INSN (currinsn); - } - - /* Don't forget the last insn in the block. */ - if (INSN_P (currinsn)) - visit_expression (currinsn, succ_block); - - /* If we haven't looked at the next block, and it has a - single successor, add it onto the worklist. This is because - if we only have one successor, we know it gets executed, - so we don't have to wait for cprop to tell us. */ - if (succ_edge != NULL - && succ_edge->succ_next == NULL - && !TEST_BIT (executable_edges, - EIE (succ_edge->src, succ_edge->dest))) - { - SET_BIT (executable_edges, - EIE (succ_edge->src, succ_edge->dest)); - edge_info[EIE (succ_edge->src, succ_edge->dest)] = flow_edges; - flow_edges = succ_edge; - } - } - } -} - -/* Follow the def-use chains for each definition on the worklist and - simulate the uses of the definition. */ - -static void -follow_def_use_chains () -{ - /* Iterate over all the entries on the SSA_EDGES worklist. */ - while (sbitmap_first_set_bit (ssa_edges) >= 0) - { - int member; - struct df_link *curruse; - - /* Pick an entry off the worklist (it does not matter which - entry we pick). */ - member = sbitmap_first_set_bit (ssa_edges); - RESET_BIT (ssa_edges, member); - - /* Iterate through all the uses of this entry. */ - for (curruse = df_analyzer->regs[member].uses; curruse; - curruse = curruse->next) - { - rtx useinsn; - - useinsn = DF_REF_INSN (curruse->ref); - if (PHI_NODE_P (useinsn)) - { - if (TEST_BIT (executable_blocks, BLOCK_NUM (useinsn))) - visit_phi_node (useinsn, BLOCK_FOR_INSN (useinsn)); - } - else - { - if (TEST_BIT (executable_blocks, BLOCK_NUM (useinsn))) - visit_expression (useinsn, BLOCK_FOR_INSN (useinsn)); - } - } - } -} - -/* Examine each edge to see if we were able to prove any were - not executable. - - If an edge is not executable, then we can remove its alternative - in PHI nodes as the destination of the edge, we can simplify the - conditional branch at the source of the edge, and we can remove - the edge from the CFG. Note we do not delete unreachable blocks - yet as the DF analyzer can not deal with that yet. */ -static void -optimize_unexecutable_edges (edges, executable_edges) - struct edge_list *edges; - sbitmap executable_edges; -{ - int i; - basic_block bb; - - for (i = 0; i < NUM_EDGES (edges); i++) - { - if (!TEST_BIT (executable_edges, i)) - { - edge edge = INDEX_EDGE (edges, i); - - if (edge->flags & EDGE_ABNORMAL) - continue; - - /* We found an edge that is not executable. First simplify - the PHI nodes in the target block. */ - if (edge->dest != EXIT_BLOCK_PTR) - { - rtx insn = first_insn_after_basic_block_note (edge->dest); - - while (PHI_NODE_P (insn)) - { - remove_phi_alternative (PATTERN (insn), edge->src); - if (rtl_dump_file) - fprintf (rtl_dump_file, - "Removing alternative for bb %d of phi %d\n", - edge->src->index, SSA_NAME (PATTERN (insn))); - insn = NEXT_INSN (insn); - } - } - if (rtl_dump_file) - fprintf (rtl_dump_file, - "Removing unexecutable edge from %d to %d\n", - edge->src->index, edge->dest->index); - /* Since the edge was not executable, remove it from the CFG. */ - remove_edge (edge); - } - } - - /* We have removed all the unexecutable edges from the CFG. Fix up - the conditional jumps at the end of any affected block. - - We have three cases to deal with: - - a. Both outgoing edges are not executable. This happens if the - source block is not reachable. We will deal with this by - deleting all the insns in the block later. - - b. The fall-thru edge is not executable. In this case we - change the conditional jump into an unconditional jump and - add a BARRIER after the unconditional jump. Note that since - we are working on generic RTL we can change the jump in-place - instead of dealing with the headache of reemitting the jump. - - c. The branch taken edge is not executable. In this case - we turn the jump into (set (pc) (pc)) which is a nop-jump - and we will remove the unrecognizable insn later. - - In cases B & C we are removing uses of registers, so make sure - to note those changes for the DF analyzer. */ - - FOR_EACH_BB (bb) - { - rtx insn = bb->end; - edge edge = bb->succ; - - /* If we have no predecessors, then this block is unreachable and - will be cleaned up when we remove unreachable blocks. */ - if (bb->pred == NULL || GET_CODE (insn) != JUMP_INSN) - continue; - - /* If this block ends in a conditional jump, but only has one - successor, then the jump needs adjustment. */ - if (condjump_p (insn) && ! simplejump_p (insn) - && bb->succ && bb->succ->succ_next == NULL) - { - /* If the fallthru edge is the executable edge, then turn - this jump into a nop jump, otherwise make it an unconditinoal - jump to its target. */ - if (edge->flags & EDGE_FALLTHRU) - { - PUT_CODE (insn, NOTE); - NOTE_LINE_NUMBER (insn) = NOTE_INSN_DELETED; - } - else - { - SET_SRC (PATTERN (insn)) = gen_rtx_LABEL_REF (Pmode, - JUMP_LABEL (insn)); - emit_barrier_after (insn); - INSN_CODE (insn) = -1; - } - - /* Inform the DF analyzer that this insn changed. */ - df_insn_modify (df_analyzer, BLOCK_FOR_INSN (insn), insn); - } - } -} - -/* Perform substitution of known values for pseudo registers. - - ??? Note we do not do simplifications or constant folding here, it - is unlikely that any significant simplifications can be done here - anyway. Consider that if the simplification would result in an - expression that produces a constant value that the value would - have been discovered and recorded already. - - We perform two transformations. First, we initialize pseudos to their - known constant values at their definition point. Second, we try to - replace uses with the known constant value. */ - -static void -ssa_ccp_substitute_constants () -{ - unsigned int i; - - for (i = FIRST_PSEUDO_REGISTER; i < VARRAY_SIZE (ssa_definition); i++) - { - if (values[i].lattice_val == CONSTANT) - { - rtx def = VARRAY_RTX (ssa_definition, i); - rtx set = single_set (def); - struct df_link *curruse; - - if (! set) - continue; - - /* Do not try to simplify PHI nodes down to a constant load. - That will be done later as we translate out of SSA. Also, - doing that here could violate the rule that all PHI nodes - are consecutive at the start of the basic block. - - Don't do anything to nodes that were already sets to - constants. */ - if (! PHI_NODE_P (def) - && ! ((GET_CODE (def) == INSN - && GET_CODE (SET_SRC (set)) == CONST_INT))) - { - if (rtl_dump_file) - fprintf (rtl_dump_file, - "Register %d is now set to a constant\n", - SSA_NAME (PATTERN (def))); - SET_SRC (set) = values[i].const_value; - INSN_CODE (def) = -1; - df_insn_modify (df_analyzer, BLOCK_FOR_INSN (def), def); - } - - /* Iterate through all the uses of this entry and try replacements - there too. Note it is not particularly profitable to try - and fold/simplify expressions here as most of the common - cases were handled above. */ - for (curruse = df_analyzer->regs[i].uses; - curruse; - curruse = curruse->next) - { - rtx useinsn; - - useinsn = DF_REF_INSN (curruse->ref); - - if (!INSN_DELETED_P (useinsn) - && ! (GET_CODE (useinsn) == NOTE - && NOTE_LINE_NUMBER (useinsn) == NOTE_INSN_DELETED) - && (GET_CODE (useinsn) == INSN - || GET_CODE (useinsn) == JUMP_INSN)) - { - - if (validate_replace_src (regno_reg_rtx [i], - values[i].const_value, - useinsn)) - { - if (rtl_dump_file) - fprintf (rtl_dump_file, - "Register %d in insn %d replaced with constant\n", - i, INSN_UID (useinsn)); - INSN_CODE (useinsn) = -1; - df_insn_modify (df_analyzer, - BLOCK_FOR_INSN (useinsn), - useinsn); - } - - } - } - } - } -} - -/* Now find all unreachable basic blocks. All the insns in those - blocks are unreachable, so delete them and mark any necessary - updates for the DF analyzer. */ - -static void -ssa_ccp_df_delete_unreachable_insns () -{ - basic_block b; - - /* Use the CFG to find all the reachable blocks. */ - find_unreachable_blocks (); - - /* Now we know what blocks are not reachable. Mark all the insns - in those blocks as deleted for the DF analyzer. We'll let the - normal flow code actually remove the unreachable blocks. */ - FOR_EACH_BB_REVERSE (b) - { - if (!(b->flags & BB_REACHABLE)) - { - rtx start = b->head; - rtx end = b->end; - rtx tmp; - - /* Include any jump table following the basic block. */ - end = b->end; - if (GET_CODE (end) == JUMP_INSN - && (tmp = JUMP_LABEL (end)) != NULL_RTX - && (tmp = NEXT_INSN (tmp)) != NULL_RTX - && GET_CODE (tmp) == JUMP_INSN - && (GET_CODE (PATTERN (tmp)) == ADDR_VEC - || GET_CODE (PATTERN (tmp)) == ADDR_DIFF_VEC)) - end = tmp; - - while (1) - { - rtx next = NEXT_INSN (start); - - if (GET_CODE (start) == INSN - || GET_CODE (start) == CALL_INSN - || GET_CODE (start) == JUMP_INSN) - df_insn_delete (df_analyzer, BLOCK_FOR_INSN (start), start); - - if (start == end) - break; - start = next; - } - } - } -} - - -/* Main entry point for SSA Conditional Constant Propagation. - - Long term it should accept as input the specific flow graph to - operate on so that it can be called for sub-graphs. */ - -void -ssa_const_prop () -{ - unsigned int i; - edge curredge; - - /* We need alias analysis (for what?) */ - init_alias_analysis (); - - df_analyzer = df_init (); - df_analyse (df_analyzer, 0, - DF_RD_CHAIN | DF_RU_CHAIN | DF_REG_INFO | DF_HARD_REGS); - - /* Perform a quick and dirty dead code elimination pass. This is not - as aggressive as it could be, but it's good enough to clean up a - lot of unwanted junk and it is fast. */ - ssa_fast_dce (df_analyzer); - - /* Build an edge list from the CFG. */ - edges = create_edge_list (); - - /* Initialize the values array with everything as undefined. */ - values = (value *) xmalloc (VARRAY_SIZE (ssa_definition) * sizeof (value)); - for (i = 0; i < VARRAY_SIZE (ssa_definition); i++) - { - if (i < FIRST_PSEUDO_REGISTER) - values[i].lattice_val = VARYING; - else - values[i].lattice_val = UNDEFINED; - values[i].const_value = NULL; - } - - ssa_edges = sbitmap_alloc (VARRAY_SIZE (ssa_definition)); - sbitmap_zero (ssa_edges); - - executable_blocks = sbitmap_alloc (last_basic_block); - sbitmap_zero (executable_blocks); - - executable_edges = sbitmap_alloc (NUM_EDGES (edges)); - sbitmap_zero (executable_edges); - - edge_info = (edge *) xmalloc (NUM_EDGES (edges) * sizeof (edge)); - flow_edges = ENTRY_BLOCK_PTR->succ; - - /* Add the successors of the entry block to the edge worklist. That - is enough of a seed to get SSA-CCP started. */ - for (curredge = ENTRY_BLOCK_PTR->succ; curredge; - curredge = curredge->succ_next) - { - int index = EIE (curredge->src, curredge->dest); - SET_BIT (executable_edges, index); - edge_info[index] = curredge->succ_next; - } - - /* Iterate until until the worklists are empty. */ - do - { - examine_flow_edges (); - follow_def_use_chains (); - } - while (flow_edges != NULL); - - /* Now perform substitutions based on the known constant values. */ - ssa_ccp_substitute_constants (); - - /* Remove unexecutable edges from the CFG and make appropriate - adjustments to PHI nodes. */ - optimize_unexecutable_edges (edges, executable_edges); - - /* Now remove all unreachable insns and update the DF information. - as appropriate. */ - ssa_ccp_df_delete_unreachable_insns (); - -#if 0 - /* The DF analyzer expects the number of blocks to remain constant, - so we can't remove unreachable blocks. - - Code the DF analyzer calls expects there to be no unreachable - blocks in the CFG. So we can't leave unreachable blocks in the - CFG. - - So, there is no way to do an incremental update of the DF data - at this point. */ - df_analyse (df_analyzer, 0, - DF_RD_CHAIN | DF_RU_CHAIN | DF_REG_INFO | DF_HARD_REGS); -#endif - - /* Clean up any dead code exposed by SSA-CCP, do this after updating - the dataflow information! */ - ssa_fast_dce (df_analyzer); - - free (values); - values = NULL; - - free (edge_info); - edge_info = NULL; - - sbitmap_free (executable_blocks); - executable_blocks = NULL; - - sbitmap_free (ssa_edges); - ssa_edges = NULL; - - free_edge_list (edges); - edges = NULL; - - sbitmap_free (executable_edges); - executable_edges = NULL; - - df_finish (df_analyzer); - end_alias_analysis (); -} - -static int -mark_references (current_rtx, data) - rtx *current_rtx; - void *data; -{ - rtx x = *current_rtx; - sbitmap worklist = (sbitmap) data; - - if (x == NULL_RTX) - return 0; - - if (GET_CODE (x) == SET) - { - rtx dest = SET_DEST (x); - - if (GET_CODE (dest) == STRICT_LOW_PART - || GET_CODE (dest) == SUBREG - || GET_CODE (dest) == SIGN_EXTRACT - || GET_CODE (dest) == ZERO_EXTRACT) - { - rtx reg; - - reg = dest; - - while (GET_CODE (reg) == STRICT_LOW_PART - || GET_CODE (reg) == SUBREG - || GET_CODE (reg) == SIGN_EXTRACT - || GET_CODE (reg) == ZERO_EXTRACT) - reg = XEXP (reg, 0); - - if (GET_CODE (reg) == REG) - SET_BIT (worklist, REGNO (reg)); - } - - if (GET_CODE (dest) == REG) - { - for_each_rtx (&SET_SRC (x), mark_references, data); - return -1; - } - - return 0; - } - else if (GET_CODE (x) == REG) - { - SET_BIT (worklist, REGNO (x)); - return -1; - } - else if (GET_CODE (x) == CLOBBER) - return -1; - else - return 0; -} - -static void -ssa_fast_dce (df) - struct df *df; -{ - sbitmap worklist = sbitmap_alloc (VARRAY_SIZE (ssa_definition)); - sbitmap_ones (worklist); - - /* Iterate on the worklist until there's no definitions left to - examine. */ - while (sbitmap_first_set_bit (worklist) >= 0) - { - struct df_link *curruse; - int reg, found_use; - - /* Remove an item from the worklist. */ - reg = sbitmap_first_set_bit (worklist); - RESET_BIT (worklist, reg); - - /* We never consider deleting assignments to hard regs or things - which do not have SSA definitions, or things we have already - deleted, or things with unusual side effects. */ - if (reg < FIRST_PSEUDO_REGISTER - || ! VARRAY_RTX (ssa_definition, reg) - || INSN_DELETED_P (VARRAY_RTX (ssa_definition, reg)) - || (GET_CODE (VARRAY_RTX (ssa_definition, reg)) == NOTE - && (NOTE_LINE_NUMBER (VARRAY_RTX (ssa_definition, reg)) - == NOTE_INSN_DELETED)) - || side_effects_p (PATTERN (VARRAY_RTX (ssa_definition, reg)))) - continue; - - /* Iterate over the uses of this register. If we can not find - any uses that have not been deleted, then the definition of - this register is dead. */ - found_use = 0; - for (curruse = df->regs[reg].uses; curruse; curruse = curruse->next) - { - if (curruse->ref - && DF_REF_INSN (curruse->ref) - && ! INSN_DELETED_P (DF_REF_INSN (curruse->ref)) - && ! (GET_CODE (DF_REF_INSN (curruse->ref)) == NOTE - && (NOTE_LINE_NUMBER (DF_REF_INSN (curruse->ref)) - == NOTE_INSN_DELETED)) - && DF_REF_INSN (curruse->ref) != VARRAY_RTX (ssa_definition, reg)) - { - found_use = 1; - break; - } - } - - /* If we did not find a use of this register, then the definition - of this register is dead. */ - - if (! found_use) - { - rtx def = VARRAY_RTX (ssa_definition, reg); - - /* Add all registers referenced by INSN to the work - list. */ - for_each_rtx (&PATTERN (def), mark_references, worklist); - - /* Inform the analyzer that this insn is going to be - deleted. */ - df_insn_delete (df, BLOCK_FOR_INSN (def), def); - - VARRAY_RTX (ssa_definition, reg) = NULL; - } - } - - sbitmap_free (worklist); - - /* Update the use-def chains in the df_analyzer as needed. */ - df_analyse (df_analyzer, 0, - DF_RD_CHAIN | DF_RU_CHAIN | DF_REG_INFO | DF_HARD_REGS); -} diff --git a/contrib/gcc/ssa-dce.c b/contrib/gcc/ssa-dce.c deleted file mode 100644 index 09fcc7a..0000000 --- a/contrib/gcc/ssa-dce.c +++ /dev/null @@ -1,733 +0,0 @@ -/* Dead-code elimination pass for the GNU compiler. - Copyright (C) 2000, 2001, 2002 Free Software Foundation, Inc. - Written by Jeffrey D. Oldham <oldham@codesourcery.com>. - -This file is part of GCC. - -GCC is free software; you can redistribute it and/or modify it under -the terms of the GNU General Public License as published by the Free -Software Foundation; either version 2, or (at your option) any later -version. - -GCC is distributed in the hope that it will be useful, but WITHOUT ANY -WARRANTY; without even the implied warranty of MERCHANTABILITY or -FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -for more details. - -You should have received a copy of the GNU General Public License -along with GCC; see the file COPYING. If not, write to the Free -Software Foundation, 59 Temple Place - Suite 330, Boston, MA -02111-1307, USA. */ - -/* Dead-code elimination is the removal of instructions which have no - impact on the program's output. "Dead instructions" have no impact - on the program's output, while "necessary instructions" may have - impact on the output. - - The algorithm consists of three phases: - 1) marking as necessary all instructions known to be necessary, - e.g., writing a value to memory, - 2) propagating necessary instructions, e.g., the instructions - giving values to operands in necessary instructions, and - 3) removing dead instructions (except replacing dead conditionals - with unconditional jumps). - - Side Effects: - The last step can require adding labels, deleting insns, and - modifying basic block structures. Some conditional jumps may be - converted to unconditional jumps so the control-flow graph may be - out-of-date. - - Edges from some infinite loops to the exit block can be added to - the control-flow graph, but will be removed after this pass is - complete. - - It Does Not Perform: - We decided to not simultaneously perform jump optimization and dead - loop removal during dead-code elimination. Thus, all jump - instructions originally present remain after dead-code elimination - but 1) unnecessary conditional jump instructions are changed to - unconditional jump instructions and 2) all unconditional jump - instructions remain. - - Assumptions: - 1) SSA has been performed. - 2) The basic block and control-flow graph structures are accurate. - 3) The flow graph permits constructing an edge_list. - 4) note rtxes should be saved. - - Unfinished: - When replacing unnecessary conditional jumps with unconditional - jumps, the control-flow graph is not updated. It should be. - - References: - Building an Optimizing Compiler - Robert Morgan - Butterworth-Heinemann, 1998 - Section 8.9 -*/ - -#include "config.h" -#include "system.h" - -#include "rtl.h" -#include "hard-reg-set.h" -#include "basic-block.h" -#include "ssa.h" -#include "insn-config.h" -#include "recog.h" -#include "output.h" - - -/* A map from blocks to the edges on which they are control dependent. */ -typedef struct { - /* An dynamically allocated array. The Nth element corresponds to - the block with index N + 2. The Ith bit in the bitmap is set if - that block is dependent on the Ith edge. */ - bitmap *data; - /* The number of elements in the array. */ - int length; -} control_dependent_block_to_edge_map_s, *control_dependent_block_to_edge_map; - -/* Local function prototypes. */ -static control_dependent_block_to_edge_map control_dependent_block_to_edge_map_create - PARAMS((size_t num_basic_blocks)); -static void set_control_dependent_block_to_edge_map_bit - PARAMS ((control_dependent_block_to_edge_map c, basic_block bb, - int edge_index)); -static void control_dependent_block_to_edge_map_free - PARAMS ((control_dependent_block_to_edge_map c)); -static void find_all_control_dependences - PARAMS ((struct edge_list *el, dominance_info pdom, - control_dependent_block_to_edge_map cdbte)); -static void find_control_dependence - PARAMS ((struct edge_list *el, int edge_index, dominance_info pdom, - control_dependent_block_to_edge_map cdbte)); -static basic_block find_pdom - PARAMS ((dominance_info pdom, basic_block block)); -static int inherently_necessary_register_1 - PARAMS ((rtx *current_rtx, void *data)); -static int inherently_necessary_register - PARAMS ((rtx current_rtx)); -static int find_inherently_necessary - PARAMS ((rtx current_rtx)); -static int propagate_necessity_through_operand - PARAMS ((rtx *current_rtx, void *data)); -static void note_inherently_necessary_set - PARAMS ((rtx, rtx, void *)); - -/* Unnecessary insns are indicated using insns' in_struct bit. */ - -/* Indicate INSN is dead-code; returns nothing. */ -#define KILL_INSN(INSN) INSN_DEAD_CODE_P(INSN) = 1 -/* Indicate INSN is necessary, i.e., not dead-code; returns nothing. */ -#define RESURRECT_INSN(INSN) INSN_DEAD_CODE_P(INSN) = 0 -/* Return nonzero if INSN is unnecessary. */ -#define UNNECESSARY_P(INSN) INSN_DEAD_CODE_P(INSN) -static void mark_all_insn_unnecessary - PARAMS ((void)); -/* Execute CODE with free variable INSN for all unnecessary insns in - an unspecified order, producing no output. */ -#define EXECUTE_IF_UNNECESSARY(INSN, CODE) \ -{ \ - rtx INSN; \ - \ - for (INSN = get_insns (); INSN != NULL_RTX; INSN = NEXT_INSN (INSN)) \ - if (INSN_DEAD_CODE_P (INSN)) { \ - CODE; \ - } \ -} -/* Find the label beginning block BB. */ -static rtx find_block_label - PARAMS ((basic_block bb)); -/* Remove INSN, updating its basic block structure. */ -static void delete_insn_bb - PARAMS ((rtx insn)); - -/* Recording which blocks are control dependent on which edges. We - expect each block to be control dependent on very few edges so we - use a bitmap for each block recording its edges. An array holds - the bitmap. Its position 0 entry holds the bitmap for block - INVALID_BLOCK+1 so that all blocks, including the entry and exit - blocks can participate in the data structure. */ - -/* Create a control_dependent_block_to_edge_map, given the number - NUM_BASIC_BLOCKS of non-entry, non-exit basic blocks, e.g., - n_basic_blocks. This memory must be released using - control_dependent_block_to_edge_map_free (). */ - -static control_dependent_block_to_edge_map -control_dependent_block_to_edge_map_create (num_basic_blocks) - size_t num_basic_blocks; -{ - int i; - control_dependent_block_to_edge_map c - = xmalloc (sizeof (control_dependent_block_to_edge_map_s)); - c->length = num_basic_blocks - (INVALID_BLOCK+1); - c->data = xmalloc ((size_t) c->length*sizeof (bitmap)); - for (i = 0; i < c->length; ++i) - c->data[i] = BITMAP_XMALLOC (); - - return c; -} - -/* Indicate block BB is control dependent on an edge with index - EDGE_INDEX in the mapping C of blocks to edges on which they are - control-dependent. */ - -static void -set_control_dependent_block_to_edge_map_bit (c, bb, edge_index) - control_dependent_block_to_edge_map c; - basic_block bb; - int edge_index; -{ - if (bb->index - (INVALID_BLOCK+1) >= c->length) - abort (); - - bitmap_set_bit (c->data[bb->index - (INVALID_BLOCK+1)], - edge_index); -} - -/* Execute CODE for each edge (given number EDGE_NUMBER within the - CODE) for which the block containing INSN is control dependent, - returning no output. CDBTE is the mapping of blocks to edges on - which they are control-dependent. */ - -#define EXECUTE_IF_CONTROL_DEPENDENT(CDBTE, INSN, EDGE_NUMBER, CODE) \ - EXECUTE_IF_SET_IN_BITMAP \ - (CDBTE->data[BLOCK_NUM (INSN) - (INVALID_BLOCK+1)], 0, \ - EDGE_NUMBER, CODE) - -/* Destroy a control_dependent_block_to_edge_map C. */ - -static void -control_dependent_block_to_edge_map_free (c) - control_dependent_block_to_edge_map c; -{ - int i; - for (i = 0; i < c->length; ++i) - BITMAP_XFREE (c->data[i]); - free ((PTR) c); -} - -/* Record all blocks' control dependences on all edges in the edge - list EL, ala Morgan, Section 3.6. The mapping PDOM of blocks to - their postdominators are used, and results are stored in CDBTE, - which should be empty. */ - -static void -find_all_control_dependences (el, pdom, cdbte) - struct edge_list *el; - dominance_info pdom; - control_dependent_block_to_edge_map cdbte; -{ - int i; - - for (i = 0; i < NUM_EDGES (el); ++i) - find_control_dependence (el, i, pdom, cdbte); -} - -/* Determine all blocks' control dependences on the given edge with - edge_list EL index EDGE_INDEX, ala Morgan, Section 3.6. The - mapping PDOM of blocks to their postdominators are used, and - results are stored in CDBTE, which is assumed to be initialized - with zeros in each (block b', edge) position. */ - -static void -find_control_dependence (el, edge_index, pdom, cdbte) - struct edge_list *el; - int edge_index; - dominance_info pdom; - control_dependent_block_to_edge_map cdbte; -{ - basic_block current_block; - basic_block ending_block; - - if (INDEX_EDGE_PRED_BB (el, edge_index) == EXIT_BLOCK_PTR) - abort (); - ending_block = - (INDEX_EDGE_PRED_BB (el, edge_index) == ENTRY_BLOCK_PTR) - ? ENTRY_BLOCK_PTR->next_bb - : find_pdom (pdom, INDEX_EDGE_PRED_BB (el, edge_index)); - - for (current_block = INDEX_EDGE_SUCC_BB (el, edge_index); - current_block != ending_block && current_block != EXIT_BLOCK_PTR; - current_block = find_pdom (pdom, current_block)) - { - set_control_dependent_block_to_edge_map_bit (cdbte, - current_block, - edge_index); - } -} - -/* Find the immediate postdominator PDOM of the specified basic block - BLOCK. This function is necessary because some blocks have - negative numbers. */ - -static basic_block -find_pdom (pdom, block) - dominance_info pdom; - basic_block block; -{ - if (!block) - abort (); - if (block->index == INVALID_BLOCK) - abort (); - - if (block == ENTRY_BLOCK_PTR) - return ENTRY_BLOCK_PTR->next_bb; - else if (block == EXIT_BLOCK_PTR) - return EXIT_BLOCK_PTR; - else - { - basic_block bb = get_immediate_dominator (pdom, block); - if (!bb) - return EXIT_BLOCK_PTR; - return bb; - } -} - -/* Determine if the given CURRENT_RTX uses a hard register not - converted to SSA. Returns nonzero only if it uses such a hard - register. DATA is not used. - - The program counter (PC) is not considered inherently necessary - since code should be position-independent and thus not depend on - particular PC values. */ - -static int -inherently_necessary_register_1 (current_rtx, data) - rtx *current_rtx; - void *data ATTRIBUTE_UNUSED; -{ - rtx x = *current_rtx; - - if (x == NULL_RTX) - return 0; - switch (GET_CODE (x)) - { - case CLOBBER: - /* Do not traverse the rest of the clobber. */ - return -1; - break; - case PC: - return 0; - break; - case REG: - if (CONVERT_REGISTER_TO_SSA_P (REGNO (x)) || x == pc_rtx) - return 0; - else - return !0; - break; - default: - return 0; - break; - } -} - -/* Return nonzero if the insn CURRENT_RTX is inherently necessary. */ - -static int -inherently_necessary_register (current_rtx) - rtx current_rtx; -{ - return for_each_rtx (¤t_rtx, - &inherently_necessary_register_1, NULL); -} - - -/* Called via note_stores for each store in an insn. Note whether - or not a particular store is inherently necessary. Store a - nonzero value in inherently_necessary_p if such a store is found. */ - -static void -note_inherently_necessary_set (dest, set, data) - rtx set ATTRIBUTE_UNUSED; - rtx dest; - void *data; -{ - int *inherently_necessary_set_p = (int *) data; - - while (GET_CODE (dest) == SUBREG - || GET_CODE (dest) == STRICT_LOW_PART - || GET_CODE (dest) == ZERO_EXTRACT - || GET_CODE (dest) == SIGN_EXTRACT) - dest = XEXP (dest, 0); - - if (GET_CODE (dest) == MEM - || GET_CODE (dest) == UNSPEC - || GET_CODE (dest) == UNSPEC_VOLATILE) - *inherently_necessary_set_p = 1; -} - -/* Mark X as inherently necessary if appropriate. For example, - function calls and storing values into memory are inherently - necessary. This function is to be used with for_each_rtx (). - Return nonzero iff inherently necessary. */ - -static int -find_inherently_necessary (x) - rtx x; -{ - if (x == NULL_RTX) - return 0; - else if (inherently_necessary_register (x)) - return !0; - else - switch (GET_CODE (x)) - { - case CALL_INSN: - case BARRIER: - case PREFETCH: - return !0; - case CODE_LABEL: - case NOTE: - return 0; - case JUMP_INSN: - return JUMP_TABLE_DATA_P (x) || computed_jump_p (x) != 0; - case INSN: - { - int inherently_necessary_set = 0; - note_stores (PATTERN (x), - note_inherently_necessary_set, - &inherently_necessary_set); - - /* If we found an inherently necessary set or an asm - instruction, then we consider this insn inherently - necessary. */ - return (inherently_necessary_set - || GET_CODE (PATTERN (x)) == ASM_INPUT - || asm_noperands (PATTERN (x)) >= 0); - } - default: - /* Found an impossible insn type. */ - abort (); - break; - } -} - -/* Propagate necessity through REG and SUBREG operands of CURRENT_RTX. - This function is called with for_each_rtx () on necessary - instructions. The DATA must be a varray of unprocessed - instructions. */ - -static int -propagate_necessity_through_operand (current_rtx, data) - rtx *current_rtx; - void *data; -{ - rtx x = *current_rtx; - varray_type *unprocessed_instructions = (varray_type *) data; - - if (x == NULL_RTX) - return 0; - switch ( GET_CODE (x)) - { - case REG: - if (CONVERT_REGISTER_TO_SSA_P (REGNO (x))) - { - rtx insn = VARRAY_RTX (ssa_definition, REGNO (x)); - if (insn != NULL_RTX && UNNECESSARY_P (insn)) - { - RESURRECT_INSN (insn); - VARRAY_PUSH_RTX (*unprocessed_instructions, insn); - } - } - return 0; - - default: - return 0; - } -} - -/* Indicate all insns initially assumed to be unnecessary. */ - -static void -mark_all_insn_unnecessary () -{ - rtx insn; - for (insn = get_insns (); insn != NULL_RTX; insn = NEXT_INSN (insn)) - KILL_INSN (insn); -} - -/* Find the label beginning block BB, adding one if necessary. */ - -static rtx -find_block_label (bb) - basic_block bb; -{ - rtx insn = bb->head; - if (LABEL_P (insn)) - return insn; - else - { - rtx new_label = emit_label_before (gen_label_rtx (), insn); - if (insn == bb->head) - bb->head = new_label; - return new_label; - } -} - -/* Remove INSN, updating its basic block structure. */ - -static void -delete_insn_bb (insn) - rtx insn; -{ - if (!insn) - abort (); - - /* Do not actually delete anything that is not an INSN. - - We can get here because we only consider INSNs as - potentially necessary. We leave it to later passes - to remove unnecessary notes, unused labels, etc. */ - if (! INSN_P (insn)) - return; - - delete_insn (insn); -} - -/* Perform the dead-code elimination. */ - -void -ssa_eliminate_dead_code () -{ - rtx insn; - basic_block bb; - /* Necessary instructions with operands to explore. */ - varray_type unprocessed_instructions; - /* Map element (b,e) is nonzero if the block is control dependent on - edge. "cdbte" abbreviates control dependent block to edge. */ - control_dependent_block_to_edge_map cdbte; - /* Element I is the immediate postdominator of block I. */ - dominance_info pdom; - struct edge_list *el; - - /* Initialize the data structures. */ - mark_all_insn_unnecessary (); - VARRAY_RTX_INIT (unprocessed_instructions, 64, - "unprocessed instructions"); - cdbte = control_dependent_block_to_edge_map_create (last_basic_block); - - /* Prepare for use of BLOCK_NUM (). */ - connect_infinite_loops_to_exit (); - - /* Compute control dependence. */ - pdom = calculate_dominance_info (CDI_POST_DOMINATORS); - el = create_edge_list (); - find_all_control_dependences (el, pdom, cdbte); - - /* Find inherently necessary instructions. */ - for (insn = get_insns (); insn != NULL_RTX; insn = NEXT_INSN (insn)) - if (find_inherently_necessary (insn)) - { - RESURRECT_INSN (insn); - VARRAY_PUSH_RTX (unprocessed_instructions, insn); - } - - /* Propagate necessity using the operands of necessary instructions. */ - while (VARRAY_ACTIVE_SIZE (unprocessed_instructions) > 0) - { - rtx current_instruction; - int edge_number; - - current_instruction = VARRAY_TOP_RTX (unprocessed_instructions); - VARRAY_POP (unprocessed_instructions); - - /* Make corresponding control dependent edges necessary. */ - /* Assume the only JUMP_INSN is the block's last insn. It appears - that the last instruction of the program need not be a - JUMP_INSN. */ - - if (INSN_P (current_instruction) - && !JUMP_TABLE_DATA_P (current_instruction)) - { - /* Notes and labels contain no interesting operands. */ - EXECUTE_IF_CONTROL_DEPENDENT - (cdbte, current_instruction, edge_number, - { - rtx jump_insn = (INDEX_EDGE_PRED_BB (el, edge_number))->end; - if (GET_CODE (jump_insn) == JUMP_INSN - && UNNECESSARY_P (jump_insn)) - { - RESURRECT_INSN (jump_insn); - VARRAY_PUSH_RTX (unprocessed_instructions, jump_insn); - } - }); - - /* Propagate through the operands. */ - for_each_rtx (¤t_instruction, - &propagate_necessity_through_operand, - (PTR) &unprocessed_instructions); - - /* PHI nodes are somewhat special in that each PHI alternative - has data and control dependencies. The data dependencies - are handled via propagate_necessity_through_operand. We - handle the control dependency here. - - We consider the control dependent edges leading to the - predecessor block associated with each PHI alternative - as necessary. */ - if (PHI_NODE_P (current_instruction)) - { - rtvec phi_vec = XVEC (SET_SRC (PATTERN (current_instruction)), 0); - int num_elem = GET_NUM_ELEM (phi_vec); - int v; - - for (v = num_elem - 2; v >= 0; v -= 2) - { - basic_block bb; - - bb = BASIC_BLOCK (INTVAL (RTVEC_ELT (phi_vec, v + 1))); - EXECUTE_IF_CONTROL_DEPENDENT - (cdbte, bb->end, edge_number, - { - rtx jump_insn; - - jump_insn = (INDEX_EDGE_PRED_BB (el, edge_number))->end; - if (((GET_CODE (jump_insn) == JUMP_INSN)) - && UNNECESSARY_P (jump_insn)) - { - RESURRECT_INSN (jump_insn); - VARRAY_PUSH_RTX (unprocessed_instructions, jump_insn); - } - }); - - } - } - } - } - - /* Remove the unnecessary instructions. */ - EXECUTE_IF_UNNECESSARY (insn, - { - if (any_condjump_p (insn)) - { - basic_block bb = BLOCK_FOR_INSN (insn); - basic_block pdom_bb = find_pdom (pdom, bb); - rtx lbl; - edge e; - - /* Egad. The immediate post dominator is the exit block. We - would like to optimize this conditional jump to jump directly - to the exit block. That can be difficult as we may not have - a suitable CODE_LABEL that allows us to fall unmolested into - the exit block. - - So, we just delete the conditional branch by turning it into - a deleted note. That is safe, but just not as optimal as - it could be. */ - if (pdom_bb == EXIT_BLOCK_PTR) - { - /* Since we're going to just delete the branch, we need - look at all the edges and remove all those which are not - a fallthru edge. */ - e = bb->succ; - while (e) - { - edge temp = e; - - e = e->succ_next; - if ((temp->flags & EDGE_FALLTHRU) == 0) - { - /* We've found a non-fallthru edge, find any PHI nodes - at the target and clean them up. */ - if (temp->dest != EXIT_BLOCK_PTR) - { - rtx insn - = first_insn_after_basic_block_note (temp->dest); - - while (PHI_NODE_P (insn)) - { - remove_phi_alternative (PATTERN (insn), temp->src); - insn = NEXT_INSN (insn); - } - } - - remove_edge (temp); - } - } - - /* Now "delete" the conditional jump. */ - PUT_CODE (insn, NOTE); - NOTE_LINE_NUMBER (insn) = NOTE_INSN_DELETED; - continue; - } - - /* We've found a conditional branch that is unnecessary. - - First, remove all outgoing edges from this block, updating - PHI nodes as appropriate. */ - e = bb->succ; - while (e) - { - edge temp = e; - - e = e->succ_next; - - if (temp->flags & EDGE_ABNORMAL) - continue; - - /* We found an edge that is not executable. First simplify - the PHI nodes in the target block. */ - if (temp->dest != EXIT_BLOCK_PTR) - { - rtx insn = first_insn_after_basic_block_note (temp->dest); - - while (PHI_NODE_P (insn)) - { - remove_phi_alternative (PATTERN (insn), temp->src); - insn = NEXT_INSN (insn); - } - } - - remove_edge (temp); - } - - /* Create an edge from this block to the post dominator. - What about the PHI nodes at the target? */ - make_edge (bb, pdom_bb, 0); - - /* Third, transform this insn into an unconditional - jump to the label for the immediate postdominator. */ - lbl = find_block_label (pdom_bb); - SET_SRC (PATTERN (insn)) = gen_rtx_LABEL_REF (VOIDmode, lbl); - INSN_CODE (insn) = -1; - JUMP_LABEL (insn) = lbl; - LABEL_NUSES (lbl)++; - - /* A barrier must follow any unconditional jump. Barriers - are not in basic blocks so this must occur after - deleting the conditional jump. */ - emit_barrier_after (insn); - } - else if (!JUMP_P (insn)) - delete_insn_bb (insn); - }); - - /* Remove fake edges from the CFG. */ - remove_fake_edges (); - - /* Find any blocks with no successors and ensure they are followed - by a BARRIER. delete_insn has the nasty habit of deleting barriers - when deleting insns. */ - FOR_EACH_BB (bb) - { - if (bb->succ == NULL) - { - rtx next = NEXT_INSN (bb->end); - - if (!next || GET_CODE (next) != BARRIER) - emit_barrier_after (bb->end); - } - } - /* Release allocated memory. */ - for (insn = get_insns (); insn != NULL_RTX; insn = NEXT_INSN (insn)) - RESURRECT_INSN (insn); - if (VARRAY_ACTIVE_SIZE (unprocessed_instructions) != 0) - abort (); - control_dependent_block_to_edge_map_free (cdbte); - free ((PTR) pdom); - free_edge_list (el); -} diff --git a/contrib/gcc/ssa.c b/contrib/gcc/ssa.c deleted file mode 100644 index b5c4992..0000000 --- a/contrib/gcc/ssa.c +++ /dev/null @@ -1,2334 +0,0 @@ -/* Static Single Assignment conversion routines for the GNU compiler. - Copyright (C) 2000, 2001, 2002 Free Software Foundation, Inc. - -This file is part of GCC. - -GCC is free software; you can redistribute it and/or modify it under -the terms of the GNU General Public License as published by the Free -Software Foundation; either version 2, or (at your option) any later -version. - -GCC is distributed in the hope that it will be useful, but WITHOUT ANY -WARRANTY; without even the implied warranty of MERCHANTABILITY or -FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -for more details. - -You should have received a copy of the GNU General Public License -along with GCC; see the file COPYING. If not, write to the Free -Software Foundation, 59 Temple Place - Suite 330, Boston, MA -02111-1307, USA. */ - -/* References: - - Building an Optimizing Compiler - Robert Morgan - Butterworth-Heinemann, 1998 - - Static Single Assignment Construction - Preston Briggs, Tim Harvey, Taylor Simpson - Technical Report, Rice University, 1995 - ftp://ftp.cs.rice.edu/public/preston/optimizer/SSA.ps.gz. */ - -#include "config.h" -#include "system.h" - -#include "rtl.h" -#include "expr.h" -#include "varray.h" -#include "partition.h" -#include "sbitmap.h" -#include "hashtab.h" -#include "regs.h" -#include "hard-reg-set.h" -#include "flags.h" -#include "function.h" -#include "real.h" -#include "insn-config.h" -#include "recog.h" -#include "basic-block.h" -#include "output.h" -#include "ssa.h" - -/* TODO: - - Handle subregs better, maybe. For now, if a reg that's set in a - subreg expression is duplicated going into SSA form, an extra copy - is inserted first that copies the entire reg into the duplicate, so - that the other bits are preserved. This isn't strictly SSA, since - at least part of the reg is assigned in more than one place (though - they are adjacent). - - ??? What to do about strict_low_part. Probably I'll have to split - them out of their current instructions first thing. - - Actually the best solution may be to have a kind of "mid-level rtl" - in which the RTL encodes exactly what we want, without exposing a - lot of niggling processor details. At some later point we lower - the representation, calling back into optabs to finish any necessary - expansion. */ - -/* All pseudo-registers and select hard registers are converted to SSA - form. When converting out of SSA, these select hard registers are - guaranteed to be mapped to their original register number. Each - machine's .h file should define CONVERT_HARD_REGISTER_TO_SSA_P - indicating which hard registers should be converted. - - When converting out of SSA, temporaries for all registers are - partitioned. The partition is checked to ensure that all uses of - the same hard register in the same machine mode are in the same - class. */ - -/* If conservative_reg_partition is nonzero, use a conservative - register partitioning algorithm (which leaves more regs after - emerging from SSA) instead of the coalescing one. This is being - left in for a limited time only, as a debugging tool until the - coalescing algorithm is validated. */ - -static int conservative_reg_partition; - -/* This flag is set when the CFG is in SSA form. */ -int in_ssa_form = 0; - -/* Element I is the single instruction that sets register I. */ -varray_type ssa_definition; - -/* Element I-PSEUDO is the normal register that originated the ssa - register in question. */ -varray_type ssa_rename_from; - -/* Element I is the normal register that originated the ssa - register in question. - - A hash table stores the (register, rtl) pairs. These are each - xmalloc'ed and deleted when the hash table is destroyed. */ -htab_t ssa_rename_from_ht; - -/* The running target ssa register for a given pseudo register. - (Pseudo registers appear in only one mode.) */ -static rtx *ssa_rename_to_pseudo; -/* Similar, but for hard registers. A hard register can appear in - many modes, so we store an equivalent pseudo for each of the - modes. */ -static rtx ssa_rename_to_hard[FIRST_PSEUDO_REGISTER][NUM_MACHINE_MODES]; - -/* ssa_rename_from maps pseudo registers to the original corresponding - RTL. It is implemented as using a hash table. */ - -typedef struct { - unsigned int reg; - rtx original; -} ssa_rename_from_pair; - -struct ssa_rename_from_hash_table_data { - sbitmap canonical_elements; - partition reg_partition; -}; - -static rtx gen_sequence - PARAMS ((void)); -static void ssa_rename_from_initialize - PARAMS ((void)); -static rtx ssa_rename_from_lookup - PARAMS ((int reg)); -static unsigned int original_register - PARAMS ((unsigned int regno)); -static void ssa_rename_from_insert - PARAMS ((unsigned int reg, rtx r)); -static void ssa_rename_from_free - PARAMS ((void)); -typedef int (*srf_trav) PARAMS ((int regno, rtx r, sbitmap canonical_elements, partition reg_partition)); -static void ssa_rename_from_traverse - PARAMS ((htab_trav callback_function, sbitmap canonical_elements, partition reg_partition)); -/*static Avoid warnign message. */ void ssa_rename_from_print - PARAMS ((void)); -static int ssa_rename_from_print_1 - PARAMS ((void **slot, void *data)); -static hashval_t ssa_rename_from_hash_function - PARAMS ((const void * srfp)); -static int ssa_rename_from_equal - PARAMS ((const void *srfp1, const void *srfp2)); -static void ssa_rename_from_delete - PARAMS ((void *srfp)); - -static rtx ssa_rename_to_lookup - PARAMS ((rtx reg)); -static void ssa_rename_to_insert - PARAMS ((rtx reg, rtx r)); - -/* The number of registers that were live on entry to the SSA routines. */ -static unsigned int ssa_max_reg_num; - -/* Local function prototypes. */ - -struct rename_context; - -static inline rtx * phi_alternative - PARAMS ((rtx, int)); -static void compute_dominance_frontiers_1 - PARAMS ((sbitmap *frontiers, dominance_info idom, int bb, sbitmap done)); -static void find_evaluations_1 - PARAMS ((rtx dest, rtx set, void *data)); -static void find_evaluations - PARAMS ((sbitmap *evals, int nregs)); -static void compute_iterated_dominance_frontiers - PARAMS ((sbitmap *idfs, sbitmap *frontiers, sbitmap *evals, int nregs)); -static void insert_phi_node - PARAMS ((int regno, int b)); -static void insert_phi_nodes - PARAMS ((sbitmap *idfs, sbitmap *evals, int nregs)); -static void create_delayed_rename - PARAMS ((struct rename_context *, rtx *)); -static void apply_delayed_renames - PARAMS ((struct rename_context *)); -static int rename_insn_1 - PARAMS ((rtx *ptr, void *data)); -static void rename_block - PARAMS ((int b, dominance_info dom)); -static void rename_registers - PARAMS ((int nregs, dominance_info idom)); - -static inline int ephi_add_node - PARAMS ((rtx reg, rtx *nodes, int *n_nodes)); -static int * ephi_forward - PARAMS ((int t, sbitmap visited, sbitmap *succ, int *tstack)); -static void ephi_backward - PARAMS ((int t, sbitmap visited, sbitmap *pred, rtx *nodes)); -static void ephi_create - PARAMS ((int t, sbitmap visited, sbitmap *pred, sbitmap *succ, rtx *nodes)); -static void eliminate_phi - PARAMS ((edge e, partition reg_partition)); -static int make_regs_equivalent_over_bad_edges - PARAMS ((int bb, partition reg_partition)); - -/* These are used only in the conservative register partitioning - algorithms. */ -static int make_equivalent_phi_alternatives_equivalent - PARAMS ((int bb, partition reg_partition)); -static partition compute_conservative_reg_partition - PARAMS ((void)); -static int record_canonical_element_1 - PARAMS ((void **srfp, void *data)); -static int check_hard_regs_in_partition - PARAMS ((partition reg_partition)); -static int rename_equivalent_regs_in_insn - PARAMS ((rtx *ptr, void *data)); - -/* These are used in the register coalescing algorithm. */ -static int coalesce_if_unconflicting - PARAMS ((partition p, conflict_graph conflicts, int reg1, int reg2)); -static int coalesce_regs_in_copies - PARAMS ((basic_block bb, partition p, conflict_graph conflicts)); -static int coalesce_reg_in_phi - PARAMS ((rtx, int dest_regno, int src_regno, void *data)); -static int coalesce_regs_in_successor_phi_nodes - PARAMS ((basic_block bb, partition p, conflict_graph conflicts)); -static partition compute_coalesced_reg_partition - PARAMS ((void)); -static int mark_reg_in_phi - PARAMS ((rtx *ptr, void *data)); -static void mark_phi_and_copy_regs - PARAMS ((regset phi_set)); - -static int rename_equivalent_regs_in_insn - PARAMS ((rtx *ptr, void *data)); -static void rename_equivalent_regs - PARAMS ((partition reg_partition)); - -/* Deal with hard registers. */ -static int conflicting_hard_regs_p - PARAMS ((int reg1, int reg2)); - -/* ssa_rename_to maps registers and machine modes to SSA pseudo registers. */ - -/* Find the register associated with REG in the indicated mode. */ - -static rtx -ssa_rename_to_lookup (reg) - rtx reg; -{ - if (!HARD_REGISTER_P (reg)) - return ssa_rename_to_pseudo[REGNO (reg) - FIRST_PSEUDO_REGISTER]; - else - return ssa_rename_to_hard[REGNO (reg)][GET_MODE (reg)]; -} - -/* Store a new value mapping REG to R in ssa_rename_to. */ - -static void -ssa_rename_to_insert(reg, r) - rtx reg; - rtx r; -{ - if (!HARD_REGISTER_P (reg)) - ssa_rename_to_pseudo[REGNO (reg) - FIRST_PSEUDO_REGISTER] = r; - else - ssa_rename_to_hard[REGNO (reg)][GET_MODE (reg)] = r; -} - -/* Prepare ssa_rename_from for use. */ - -static void -ssa_rename_from_initialize () -{ - /* We use an arbitrary initial hash table size of 64. */ - ssa_rename_from_ht = htab_create (64, - &ssa_rename_from_hash_function, - &ssa_rename_from_equal, - &ssa_rename_from_delete); -} - -/* Find the REG entry in ssa_rename_from. Return NULL_RTX if no entry is - found. */ - -static rtx -ssa_rename_from_lookup (reg) - int reg; -{ - ssa_rename_from_pair srfp; - ssa_rename_from_pair *answer; - srfp.reg = reg; - srfp.original = NULL_RTX; - answer = (ssa_rename_from_pair *) - htab_find_with_hash (ssa_rename_from_ht, (void *) &srfp, reg); - return (answer == 0 ? NULL_RTX : answer->original); -} - -/* Find the number of the original register specified by REGNO. If - the register is a pseudo, return the original register's number. - Otherwise, return this register number REGNO. */ - -static unsigned int -original_register (regno) - unsigned int regno; -{ - rtx original_rtx = ssa_rename_from_lookup (regno); - return original_rtx != NULL_RTX ? REGNO (original_rtx) : regno; -} - -/* Add mapping from R to REG to ssa_rename_from even if already present. */ - -static void -ssa_rename_from_insert (reg, r) - unsigned int reg; - rtx r; -{ - void **slot; - ssa_rename_from_pair *srfp = xmalloc (sizeof (ssa_rename_from_pair)); - srfp->reg = reg; - srfp->original = r; - slot = htab_find_slot_with_hash (ssa_rename_from_ht, (const void *) srfp, - reg, INSERT); - if (*slot != 0) - free ((void *) *slot); - *slot = srfp; -} - -/* Apply the CALLBACK_FUNCTION to each element in ssa_rename_from. - CANONICAL_ELEMENTS and REG_PARTITION pass data needed by the only - current use of this function. */ - -static void -ssa_rename_from_traverse (callback_function, - canonical_elements, reg_partition) - htab_trav callback_function; - sbitmap canonical_elements; - partition reg_partition; -{ - struct ssa_rename_from_hash_table_data srfhd; - srfhd.canonical_elements = canonical_elements; - srfhd.reg_partition = reg_partition; - htab_traverse (ssa_rename_from_ht, callback_function, (void *) &srfhd); -} - -/* Destroy ssa_rename_from. */ - -static void -ssa_rename_from_free () -{ - htab_delete (ssa_rename_from_ht); -} - -/* Print the contents of ssa_rename_from. */ - -/* static Avoid erroneous error message. */ -void -ssa_rename_from_print () -{ - printf ("ssa_rename_from's hash table contents:\n"); - htab_traverse (ssa_rename_from_ht, &ssa_rename_from_print_1, NULL); -} - -/* Print the contents of the hash table entry SLOT, passing the unused - sttribute DATA. Used as a callback function with htab_traverse (). */ - -static int -ssa_rename_from_print_1 (slot, data) - void **slot; - void *data ATTRIBUTE_UNUSED; -{ - ssa_rename_from_pair * p = *slot; - printf ("ssa_rename_from maps pseudo %i to original %i.\n", - p->reg, REGNO (p->original)); - return 1; -} - -/* Given a hash entry SRFP, yield a hash value. */ - -static hashval_t -ssa_rename_from_hash_function (srfp) - const void *srfp; -{ - return ((const ssa_rename_from_pair *) srfp)->reg; -} - -/* Test whether two hash table entries SRFP1 and SRFP2 are equal. */ - -static int -ssa_rename_from_equal (srfp1, srfp2) - const void *srfp1; - const void *srfp2; -{ - return ssa_rename_from_hash_function (srfp1) == - ssa_rename_from_hash_function (srfp2); -} - -/* Delete the hash table entry SRFP. */ - -static void -ssa_rename_from_delete (srfp) - void *srfp; -{ - free (srfp); -} - -/* Given the SET of a PHI node, return the address of the alternative - for predecessor block C. */ - -static inline rtx * -phi_alternative (set, c) - rtx set; - int c; -{ - rtvec phi_vec = XVEC (SET_SRC (set), 0); - int v; - - for (v = GET_NUM_ELEM (phi_vec) - 2; v >= 0; v -= 2) - if (INTVAL (RTVEC_ELT (phi_vec, v + 1)) == c) - return &RTVEC_ELT (phi_vec, v); - - return NULL; -} - -/* Given the SET of a phi node, remove the alternative for predecessor - block C. Return nonzero on success, or zero if no alternative is - found for C. */ - -int -remove_phi_alternative (set, block) - rtx set; - basic_block block; -{ - rtvec phi_vec = XVEC (SET_SRC (set), 0); - int num_elem = GET_NUM_ELEM (phi_vec); - int v, c; - - c = block->index; - for (v = num_elem - 2; v >= 0; v -= 2) - if (INTVAL (RTVEC_ELT (phi_vec, v + 1)) == c) - { - if (v < num_elem - 2) - { - RTVEC_ELT (phi_vec, v) = RTVEC_ELT (phi_vec, num_elem - 2); - RTVEC_ELT (phi_vec, v + 1) = RTVEC_ELT (phi_vec, num_elem - 1); - } - PUT_NUM_ELEM (phi_vec, num_elem - 2); - return 1; - } - - return 0; -} - -/* For all registers, find all blocks in which they are set. - - This is the transform of what would be local kill information that - we ought to be getting from flow. */ - -static sbitmap *fe_evals; -static int fe_current_bb; - -static void -find_evaluations_1 (dest, set, data) - rtx dest; - rtx set ATTRIBUTE_UNUSED; - void *data ATTRIBUTE_UNUSED; -{ - if (GET_CODE (dest) == REG - && CONVERT_REGISTER_TO_SSA_P (REGNO (dest))) - SET_BIT (fe_evals[REGNO (dest)], fe_current_bb); -} - -static void -find_evaluations (evals, nregs) - sbitmap *evals; - int nregs; -{ - basic_block bb; - - sbitmap_vector_zero (evals, nregs); - fe_evals = evals; - - FOR_EACH_BB_REVERSE (bb) - { - rtx p, last; - - fe_current_bb = bb->index; - p = bb->head; - last = bb->end; - while (1) - { - if (INSN_P (p)) - note_stores (PATTERN (p), find_evaluations_1, NULL); - - if (p == last) - break; - p = NEXT_INSN (p); - } - } -} - -/* Computing the Dominance Frontier: - - As decribed in Morgan, section 3.5, this may be done simply by - walking the dominator tree bottom-up, computing the frontier for - the children before the parent. When considering a block B, - there are two cases: - - (1) A flow graph edge leaving B that does not lead to a child - of B in the dominator tree must be a block that is either equal - to B or not dominated by B. Such blocks belong in the frontier - of B. - - (2) Consider a block X in the frontier of one of the children C - of B. If X is not equal to B and is not dominated by B, it - is in the frontier of B. -*/ - -static void -compute_dominance_frontiers_1 (frontiers, idom, bb, done) - sbitmap *frontiers; - dominance_info idom; - int bb; - sbitmap done; -{ - basic_block b = BASIC_BLOCK (bb); - edge e; - basic_block c; - - SET_BIT (done, bb); - sbitmap_zero (frontiers[bb]); - - /* Do the frontier of the children first. Not all children in the - dominator tree (blocks dominated by this one) are children in the - CFG, so check all blocks. */ - FOR_EACH_BB (c) - if (get_immediate_dominator (idom, c)->index == bb - && ! TEST_BIT (done, c->index)) - compute_dominance_frontiers_1 (frontiers, idom, c->index, done); - - /* Find blocks conforming to rule (1) above. */ - for (e = b->succ; e; e = e->succ_next) - { - if (e->dest == EXIT_BLOCK_PTR) - continue; - if (get_immediate_dominator (idom, e->dest)->index != bb) - SET_BIT (frontiers[bb], e->dest->index); - } - - /* Find blocks conforming to rule (2). */ - FOR_EACH_BB (c) - if (get_immediate_dominator (idom, c)->index == bb) - { - int x; - EXECUTE_IF_SET_IN_SBITMAP (frontiers[c->index], 0, x, - { - if (get_immediate_dominator (idom, BASIC_BLOCK (x))->index != bb) - SET_BIT (frontiers[bb], x); - }); - } -} - -void -compute_dominance_frontiers (frontiers, idom) - sbitmap *frontiers; - dominance_info idom; -{ - sbitmap done = sbitmap_alloc (last_basic_block); - sbitmap_zero (done); - - compute_dominance_frontiers_1 (frontiers, idom, 0, done); - - sbitmap_free (done); -} - -/* Computing the Iterated Dominance Frontier: - - This is the set of merge points for a given register. - - This is not particularly intuitive. See section 7.1 of Morgan, in - particular figures 7.3 and 7.4 and the immediately surrounding text. -*/ - -static void -compute_iterated_dominance_frontiers (idfs, frontiers, evals, nregs) - sbitmap *idfs; - sbitmap *frontiers; - sbitmap *evals; - int nregs; -{ - sbitmap worklist; - int reg, passes = 0; - - worklist = sbitmap_alloc (last_basic_block); - - for (reg = 0; reg < nregs; ++reg) - { - sbitmap idf = idfs[reg]; - int b, changed; - - /* Start the iterative process by considering those blocks that - evaluate REG. We'll add their dominance frontiers to the - IDF, and then consider the blocks we just added. */ - sbitmap_copy (worklist, evals[reg]); - - /* Morgan's algorithm is incorrect here. Blocks that evaluate - REG aren't necessarily in REG's IDF. Start with an empty IDF. */ - sbitmap_zero (idf); - - /* Iterate until the worklist is empty. */ - do - { - changed = 0; - passes++; - EXECUTE_IF_SET_IN_SBITMAP (worklist, 0, b, - { - RESET_BIT (worklist, b); - /* For each block on the worklist, add to the IDF all - blocks on its dominance frontier that aren't already - on the IDF. Every block that's added is also added - to the worklist. */ - sbitmap_union_of_diff (worklist, worklist, frontiers[b], idf); - sbitmap_a_or_b (idf, idf, frontiers[b]); - changed = 1; - }); - } - while (changed); - } - - sbitmap_free (worklist); - - if (rtl_dump_file) - { - fprintf (rtl_dump_file, - "Iterated dominance frontier: %d passes on %d regs.\n", - passes, nregs); - } -} - -/* Insert the phi nodes. */ - -static void -insert_phi_node (regno, bb) - int regno, bb; -{ - basic_block b = BASIC_BLOCK (bb); - edge e; - int npred, i; - rtvec vec; - rtx phi, reg; - rtx insn; - int end_p; - - /* Find out how many predecessors there are. */ - for (e = b->pred, npred = 0; e; e = e->pred_next) - if (e->src != ENTRY_BLOCK_PTR) - npred++; - - /* If this block has no "interesting" preds, then there is nothing to - do. Consider a block that only has the entry block as a pred. */ - if (npred == 0) - return; - - /* This is the register to which the phi function will be assigned. */ - reg = regno_reg_rtx[regno]; - - /* Construct the arguments to the PHI node. The use of pc_rtx is just - a placeholder; we'll insert the proper value in rename_registers. */ - vec = rtvec_alloc (npred * 2); - for (e = b->pred, i = 0; e ; e = e->pred_next, i += 2) - if (e->src != ENTRY_BLOCK_PTR) - { - RTVEC_ELT (vec, i + 0) = pc_rtx; - RTVEC_ELT (vec, i + 1) = GEN_INT (e->src->index); - } - - phi = gen_rtx_PHI (VOIDmode, vec); - phi = gen_rtx_SET (VOIDmode, reg, phi); - - insn = first_insn_after_basic_block_note (b); - end_p = PREV_INSN (insn) == b->end; - emit_insn_before (phi, insn); - if (end_p) - b->end = PREV_INSN (insn); -} - -static void -insert_phi_nodes (idfs, evals, nregs) - sbitmap *idfs; - sbitmap *evals ATTRIBUTE_UNUSED; - int nregs; -{ - int reg; - - for (reg = 0; reg < nregs; ++reg) - if (CONVERT_REGISTER_TO_SSA_P (reg)) - { - int b; - EXECUTE_IF_SET_IN_SBITMAP (idfs[reg], 0, b, - { - if (REGNO_REG_SET_P (BASIC_BLOCK (b)->global_live_at_start, reg)) - insert_phi_node (reg, b); - }); - } -} - -/* Rename the registers to conform to SSA. - - This is essentially the algorithm presented in Figure 7.8 of Morgan, - with a few changes to reduce pattern search time in favor of a bit - more memory usage. */ - -/* One of these is created for each set. It will live in a list local - to its basic block for the duration of that block's processing. */ -struct rename_set_data -{ - struct rename_set_data *next; - /* This is the SET_DEST of the (first) SET that sets the REG. */ - rtx *reg_loc; - /* This is what used to be at *REG_LOC. */ - rtx old_reg; - /* This is the REG that will replace OLD_REG. It's set only - when the rename data is moved onto the DONE_RENAMES queue. */ - rtx new_reg; - /* This is what to restore ssa_rename_to_lookup (old_reg) to. It is - usually the previous contents of ssa_rename_to_lookup (old_reg). */ - rtx prev_reg; - /* This is the insn that contains all the SETs of the REG. */ - rtx set_insn; -}; - -/* This struct is used to pass information to callback functions while - renaming registers. */ -struct rename_context -{ - struct rename_set_data *new_renames; - struct rename_set_data *done_renames; - rtx current_insn; -}; - -/* Queue the rename of *REG_LOC. */ -static void -create_delayed_rename (c, reg_loc) - struct rename_context *c; - rtx *reg_loc; -{ - struct rename_set_data *r; - r = (struct rename_set_data *) xmalloc (sizeof(*r)); - - if (GET_CODE (*reg_loc) != REG - || !CONVERT_REGISTER_TO_SSA_P (REGNO (*reg_loc))) - abort (); - - r->reg_loc = reg_loc; - r->old_reg = *reg_loc; - r->prev_reg = ssa_rename_to_lookup(r->old_reg); - r->set_insn = c->current_insn; - r->next = c->new_renames; - c->new_renames = r; -} - -/* This is part of a rather ugly hack to allow the pre-ssa regno to be - reused. If, during processing, a register has not yet been touched, - ssa_rename_to[regno][machno] will be NULL. Now, in the course of pushing - and popping values from ssa_rename_to, when we would ordinarily - pop NULL back in, we pop RENAME_NO_RTX. We treat this exactly the - same as NULL, except that it signals that the original regno has - already been reused. */ -#define RENAME_NO_RTX pc_rtx - -/* Move all the entries from NEW_RENAMES onto DONE_RENAMES by - applying all the renames on NEW_RENAMES. */ - -static void -apply_delayed_renames (c) - struct rename_context *c; -{ - struct rename_set_data *r; - struct rename_set_data *last_r = NULL; - - for (r = c->new_renames; r != NULL; r = r->next) - { - int new_regno; - - /* Failure here means that someone has a PARALLEL that sets - a register twice (bad!). */ - if (ssa_rename_to_lookup (r->old_reg) != r->prev_reg) - abort (); - /* Failure here means we have changed REG_LOC before applying - the rename. */ - /* For the first set we come across, reuse the original regno. */ - if (r->prev_reg == NULL_RTX && !HARD_REGISTER_P (r->old_reg)) - { - r->new_reg = r->old_reg; - /* We want to restore RENAME_NO_RTX rather than NULL_RTX. */ - r->prev_reg = RENAME_NO_RTX; - } - else - r->new_reg = gen_reg_rtx (GET_MODE (r->old_reg)); - new_regno = REGNO (r->new_reg); - ssa_rename_to_insert (r->old_reg, r->new_reg); - - if (new_regno >= (int) ssa_definition->num_elements) - { - int new_limit = new_regno * 5 / 4; - VARRAY_GROW (ssa_definition, new_limit); - } - - VARRAY_RTX (ssa_definition, new_regno) = r->set_insn; - ssa_rename_from_insert (new_regno, r->old_reg); - last_r = r; - } - if (last_r != NULL) - { - last_r->next = c->done_renames; - c->done_renames = c->new_renames; - c->new_renames = NULL; - } -} - -/* Part one of the first step of rename_block, called through for_each_rtx. - Mark pseudos that are set for later update. Transform uses of pseudos. */ - -static int -rename_insn_1 (ptr, data) - rtx *ptr; - void *data; -{ - rtx x = *ptr; - struct rename_context *context = data; - - if (x == NULL_RTX) - return 0; - - switch (GET_CODE (x)) - { - case SET: - { - rtx *destp = &SET_DEST (x); - rtx dest = SET_DEST (x); - - /* An assignment to a paradoxical SUBREG does not read from - the destination operand, and thus does not need to be - wrapped into a SEQUENCE when translating into SSA form. - We merely strip off the SUBREG and proceed normally for - this case. */ - if (GET_CODE (dest) == SUBREG - && (GET_MODE_SIZE (GET_MODE (dest)) - > GET_MODE_SIZE (GET_MODE (SUBREG_REG (dest)))) - && GET_CODE (SUBREG_REG (dest)) == REG - && CONVERT_REGISTER_TO_SSA_P (REGNO (SUBREG_REG (dest)))) - { - destp = &XEXP (dest, 0); - dest = XEXP (dest, 0); - } - - /* Some SETs also use the REG specified in their LHS. - These can be detected by the presence of - STRICT_LOW_PART, SUBREG, SIGN_EXTRACT, and ZERO_EXTRACT - in the LHS. Handle these by changing - (set (subreg (reg foo)) ...) - into - (sequence [(set (reg foo_1) (reg foo)) - (set (subreg (reg foo_1)) ...)]) - - FIXME: Much of the time this is too much. For some constructs - we know that the output register is strictly an output - (paradoxical SUBREGs and some libcalls for example). - - For those cases we are better off not making the false - dependency. */ - if (GET_CODE (dest) == STRICT_LOW_PART - || GET_CODE (dest) == SUBREG - || GET_CODE (dest) == SIGN_EXTRACT - || GET_CODE (dest) == ZERO_EXTRACT) - { - rtx i, reg; - reg = dest; - - while (GET_CODE (reg) == STRICT_LOW_PART - || GET_CODE (reg) == SUBREG - || GET_CODE (reg) == SIGN_EXTRACT - || GET_CODE (reg) == ZERO_EXTRACT) - reg = XEXP (reg, 0); - - if (GET_CODE (reg) == REG - && CONVERT_REGISTER_TO_SSA_P (REGNO (reg))) - { - /* Generate (set reg reg), and do renaming on it so - that it becomes (set reg_1 reg_0), and we will - replace reg with reg_1 in the SUBREG. */ - - struct rename_set_data *saved_new_renames; - saved_new_renames = context->new_renames; - context->new_renames = NULL; - i = emit_insn (gen_rtx_SET (VOIDmode, reg, reg)); - for_each_rtx (&i, rename_insn_1, data); - apply_delayed_renames (context); - context->new_renames = saved_new_renames; - } - } - else if (GET_CODE (dest) == REG - && CONVERT_REGISTER_TO_SSA_P (REGNO (dest))) - { - /* We found a genuine set of an interesting register. Tag - it so that we can create a new name for it after we finish - processing this insn. */ - - create_delayed_rename (context, destp); - - /* Since we do not wish to (directly) traverse the - SET_DEST, recurse through for_each_rtx for the SET_SRC - and return. */ - if (GET_CODE (x) == SET) - for_each_rtx (&SET_SRC (x), rename_insn_1, data); - return -1; - } - - /* Otherwise, this was not an interesting destination. Continue - on, marking uses as normal. */ - return 0; - } - - case REG: - if (CONVERT_REGISTER_TO_SSA_P (REGNO (x)) - && REGNO (x) < ssa_max_reg_num) - { - rtx new_reg = ssa_rename_to_lookup (x); - - if (new_reg != RENAME_NO_RTX && new_reg != NULL_RTX) - { - if (GET_MODE (x) != GET_MODE (new_reg)) - abort (); - *ptr = new_reg; - } - else - { - /* Undefined value used, rename it to a new pseudo register so - that it cannot conflict with an existing register. */ - *ptr = gen_reg_rtx (GET_MODE (x)); - } - } - return -1; - - case CLOBBER: - /* There is considerable debate on how CLOBBERs ought to be - handled in SSA. For now, we're keeping the CLOBBERs, which - means that we don't really have SSA form. There are a couple - of proposals for how to fix this problem, but neither is - implemented yet. */ - { - rtx dest = XCEXP (x, 0, CLOBBER); - if (REG_P (dest)) - { - if (CONVERT_REGISTER_TO_SSA_P (REGNO (dest)) - && REGNO (dest) < ssa_max_reg_num) - { - rtx new_reg = ssa_rename_to_lookup (dest); - if (new_reg != NULL_RTX && new_reg != RENAME_NO_RTX) - XCEXP (x, 0, CLOBBER) = new_reg; - } - /* Stop traversing. */ - return -1; - } - else - /* Continue traversing. */ - return 0; - } - - case PHI: - /* Never muck with the phi. We do that elsewhere, special-like. */ - return -1; - - default: - /* Anything else, continue traversing. */ - return 0; - } -} - -static rtx -gen_sequence () -{ - rtx first_insn = get_insns (); - rtx result; - rtx tem; - int i; - int len; - - /* Count the insns in the chain. */ - len = 0; - for (tem = first_insn; tem; tem = NEXT_INSN (tem)) - len++; - - result = gen_rtx_SEQUENCE (VOIDmode, rtvec_alloc (len)); - - for (i = 0, tem = first_insn; tem; tem = NEXT_INSN (tem), i++) - XVECEXP (result, 0, i) = tem; - - return result; -} - -static void -rename_block (bb, idom) - int bb; - dominance_info idom; -{ - basic_block b = BASIC_BLOCK (bb); - edge e; - rtx insn, next, last; - struct rename_set_data *set_data = NULL; - basic_block c; - - /* Step One: Walk the basic block, adding new names for sets and - replacing uses. */ - - next = b->head; - last = b->end; - do - { - insn = next; - if (INSN_P (insn)) - { - struct rename_context context; - context.done_renames = set_data; - context.new_renames = NULL; - context.current_insn = insn; - - start_sequence (); - for_each_rtx (&PATTERN (insn), rename_insn_1, &context); - for_each_rtx (®_NOTES (insn), rename_insn_1, &context); - - /* Sometimes, we end up with a sequence of insns that - SSA needs to treat as a single insn. Wrap these in a - SEQUENCE. (Any notes now get attached to the SEQUENCE, - not to the old version inner insn.) */ - if (get_insns () != NULL_RTX) - { - rtx seq; - int i; - - emit (PATTERN (insn)); - seq = gen_sequence (); - /* We really want a SEQUENCE of SETs, not a SEQUENCE - of INSNs. */ - for (i = 0; i < XVECLEN (seq, 0); i++) - XVECEXP (seq, 0, i) = PATTERN (XVECEXP (seq, 0, i)); - PATTERN (insn) = seq; - } - end_sequence (); - - apply_delayed_renames (&context); - set_data = context.done_renames; - } - - next = NEXT_INSN (insn); - } - while (insn != last); - - /* Step Two: Update the phi nodes of this block's successors. */ - - for (e = b->succ; e; e = e->succ_next) - { - if (e->dest == EXIT_BLOCK_PTR) - continue; - - insn = first_insn_after_basic_block_note (e->dest); - - while (PHI_NODE_P (insn)) - { - rtx phi = PATTERN (insn); - rtx reg; - - /* Find out which of our outgoing registers this node is - intended to replace. Note that if this is not the first PHI - node to have been created for this register, we have to - jump through rename links to figure out which register - we're talking about. This can easily be recognized by - noting that the regno is new to this pass. */ - reg = SET_DEST (phi); - if (REGNO (reg) >= ssa_max_reg_num) - reg = ssa_rename_from_lookup (REGNO (reg)); - if (reg == NULL_RTX) - abort (); - reg = ssa_rename_to_lookup (reg); - - /* It is possible for the variable to be uninitialized on - edges in. Reduce the arity of the PHI so that we don't - consider those edges. */ - if (reg == NULL || reg == RENAME_NO_RTX) - { - if (! remove_phi_alternative (phi, b)) - abort (); - } - else - { - /* When we created the PHI nodes, we did not know what mode - the register should be. Now that we've found an original, - we can fill that in. */ - if (GET_MODE (SET_DEST (phi)) == VOIDmode) - PUT_MODE (SET_DEST (phi), GET_MODE (reg)); - else if (GET_MODE (SET_DEST (phi)) != GET_MODE (reg)) - abort (); - - *phi_alternative (phi, bb) = reg; - } - - insn = NEXT_INSN (insn); - } - } - - /* Step Three: Do the same to the children of this block in - dominator order. */ - - FOR_EACH_BB (c) - if (get_immediate_dominator (idom, c)->index == bb) - rename_block (c->index, idom); - - /* Step Four: Update the sets to refer to their new register, - and restore ssa_rename_to to its previous state. */ - - while (set_data) - { - struct rename_set_data *next; - rtx old_reg = *set_data->reg_loc; - - if (*set_data->reg_loc != set_data->old_reg) - abort (); - *set_data->reg_loc = set_data->new_reg; - - ssa_rename_to_insert (old_reg, set_data->prev_reg); - - next = set_data->next; - free (set_data); - set_data = next; - } -} - -static void -rename_registers (nregs, idom) - int nregs; - dominance_info idom; -{ - VARRAY_RTX_INIT (ssa_definition, nregs * 3, "ssa_definition"); - ssa_rename_from_initialize (); - - ssa_rename_to_pseudo = (rtx *) alloca (nregs * sizeof(rtx)); - memset ((char *) ssa_rename_to_pseudo, 0, nregs * sizeof(rtx)); - memset ((char *) ssa_rename_to_hard, 0, - FIRST_PSEUDO_REGISTER * NUM_MACHINE_MODES * sizeof (rtx)); - - rename_block (0, idom); - - /* ??? Update basic_block_live_at_start, and other flow info - as needed. */ - - ssa_rename_to_pseudo = NULL; -} - -/* The main entry point for moving to SSA. */ - -void -convert_to_ssa () -{ - /* Element I is the set of blocks that set register I. */ - sbitmap *evals; - - /* Dominator bitmaps. */ - sbitmap *dfs; - sbitmap *idfs; - - /* Element I is the immediate dominator of block I. */ - dominance_info idom; - - int nregs; - - basic_block bb; - - /* Don't do it twice. */ - if (in_ssa_form) - abort (); - - /* Need global_live_at_{start,end} up to date. Do not remove any - dead code. We'll let the SSA optimizers do that. */ - life_analysis (get_insns (), NULL, 0); - - idom = calculate_dominance_info (CDI_DOMINATORS); - - if (rtl_dump_file) - { - fputs (";; Immediate Dominators:\n", rtl_dump_file); - FOR_EACH_BB (bb) - fprintf (rtl_dump_file, ";\t%3d = %3d\n", bb->index, - get_immediate_dominator (idom, bb)->index); - fflush (rtl_dump_file); - } - - /* Compute dominance frontiers. */ - - dfs = sbitmap_vector_alloc (last_basic_block, last_basic_block); - compute_dominance_frontiers (dfs, idom); - - if (rtl_dump_file) - { - dump_sbitmap_vector (rtl_dump_file, ";; Dominance Frontiers:", - "; Basic Block", dfs, last_basic_block); - fflush (rtl_dump_file); - } - - /* Compute register evaluations. */ - - ssa_max_reg_num = max_reg_num (); - nregs = ssa_max_reg_num; - evals = sbitmap_vector_alloc (nregs, last_basic_block); - find_evaluations (evals, nregs); - - /* Compute the iterated dominance frontier for each register. */ - - idfs = sbitmap_vector_alloc (nregs, last_basic_block); - compute_iterated_dominance_frontiers (idfs, dfs, evals, nregs); - - if (rtl_dump_file) - { - dump_sbitmap_vector (rtl_dump_file, ";; Iterated Dominance Frontiers:", - "; Register", idfs, nregs); - fflush (rtl_dump_file); - } - - /* Insert the phi nodes. */ - - insert_phi_nodes (idfs, evals, nregs); - - /* Rename the registers to satisfy SSA. */ - - rename_registers (nregs, idom); - - /* All done! Clean up and go home. */ - - sbitmap_vector_free (dfs); - sbitmap_vector_free (evals); - sbitmap_vector_free (idfs); - in_ssa_form = 1; - - reg_scan (get_insns (), max_reg_num (), 1); - free_dominance_info (idom); -} - -/* REG is the representative temporary of its partition. Add it to the - set of nodes to be processed, if it hasn't been already. Return the - index of this register in the node set. */ - -static inline int -ephi_add_node (reg, nodes, n_nodes) - rtx reg, *nodes; - int *n_nodes; -{ - int i; - for (i = *n_nodes - 1; i >= 0; --i) - if (REGNO (reg) == REGNO (nodes[i])) - return i; - - nodes[i = (*n_nodes)++] = reg; - return i; -} - -/* Part one of the topological sort. This is a forward (downward) search - through the graph collecting a stack of nodes to process. Assuming no - cycles, the nodes at top of the stack when we are finished will have - no other dependencies. */ - -static int * -ephi_forward (t, visited, succ, tstack) - int t; - sbitmap visited; - sbitmap *succ; - int *tstack; -{ - int s; - - SET_BIT (visited, t); - - EXECUTE_IF_SET_IN_SBITMAP (succ[t], 0, s, - { - if (! TEST_BIT (visited, s)) - tstack = ephi_forward (s, visited, succ, tstack); - }); - - *tstack++ = t; - return tstack; -} - -/* Part two of the topological sort. The is a backward search through - a cycle in the graph, copying the data forward as we go. */ - -static void -ephi_backward (t, visited, pred, nodes) - int t; - sbitmap visited, *pred; - rtx *nodes; -{ - int p; - - SET_BIT (visited, t); - - EXECUTE_IF_SET_IN_SBITMAP (pred[t], 0, p, - { - if (! TEST_BIT (visited, p)) - { - ephi_backward (p, visited, pred, nodes); - emit_move_insn (nodes[p], nodes[t]); - } - }); -} - -/* Part two of the topological sort. Create the copy for a register - and any cycle of which it is a member. */ - -static void -ephi_create (t, visited, pred, succ, nodes) - int t; - sbitmap visited, *pred, *succ; - rtx *nodes; -{ - rtx reg_u = NULL_RTX; - int unvisited_predecessors = 0; - int p; - - /* Iterate through the predecessor list looking for unvisited nodes. - If there are any, we have a cycle, and must deal with that. At - the same time, look for a visited predecessor. If there is one, - we won't need to create a temporary. */ - - EXECUTE_IF_SET_IN_SBITMAP (pred[t], 0, p, - { - if (! TEST_BIT (visited, p)) - unvisited_predecessors = 1; - else if (!reg_u) - reg_u = nodes[p]; - }); - - if (unvisited_predecessors) - { - /* We found a cycle. Copy out one element of the ring (if necessary), - then traverse the ring copying as we go. */ - - if (!reg_u) - { - reg_u = gen_reg_rtx (GET_MODE (nodes[t])); - emit_move_insn (reg_u, nodes[t]); - } - - EXECUTE_IF_SET_IN_SBITMAP (pred[t], 0, p, - { - if (! TEST_BIT (visited, p)) - { - ephi_backward (p, visited, pred, nodes); - emit_move_insn (nodes[p], reg_u); - } - }); - } - else - { - /* No cycle. Just copy the value from a successor. */ - - int s; - EXECUTE_IF_SET_IN_SBITMAP (succ[t], 0, s, - { - SET_BIT (visited, t); - emit_move_insn (nodes[t], nodes[s]); - return; - }); - } -} - -/* Convert the edge to normal form. */ - -static void -eliminate_phi (e, reg_partition) - edge e; - partition reg_partition; -{ - int n_nodes; - sbitmap *pred, *succ; - sbitmap visited; - rtx *nodes; - int *stack, *tstack; - rtx insn; - int i; - - /* Collect an upper bound on the number of registers needing processing. */ - - insn = first_insn_after_basic_block_note (e->dest); - - n_nodes = 0; - while (PHI_NODE_P (insn)) - { - insn = next_nonnote_insn (insn); - n_nodes += 2; - } - - if (n_nodes == 0) - return; - - /* Build the auxiliary graph R(B). - - The nodes of the graph are the members of the register partition - present in Phi(B). There is an edge from FIND(T0)->FIND(T1) for - each T0 = PHI(...,T1,...), where T1 is for the edge from block C. */ - - nodes = (rtx *) alloca (n_nodes * sizeof(rtx)); - pred = sbitmap_vector_alloc (n_nodes, n_nodes); - succ = sbitmap_vector_alloc (n_nodes, n_nodes); - sbitmap_vector_zero (pred, n_nodes); - sbitmap_vector_zero (succ, n_nodes); - - insn = first_insn_after_basic_block_note (e->dest); - - n_nodes = 0; - for (; PHI_NODE_P (insn); insn = next_nonnote_insn (insn)) - { - rtx* preg = phi_alternative (PATTERN (insn), e->src->index); - rtx tgt = SET_DEST (PATTERN (insn)); - rtx reg; - - /* There may be no phi alternative corresponding to this edge. - This indicates that the phi variable is undefined along this - edge. */ - if (preg == NULL) - continue; - reg = *preg; - - if (GET_CODE (reg) != REG || GET_CODE (tgt) != REG) - abort (); - - reg = regno_reg_rtx[partition_find (reg_partition, REGNO (reg))]; - tgt = regno_reg_rtx[partition_find (reg_partition, REGNO (tgt))]; - /* If the two registers are already in the same partition, - nothing will need to be done. */ - if (reg != tgt) - { - int ireg, itgt; - - ireg = ephi_add_node (reg, nodes, &n_nodes); - itgt = ephi_add_node (tgt, nodes, &n_nodes); - - SET_BIT (pred[ireg], itgt); - SET_BIT (succ[itgt], ireg); - } - } - - if (n_nodes == 0) - goto out; - - /* Begin a topological sort of the graph. */ - - visited = sbitmap_alloc (n_nodes); - sbitmap_zero (visited); - - tstack = stack = (int *) alloca (n_nodes * sizeof (int)); - - for (i = 0; i < n_nodes; ++i) - if (! TEST_BIT (visited, i)) - tstack = ephi_forward (i, visited, succ, tstack); - - sbitmap_zero (visited); - - /* As we find a solution to the tsort, collect the implementation - insns in a sequence. */ - start_sequence (); - - while (tstack != stack) - { - i = *--tstack; - if (! TEST_BIT (visited, i)) - ephi_create (i, visited, pred, succ, nodes); - } - - insn = get_insns (); - end_sequence (); - insert_insn_on_edge (insn, e); - if (rtl_dump_file) - fprintf (rtl_dump_file, "Emitting copy on edge (%d,%d)\n", - e->src->index, e->dest->index); - - sbitmap_free (visited); -out: - sbitmap_vector_free (pred); - sbitmap_vector_free (succ); -} - -/* For basic block B, consider all phi insns which provide an - alternative corresponding to an incoming abnormal critical edge. - Place the phi alternative corresponding to that abnormal critical - edge in the same register class as the destination of the set. - - From Morgan, p. 178: - - For each abnormal critical edge (C, B), - if T0 = phi (T1, ..., Ti, ..., Tm) is a phi node in B, - and C is the ith predecessor of B, - then T0 and Ti must be equivalent. - - Return nonzero iff any such cases were found for which the two - regs were not already in the same class. */ - -static int -make_regs_equivalent_over_bad_edges (bb, reg_partition) - int bb; - partition reg_partition; -{ - int changed = 0; - basic_block b = BASIC_BLOCK (bb); - rtx phi; - - /* Advance to the first phi node. */ - phi = first_insn_after_basic_block_note (b); - - /* Scan all the phi nodes. */ - for (; - PHI_NODE_P (phi); - phi = next_nonnote_insn (phi)) - { - edge e; - int tgt_regno; - rtx set = PATTERN (phi); - rtx tgt = SET_DEST (set); - - /* The set target is expected to be an SSA register. */ - if (GET_CODE (tgt) != REG - || !CONVERT_REGISTER_TO_SSA_P (REGNO (tgt))) - abort (); - tgt_regno = REGNO (tgt); - - /* Scan incoming abnormal critical edges. */ - for (e = b->pred; e; e = e->pred_next) - if ((e->flags & EDGE_ABNORMAL) && EDGE_CRITICAL_P (e)) - { - rtx *alt = phi_alternative (set, e->src->index); - int alt_regno; - - /* If there is no alternative corresponding to this edge, - the value is undefined along the edge, so just go on. */ - if (alt == 0) - continue; - - /* The phi alternative is expected to be an SSA register. */ - if (GET_CODE (*alt) != REG - || !CONVERT_REGISTER_TO_SSA_P (REGNO (*alt))) - abort (); - alt_regno = REGNO (*alt); - - /* If the set destination and the phi alternative aren't - already in the same class... */ - if (partition_find (reg_partition, tgt_regno) - != partition_find (reg_partition, alt_regno)) - { - /* ... make them such. */ - if (conflicting_hard_regs_p (tgt_regno, alt_regno)) - /* It is illegal to unify a hard register with a - different register. */ - abort (); - - partition_union (reg_partition, - tgt_regno, alt_regno); - ++changed; - } - } - } - - return changed; -} - -/* Consider phi insns in basic block BB pairwise. If the set target - of both isns are equivalent pseudos, make the corresponding phi - alternatives in each phi corresponding equivalent. - - Return nonzero if any new register classes were unioned. */ - -static int -make_equivalent_phi_alternatives_equivalent (bb, reg_partition) - int bb; - partition reg_partition; -{ - int changed = 0; - basic_block b = BASIC_BLOCK (bb); - rtx phi; - - /* Advance to the first phi node. */ - phi = first_insn_after_basic_block_note (b); - - /* Scan all the phi nodes. */ - for (; - PHI_NODE_P (phi); - phi = next_nonnote_insn (phi)) - { - rtx set = PATTERN (phi); - /* The regno of the destination of the set. */ - int tgt_regno = REGNO (SET_DEST (PATTERN (phi))); - - rtx phi2 = next_nonnote_insn (phi); - - /* Scan all phi nodes following this one. */ - for (; - PHI_NODE_P (phi2); - phi2 = next_nonnote_insn (phi2)) - { - rtx set2 = PATTERN (phi2); - /* The regno of the destination of the set. */ - int tgt2_regno = REGNO (SET_DEST (set2)); - - /* Are the set destinations equivalent regs? */ - if (partition_find (reg_partition, tgt_regno) == - partition_find (reg_partition, tgt2_regno)) - { - edge e; - /* Scan over edges. */ - for (e = b->pred; e; e = e->pred_next) - { - int pred_block = e->src->index; - /* Identify the phi alternatives from both phi - nodes corresponding to this edge. */ - rtx *alt = phi_alternative (set, pred_block); - rtx *alt2 = phi_alternative (set2, pred_block); - - /* If one of the phi nodes doesn't have a - corresponding alternative, just skip it. */ - if (alt == 0 || alt2 == 0) - continue; - - /* Both alternatives should be SSA registers. */ - if (GET_CODE (*alt) != REG - || !CONVERT_REGISTER_TO_SSA_P (REGNO (*alt))) - abort (); - if (GET_CODE (*alt2) != REG - || !CONVERT_REGISTER_TO_SSA_P (REGNO (*alt2))) - abort (); - - /* If the alternatives aren't already in the same - class ... */ - if (partition_find (reg_partition, REGNO (*alt)) - != partition_find (reg_partition, REGNO (*alt2))) - { - /* ... make them so. */ - if (conflicting_hard_regs_p (REGNO (*alt), REGNO (*alt2))) - /* It is illegal to unify a hard register with - a different register. */ - abort (); - - partition_union (reg_partition, - REGNO (*alt), REGNO (*alt2)); - ++changed; - } - } - } - } - } - - return changed; -} - -/* Compute a conservative partition of outstanding pseudo registers. - See Morgan 7.3.1. */ - -static partition -compute_conservative_reg_partition () -{ - basic_block bb; - int changed = 0; - - /* We don't actually work with hard registers, but it's easier to - carry them around anyway rather than constantly doing register - number arithmetic. */ - partition p = - partition_new (ssa_definition->num_elements); - - /* The first priority is to make sure registers that might have to - be copied on abnormal critical edges are placed in the same - partition. This saves us from having to split abnormal critical - edges. */ - FOR_EACH_BB_REVERSE (bb) - changed += make_regs_equivalent_over_bad_edges (bb->index, p); - - /* Now we have to insure that corresponding arguments of phi nodes - assigning to corresponding regs are equivalent. Iterate until - nothing changes. */ - while (changed > 0) - { - changed = 0; - FOR_EACH_BB_REVERSE (bb) - changed += make_equivalent_phi_alternatives_equivalent (bb->index, p); - } - - return p; -} - -/* The following functions compute a register partition that attempts - to eliminate as many reg copies and phi node copies as possible by - coalescing registers. This is the strategy: - - 1. As in the conservative case, the top priority is to coalesce - registers that otherwise would cause copies to be placed on - abnormal critical edges (which isn't possible). - - 2. Figure out which regs are involved (in the LHS or RHS) of - copies and phi nodes. Compute conflicts among these regs. - - 3. Walk around the instruction stream, placing two regs in the - same class of the partition if one appears on the LHS and the - other on the RHS of a copy or phi node and the two regs don't - conflict. The conflict information of course needs to be - updated. - - 4. If anything has changed, there may be new opportunities to - coalesce regs, so go back to 2. -*/ - -/* If REG1 and REG2 don't conflict in CONFLICTS, place them in the - same class of partition P, if they aren't already. Update - CONFLICTS appropriately. - - Returns one if REG1 and REG2 were placed in the same class but were - not previously; zero otherwise. - - See Morgan figure 11.15. */ - -static int -coalesce_if_unconflicting (p, conflicts, reg1, reg2) - partition p; - conflict_graph conflicts; - int reg1; - int reg2; -{ - int reg; - - /* Work only on SSA registers. */ - if (!CONVERT_REGISTER_TO_SSA_P (reg1) || !CONVERT_REGISTER_TO_SSA_P (reg2)) - return 0; - - /* Find the canonical regs for the classes containing REG1 and - REG2. */ - reg1 = partition_find (p, reg1); - reg2 = partition_find (p, reg2); - - /* If they're already in the same class, there's nothing to do. */ - if (reg1 == reg2) - return 0; - - /* If the regs conflict, our hands are tied. */ - if (conflicting_hard_regs_p (reg1, reg2) || - conflict_graph_conflict_p (conflicts, reg1, reg2)) - return 0; - - /* We're good to go. Put the regs in the same partition. */ - partition_union (p, reg1, reg2); - - /* Find the new canonical reg for the merged class. */ - reg = partition_find (p, reg1); - - /* Merge conflicts from the two previous classes. */ - conflict_graph_merge_regs (conflicts, reg, reg1); - conflict_graph_merge_regs (conflicts, reg, reg2); - - return 1; -} - -/* For each register copy insn in basic block BB, place the LHS and - RHS regs in the same class in partition P if they do not conflict - according to CONFLICTS. - - Returns the number of changes that were made to P. - - See Morgan figure 11.14. */ - -static int -coalesce_regs_in_copies (bb, p, conflicts) - basic_block bb; - partition p; - conflict_graph conflicts; -{ - int changed = 0; - rtx insn; - rtx end = bb->end; - - /* Scan the instruction stream of the block. */ - for (insn = bb->head; insn != end; insn = NEXT_INSN (insn)) - { - rtx pattern; - rtx src; - rtx dest; - - /* If this isn't a set insn, go to the next insn. */ - if (GET_CODE (insn) != INSN) - continue; - pattern = PATTERN (insn); - if (GET_CODE (pattern) != SET) - continue; - - src = SET_SRC (pattern); - dest = SET_DEST (pattern); - - /* We're only looking for copies. */ - if (GET_CODE (src) != REG || GET_CODE (dest) != REG) - continue; - - /* Coalesce only if the reg modes are the same. As long as - each reg's rtx is unique, it can have only one mode, so two - pseudos of different modes can't be coalesced into one. - - FIXME: We can probably get around this by inserting SUBREGs - where appropriate, but for now we don't bother. */ - if (GET_MODE (src) != GET_MODE (dest)) - continue; - - /* Found a copy; see if we can use the same reg for both the - source and destination (and thus eliminate the copy, - ultimately). */ - changed += coalesce_if_unconflicting (p, conflicts, - REGNO (src), REGNO (dest)); - } - - return changed; -} - -struct phi_coalesce_context -{ - partition p; - conflict_graph conflicts; - int changed; -}; - -/* Callback function for for_each_successor_phi. If the set - destination and the phi alternative regs do not conflict, place - them in the same paritition class. DATA is a pointer to a - phi_coalesce_context struct. */ - -static int -coalesce_reg_in_phi (insn, dest_regno, src_regno, data) - rtx insn ATTRIBUTE_UNUSED; - int dest_regno; - int src_regno; - void *data; -{ - struct phi_coalesce_context *context = - (struct phi_coalesce_context *) data; - - /* Attempt to use the same reg, if they don't conflict. */ - context->changed - += coalesce_if_unconflicting (context->p, context->conflicts, - dest_regno, src_regno); - return 0; -} - -/* For each alternative in a phi function corresponding to basic block - BB (in phi nodes in successor block to BB), place the reg in the - phi alternative and the reg to which the phi value is set into the - same class in partition P, if allowed by CONFLICTS. - - Return the number of changes that were made to P. - - See Morgan figure 11.14. */ - -static int -coalesce_regs_in_successor_phi_nodes (bb, p, conflicts) - basic_block bb; - partition p; - conflict_graph conflicts; -{ - struct phi_coalesce_context context; - context.p = p; - context.conflicts = conflicts; - context.changed = 0; - - for_each_successor_phi (bb, &coalesce_reg_in_phi, &context); - - return context.changed; -} - -/* Compute and return a partition of pseudos. Where possible, - non-conflicting pseudos are placed in the same class. - - The caller is responsible for deallocating the returned partition. */ - -static partition -compute_coalesced_reg_partition () -{ - basic_block bb; - int changed = 0; - regset_head phi_set_head; - regset phi_set = &phi_set_head; - - partition p = - partition_new (ssa_definition->num_elements); - - /* The first priority is to make sure registers that might have to - be copied on abnormal critical edges are placed in the same - partition. This saves us from having to split abnormal critical - edges (which can't be done). */ - FOR_EACH_BB_REVERSE (bb) - make_regs_equivalent_over_bad_edges (bb->index, p); - - INIT_REG_SET (phi_set); - - do - { - conflict_graph conflicts; - - changed = 0; - - /* Build the set of registers involved in phi nodes, either as - arguments to the phi function or as the target of a set. */ - CLEAR_REG_SET (phi_set); - mark_phi_and_copy_regs (phi_set); - - /* Compute conflicts. */ - conflicts = conflict_graph_compute (phi_set, p); - - /* FIXME: Better would be to process most frequently executed - blocks first, so that most frequently executed copies would - be more likely to be removed by register coalescing. But any - order will generate correct, if non-optimal, results. */ - FOR_EACH_BB_REVERSE (bb) - { - changed += coalesce_regs_in_copies (bb, p, conflicts); - changed += - coalesce_regs_in_successor_phi_nodes (bb, p, conflicts); - } - - conflict_graph_delete (conflicts); - } - while (changed > 0); - - FREE_REG_SET (phi_set); - - return p; -} - -/* Mark the regs in a phi node. PTR is a phi expression or one of its - components (a REG or a CONST_INT). DATA is a reg set in which to - set all regs. Called from for_each_rtx. */ - -static int -mark_reg_in_phi (ptr, data) - rtx *ptr; - void *data; -{ - rtx expr = *ptr; - regset set = (regset) data; - - switch (GET_CODE (expr)) - { - case REG: - SET_REGNO_REG_SET (set, REGNO (expr)); - /* Fall through. */ - case CONST_INT: - case PHI: - return 0; - default: - abort (); - } -} - -/* Mark in PHI_SET all pseudos that are used in a phi node -- either - set from a phi expression, or used as an argument in one. Also - mark regs that are the source or target of a reg copy. Uses - ssa_definition. */ - -static void -mark_phi_and_copy_regs (phi_set) - regset phi_set; -{ - unsigned int reg; - - /* Scan the definitions of all regs. */ - for (reg = 0; reg < VARRAY_SIZE (ssa_definition); ++reg) - if (CONVERT_REGISTER_TO_SSA_P (reg)) - { - rtx insn = VARRAY_RTX (ssa_definition, reg); - rtx pattern; - rtx src; - - if (insn == NULL - || (GET_CODE (insn) == NOTE - && NOTE_LINE_NUMBER (insn) == NOTE_INSN_DELETED)) - continue; - pattern = PATTERN (insn); - /* Sometimes we get PARALLEL insns. These aren't phi nodes or - copies. */ - if (GET_CODE (pattern) != SET) - continue; - src = SET_SRC (pattern); - - if (GET_CODE (src) == REG) - { - /* It's a reg copy. */ - SET_REGNO_REG_SET (phi_set, reg); - SET_REGNO_REG_SET (phi_set, REGNO (src)); - } - else if (GET_CODE (src) == PHI) - { - /* It's a phi node. Mark the reg being set. */ - SET_REGNO_REG_SET (phi_set, reg); - /* Mark the regs used in the phi function. */ - for_each_rtx (&src, mark_reg_in_phi, phi_set); - } - /* ... else nothing to do. */ - } -} - -/* Rename regs in insn PTR that are equivalent. DATA is the register - partition which specifies equivalences. */ - -static int -rename_equivalent_regs_in_insn (ptr, data) - rtx *ptr; - void* data; -{ - rtx x = *ptr; - partition reg_partition = (partition) data; - - if (x == NULL_RTX) - return 0; - - switch (GET_CODE (x)) - { - case REG: - if (CONVERT_REGISTER_TO_SSA_P (REGNO (x))) - { - unsigned int regno = REGNO (x); - unsigned int new_regno = partition_find (reg_partition, regno); - rtx canonical_element_rtx = ssa_rename_from_lookup (new_regno); - - if (canonical_element_rtx != NULL_RTX && - HARD_REGISTER_P (canonical_element_rtx)) - { - if (REGNO (canonical_element_rtx) != regno) - *ptr = canonical_element_rtx; - } - else if (regno != new_regno) - { - rtx new_reg = regno_reg_rtx[new_regno]; - if (GET_MODE (x) != GET_MODE (new_reg)) - abort (); - *ptr = new_reg; - } - } - return -1; - - case PHI: - /* No need to rename the phi nodes. We'll check equivalence - when inserting copies. */ - return -1; - - default: - /* Anything else, continue traversing. */ - return 0; - } -} - -/* Record the register's canonical element stored in SRFP in the - canonical_elements sbitmap packaged in DATA. This function is used - as a callback function for traversing ssa_rename_from. */ - -static int -record_canonical_element_1 (srfp, data) - void **srfp; - void *data; -{ - unsigned int reg = ((ssa_rename_from_pair *) *srfp)->reg; - sbitmap canonical_elements = - ((struct ssa_rename_from_hash_table_data *) data)->canonical_elements; - partition reg_partition = - ((struct ssa_rename_from_hash_table_data *) data)->reg_partition; - - SET_BIT (canonical_elements, partition_find (reg_partition, reg)); - return 1; -} - -/* For each class in the REG_PARTITION corresponding to a particular - hard register and machine mode, check that there are no other - classes with the same hard register and machine mode. Returns - nonzero if this is the case, i.e., the partition is acceptable. */ - -static int -check_hard_regs_in_partition (reg_partition) - partition reg_partition; -{ - /* CANONICAL_ELEMENTS has a nonzero bit if a class with the given register - number and machine mode has already been seen. This is a - problem with the partition. */ - sbitmap canonical_elements; - int element_index; - int already_seen[FIRST_PSEUDO_REGISTER][NUM_MACHINE_MODES]; - int reg; - int mach_mode; - - /* Collect a list of canonical elements. */ - canonical_elements = sbitmap_alloc (max_reg_num ()); - sbitmap_zero (canonical_elements); - ssa_rename_from_traverse (&record_canonical_element_1, - canonical_elements, reg_partition); - - /* We have not seen any hard register uses. */ - for (reg = 0; reg < FIRST_PSEUDO_REGISTER; ++reg) - for (mach_mode = 0; mach_mode < NUM_MACHINE_MODES; ++mach_mode) - already_seen[reg][mach_mode] = 0; - - /* Check for classes with the same hard register and machine mode. */ - EXECUTE_IF_SET_IN_SBITMAP (canonical_elements, 0, element_index, - { - rtx hard_reg_rtx = ssa_rename_from_lookup (element_index); - if (hard_reg_rtx != NULL_RTX && - HARD_REGISTER_P (hard_reg_rtx) && - already_seen[REGNO (hard_reg_rtx)][GET_MODE (hard_reg_rtx)] != 0) - /* Two distinct partition classes should be mapped to the same - hard register. */ - return 0; - }); - - sbitmap_free (canonical_elements); - - return 1; -} - -/* Rename regs that are equivalent in REG_PARTITION. Also collapse - any SEQUENCE insns. */ - -static void -rename_equivalent_regs (reg_partition) - partition reg_partition; -{ - basic_block b; - - FOR_EACH_BB_REVERSE (b) - { - rtx next = b->head; - rtx last = b->end; - rtx insn; - - do - { - insn = next; - if (INSN_P (insn)) - { - for_each_rtx (&PATTERN (insn), - rename_equivalent_regs_in_insn, - reg_partition); - for_each_rtx (®_NOTES (insn), - rename_equivalent_regs_in_insn, - reg_partition); - - if (GET_CODE (PATTERN (insn)) == SEQUENCE) - { - rtx s = PATTERN (insn); - int slen = XVECLEN (s, 0); - int i; - - if (slen <= 1) - abort (); - - PATTERN (insn) = XVECEXP (s, 0, slen-1); - for (i = 0; i < slen - 1; i++) - emit_insn_before (XVECEXP (s, 0, i), insn); - } - } - - next = NEXT_INSN (insn); - } - while (insn != last); - } -} - -/* The main entry point for moving from SSA. */ - -void -convert_from_ssa () -{ - basic_block b, bb; - partition reg_partition; - rtx insns = get_insns (); - - /* Need global_live_at_{start,end} up to date. There should not be - any significant dead code at this point, except perhaps dead - stores. So do not take the time to perform dead code elimination. - - Register coalescing needs death notes, so generate them. */ - life_analysis (insns, NULL, PROP_DEATH_NOTES); - - /* Figure out which regs in copies and phi nodes don't conflict and - therefore can be coalesced. */ - if (conservative_reg_partition) - reg_partition = compute_conservative_reg_partition (); - else - reg_partition = compute_coalesced_reg_partition (); - - if (!check_hard_regs_in_partition (reg_partition)) - /* Two separate partitions should correspond to the same hard - register but do not. */ - abort (); - - rename_equivalent_regs (reg_partition); - - /* Eliminate the PHI nodes. */ - FOR_EACH_BB_REVERSE (b) - { - edge e; - - for (e = b->pred; e; e = e->pred_next) - if (e->src != ENTRY_BLOCK_PTR) - eliminate_phi (e, reg_partition); - } - - partition_delete (reg_partition); - - /* Actually delete the PHI nodes. */ - FOR_EACH_BB_REVERSE (bb) - { - rtx insn = bb->head; - - while (1) - { - /* If this is a PHI node delete it. */ - if (PHI_NODE_P (insn)) - { - if (insn == bb->end) - bb->end = PREV_INSN (insn); - insn = delete_insn (insn); - } - /* Since all the phi nodes come at the beginning of the - block, if we find an ordinary insn, we can stop looking - for more phi nodes. */ - else if (INSN_P (insn)) - break; - /* If we've reached the end of the block, stop. */ - else if (insn == bb->end) - break; - else - insn = NEXT_INSN (insn); - } - } - - /* Commit all the copy nodes needed to convert out of SSA form. */ - commit_edge_insertions (); - - in_ssa_form = 0; - - count_or_remove_death_notes (NULL, 1); - - /* Deallocate the data structures. */ - ssa_definition = 0; - ssa_rename_from_free (); -} - -/* Scan phi nodes in successors to BB. For each such phi node that - has a phi alternative value corresponding to BB, invoke FN. FN - is passed the entire phi node insn, the regno of the set - destination, the regno of the phi argument corresponding to BB, - and DATA. - - If FN ever returns nonzero, stops immediately and returns this - value. Otherwise, returns zero. */ - -int -for_each_successor_phi (bb, fn, data) - basic_block bb; - successor_phi_fn fn; - void *data; -{ - edge e; - - if (bb == EXIT_BLOCK_PTR) - return 0; - - /* Scan outgoing edges. */ - for (e = bb->succ; e != NULL; e = e->succ_next) - { - rtx insn; - - basic_block successor = e->dest; - if (successor == ENTRY_BLOCK_PTR - || successor == EXIT_BLOCK_PTR) - continue; - - /* Advance to the first non-label insn of the successor block. */ - insn = first_insn_after_basic_block_note (successor); - - if (insn == NULL) - continue; - - /* Scan phi nodes in the successor. */ - for ( ; PHI_NODE_P (insn); insn = NEXT_INSN (insn)) - { - int result; - rtx phi_set = PATTERN (insn); - rtx *alternative = phi_alternative (phi_set, bb->index); - rtx phi_src; - - /* This phi function may not have an alternative - corresponding to the incoming edge, indicating the - assigned variable is not defined along the edge. */ - if (alternative == NULL) - continue; - phi_src = *alternative; - - /* Invoke the callback. */ - result = (*fn) (insn, REGNO (SET_DEST (phi_set)), - REGNO (phi_src), data); - - /* Terminate if requested. */ - if (result != 0) - return result; - } - } - - return 0; -} - -/* Assuming the ssa_rename_from mapping has been established, yields - nonzero if 1) only one SSA register of REG1 and REG2 comes from a - hard register or 2) both SSA registers REG1 and REG2 come from - different hard registers. */ - -static int -conflicting_hard_regs_p (reg1, reg2) - int reg1; - int reg2; -{ - int orig_reg1 = original_register (reg1); - int orig_reg2 = original_register (reg2); - if (HARD_REGISTER_NUM_P (orig_reg1) && HARD_REGISTER_NUM_P (orig_reg2) - && orig_reg1 != orig_reg2) - return 1; - if (HARD_REGISTER_NUM_P (orig_reg1) && !HARD_REGISTER_NUM_P (orig_reg2)) - return 1; - if (!HARD_REGISTER_NUM_P (orig_reg1) && HARD_REGISTER_NUM_P (orig_reg2)) - return 1; - - return 0; -} diff --git a/contrib/gcc/ssa.h b/contrib/gcc/ssa.h deleted file mode 100644 index 115f77d..0000000 --- a/contrib/gcc/ssa.h +++ /dev/null @@ -1,72 +0,0 @@ -/* Static Single Assignment (SSA) definitions for GNU C-Compiler - Copyright (C) 2000, 2001 Free Software Foundation, Inc. - Written by Jeffrey D. Oldham <oldham@codesourcery.com>. - -This file is part of GCC. - -GCC is free software; you can redistribute it and/or modify it under -the terms of the GNU General Public License as published by the Free -Software Foundation; either version 2, or (at your option) any later -version. - -GCC is distributed in the hope that it will be useful, but WITHOUT ANY -WARRANTY; without even the implied warranty of MERCHANTABILITY or -FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -for more details. - -You should have received a copy of the GNU General Public License -along with GCC; see the file COPYING. If not, write to the Free -Software Foundation, 59 Temple Place - Suite 330, Boston, MA -02111-1307, USA. */ - - -/* Main SSA routines. */ -extern void convert_to_ssa PARAMS ((void)); -extern void convert_from_ssa PARAMS ((void)); -typedef int (*successor_phi_fn) PARAMS ((rtx, int, int, void *)); -extern int for_each_successor_phi PARAMS ((basic_block bb, - successor_phi_fn, - void *)); -void compute_dominance_frontiers PARAMS ((sbitmap *frontiers, - dominance_info idom)); -extern int remove_phi_alternative PARAMS ((rtx, basic_block)); - - -/* Optimizations. */ -/* In ssa-dce.c */ -extern void ssa_eliminate_dead_code PARAMS ((void)); - -/* In ssa-ccp.c */ -extern void ssa_const_prop PARAMS ((void)); - - -/* SSA definitions and uses. */ -/* This flag is set when the CFG is in SSA form. */ -extern int in_ssa_form; - -/* Element I is the single instruction that sets register I. */ -extern GTY(()) varray_type ssa_definition; - -/* Element I is an INSN_LIST of instructions that use register I. */ -extern varray_type ssa_uses; - - -/* Specify which hard registers should be converted. */ - -/* All pseudo-registers (having register number >= - FIRST_PSEUDO_REGISTER) and hard registers satisfying - CONVERT_HARD_REGISTER_TO_SSA_P are converted to SSA form. */ - -/* Given a hard register number REG_NO, return nonzero if and only if - the register should be converted to SSA. */ - -#ifndef CONVERT_HARD_REGISTER_TO_SSA_P -#define CONVERT_HARD_REGISTER_TO_SSA_P(REG_NO) (0) /* default of no hard registers */ -#endif /* CONVERT_HARD_REGISTER_TO_SSA_P */ - -/* Given a register number REG_NO, return nonzero if and only if the - register should be converted to SSA. */ - -#define CONVERT_REGISTER_TO_SSA_P(REG_NO) \ - ((!HARD_REGISTER_NUM_P (REG_NO)) || \ - (CONVERT_HARD_REGISTER_TO_SSA_P (REG_NO))) diff --git a/contrib/gcc/unwind-libunwind.c b/contrib/gcc/unwind-libunwind.c deleted file mode 100644 index 2e53a59..0000000 --- a/contrib/gcc/unwind-libunwind.c +++ /dev/null @@ -1,172 +0,0 @@ -/* Subroutines needed for unwinding stack frames via the libunwind API. - Copyright (C) 2002, 2003 - Free Software Foundation, Inc. - Contributed by David Mosberger-Tang <davidm@hpl.hp.com> - - This file is part of GCC. - - GCC is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2, or (at your option) - any later version. - - GCC is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with GCC; see the file COPYING. If not, write to - the Free Software Foundation, 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -/* As a special exception, if you link this library with other files, - some of which are compiled with GCC, to produce an executable, - this library does not by itself cause the resulting executable - to be covered by the GNU General Public License. - This exception does not however invalidate any other reasons why - the executable file might be covered by the GNU General Public License. */ - -#include "tconfig.h" -#include "tsystem.h" -#include "unwind.h" - -#ifndef __USING_SJLJ_EXCEPTIONS__ - -#define UNW_LOCAL_ONLY - -#include <libunwind.h> - -typedef struct { - _Unwind_Personality_Fn personality; -} _Unwind_FrameState; - -struct _Unwind_Context { - unw_cursor_t cursor; -}; - - -/* First come the helper-routines that are needed by unwind.inc. */ - -static _Unwind_Reason_Code -uw_frame_state_for (struct _Unwind_Context *context, _Unwind_FrameState *fs) -{ - unw_proc_info_t pi; - - if (unw_step (&context->cursor) <= 0) - return _URC_END_OF_STACK; - - unw_get_proc_info(&context->cursor, &pi); - fs->personality = (_Unwind_Personality_Fn) pi.handler; - - return _URC_NO_REASON; -} - -#define uw_update_context(context,fs) do { ; } while (0) - -static inline _Unwind_Ptr -uw_identify_context (struct _Unwind_Context *context) -{ - unw_word_t ip; - unw_get_reg (&context->cursor, UNW_REG_IP, &ip); - return (_Unwind_Ptr) ip; -} - -#define uw_init_context(context) \ -do \ - { \ - unw_context_t uc; \ - unw_getcontext (&uc); \ - unw_init_local (&(context)->cursor, &uc); \ - } \ -while (0) - -static inline void __attribute__ ((noreturn)) -uw_install_context (struct _Unwind_Context *current __attribute__ ((unused)), - struct _Unwind_Context *target) -{ - unw_resume (&(target)->cursor); - abort (); -} - - -/* Now come the helper-routines which may be called from an exception - handler. The interface for these routines are defined by the C++ - ABI. See: http://www.codesourcery.com/cxx-abi/abi-eh.html */ - -_Unwind_Word -_Unwind_GetGR (struct _Unwind_Context *context, int index) -{ - unw_word_t ret; - - /* Note: here we depend on the fact that general registers are - expected to start with register number 0! */ - unw_get_reg (&context->cursor, index, &ret); - return ret; -} - -/* Get the value of the CFA as saved in CONTEXT. */ - -_Unwind_Word -_Unwind_GetCFA (struct _Unwind_Context *context) -{ - /* ??? Is there any way to get this information? */ - return NULL; -} - -/* Overwrite the saved value for register REG in CONTEXT with VAL. */ - -void -_Unwind_SetGR (struct _Unwind_Context *context, int index, _Unwind_Word val) -{ - /* Note: here we depend on the fact that general registers are - expected to start with register number 0! */ - unw_set_reg (&context->cursor, index, val); -} - -/* Retrieve the return address for CONTEXT. */ - -inline _Unwind_Ptr -_Unwind_GetIP (struct _Unwind_Context *context) -{ - unw_word_t ret; - - unw_get_reg (&context->cursor, UNW_REG_IP, &ret); - return ret; -} - -/* Overwrite the return address for CONTEXT with VAL. */ - -inline void -_Unwind_SetIP (struct _Unwind_Context *context, _Unwind_Ptr val) -{ - unw_set_reg (&context->cursor, UNW_REG_IP, val); -} - -void * -_Unwind_GetLanguageSpecificData (struct _Unwind_Context *context) -{ - unw_proc_info_t pi; - - unw_get_proc_info(&context->cursor, &pi); - return (void *) pi.lsda; -} - -_Unwind_Ptr -_Unwind_GetRegionStart (struct _Unwind_Context *context) -{ - unw_proc_info_t pi; - - unw_get_proc_info(&context->cursor, &pi); - return (_Unwind_Ptr) pi.start_ip; -} - -void * -_Unwind_FindEnclosingFunction (void *pc) -{ - return NULL; -} - -#include "unwind.inc" - -#endif /* !__USING_SJLJ_EXCEPTIONS__ */ diff --git a/contrib/libf2c/libU77/bes.c b/contrib/libf2c/libU77/bes.c deleted file mode 100644 index 73373fd..0000000 --- a/contrib/libf2c/libU77/bes.c +++ /dev/null @@ -1,58 +0,0 @@ -/* Copyright (C) 1995, 1996 Free Software Foundation, Inc. -This file is part of GNU Fortran libU77 library. - -This library 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. - -GNU Fortran 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 GNU Fortran; see the file COPYING.LIB. If -not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -#if 0 /* Don't include these unless necessary -- jcb. */ -#include "f2c.h" -#include <math.h> - -double -G77_besj0_0 (const real * x) -{ - return j0 (*x); -} - -double -G77_besj1_0 (const real * x) -{ - return j1 (*x); -} - -double -G77_besjn_0 (const integer * n, real * x) -{ - return jn (*n, *x); -} - -double -G77_besy0_0 (const real * x) -{ - return y0 (*x); -} - -double -G77_besy1_0 (const real * x) -{ - return y1 (*x); -} - -double -G77_besyn_0 (const integer * n, real * x) -{ - return yn (*n, *x); -} -#endif diff --git a/contrib/libf2c/libU77/dbes.c b/contrib/libf2c/libU77/dbes.c deleted file mode 100644 index 8a31746..0000000 --- a/contrib/libf2c/libU77/dbes.c +++ /dev/null @@ -1,58 +0,0 @@ -/* Copyright (C) 1995, 1996 Free Software Foundation, Inc. -This file is part of GNU Fortran libU77 library. - -This library 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. - -GNU Fortran 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 GNU Fortran; see the file COPYING.LIB. If -not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -#if 0 /* Don't include these unless necessary -- dnp. */ -#include "f2c.h" -#include <math.h> - -double -G77_dbesj0_0 (const double *x) -{ - return j0 (*x); -} - -double -G77_dbesj1_0 (const double *x) -{ - return j1 (*x); -} - -double -G77_dbesjn_0 (const integer * n, double *x) -{ - return jn (*n, *x); -} - -double -G77_dbesy0_0 (const double *x) -{ - return y0 (*x); -} - -double -G77_dbesy1_0 (const double *x) -{ - return y1 (*x); -} - -double -G77_dbesyn_0 (const integer * n, double *x) -{ - return yn (*n, *x); -} -#endif diff --git a/contrib/libstdc++/config/abi/extract_symvers b/contrib/libstdc++/config/abi/extract_symvers deleted file mode 100755 index e7b6645..0000000 --- a/contrib/libstdc++/config/abi/extract_symvers +++ /dev/null @@ -1,64 +0,0 @@ -#!/bin/sh - -# Copyright (C) 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 -# 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. - - -if test ${#} -lt 2 || test $1 = '--help'; then - echo "Usage: extract_symvers shared_lib output_file" 1>&2 - exit 1 -fi - -lib=$1 -output=$2 - -# GNU binutils, somewhere after version 2.11.2, requires -W/--wide to avoid -# default line truncation. -W is not supported and truncation did not occur -# by default before that point. -readelf="readelf --symbols" -if readelf --help | grep -- --wide > /dev/null; then - readelf="$readelf --wide" -fi - -# This avoids weird sorting problems later. -export LC_ALL=C - -tmp=extract.$$ - -${readelf} ${lib} | sed '/\.dynsym/,/^$/p;d' | egrep -v ' (LOCAL|UND) ' |\ -awk '{ if ($4 == "FUNC" || $4 == "NOTYPE") - printf "%s:%s\n", $4, $8; - else if ($4 == "OBJECT") - printf "%s:%s:%s\n", $4, $3, $8; - }' | sort | uniq > $tmp 2>&1 -# else printf "Huh? What is %s?\n", $8; - - -# I think we'll be doing some more with this file, but for now, dump. -mv $tmp $output - -exit 0 diff --git a/contrib/libstdc++/config/io/basic_file_libio.cc b/contrib/libstdc++/config/io/basic_file_libio.cc deleted file mode 100644 index 60eb006..0000000 --- a/contrib/libstdc++/config/io/basic_file_libio.cc +++ /dev/null @@ -1,194 +0,0 @@ -// Wrapper of C-language FILE struct -*- C++ -*- - -// Copyright (C) 2000, 2001 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. - -// -// ISO C++ 14882: 27.8 File-based streams -// - -#include <bits/basic_file.h> - -namespace std -{ - // __basic_file<char> definitions - __basic_file<char>::__basic_file(__c_lock* __lock) - { -#ifdef _IO_MTSAFE_IO - _lock = __lock; -#endif - // Don't set the orientation of the stream when initializing. -#ifdef _GLIBCPP_USE_WCHAR_T - _IO_no_init(this, 0, 0, &_M_wfile, 0); -#else /* !defined(_GLIBCPP_USE_WCHAR_T) */ - _IO_no_init(this, 0, 0, NULL, 0); -#endif /* !defined(_GLIBCPP_USE_WCHAR_T) */ - _IO_JUMPS((_IO_FILE_plus *) this) = &_IO_file_jumps; - _IO_file_init((_IO_FILE_plus*)this); - } - - // NB: Unused. - int - __basic_file<char>::overflow(int __c) - { return _IO_file_overflow(this, __c); } - - // NB: Unused. - int - __basic_file<char>::underflow() - { return _IO_file_underflow(this); } - - // NB: Unused. - int - __basic_file<char>::uflow() - { return _IO_default_uflow(this); } - - // NB: Unused. - int - __basic_file<char>::pbackfail(int __c) - { return _IO_default_pbackfail(this, __c); } - - streamsize - __basic_file<char>::xsputn(const char* __s, streamsize __n) - { return _IO_file_xsputn(this, __s, __n); } - - streamoff - __basic_file<char>::seekoff(streamoff __off, ios_base::seekdir __way, - ios_base::openmode __mode) - { return _IO_file_seekoff(this, __off, __way, __mode); } - - streamoff - __basic_file<char>::seekpos(streamoff __pos, ios_base::openmode __mode) - { return _IO_file_seekoff(this, __pos, ios_base::beg, __mode); } - - // NB: Unused. - streambuf* - __basic_file<char>::setbuf(char* __b, int __len) - { return (streambuf*) _IO_file_setbuf(this,__b, __len); } - - int - __basic_file<char>::sync() - { return _IO_file_sync(this); } - - // NB: Unused. - int - __basic_file<char>::doallocate() - { return _IO_file_doallocate(this); } - - // __basic_file<wchar_t> definitions -#ifdef _GLIBCPP_USE_WCHAR_T - __basic_file<wchar_t>::__basic_file(__c_lock* __lock) - { -#ifdef _IO_MTSAFE_IO - _lock = __lock; -#endif - // Don't set the orientation of the stream when initializing. - _IO_no_init(this, 0, 0, &_M_wfile, &_IO_wfile_jumps); - _IO_JUMPS((_IO_FILE_plus *) this) = &_IO_wfile_jumps; - _IO_file_init((_IO_FILE_plus*)this); - - // In addition, need to allocate the buffer... - _IO_wdoallocbuf(this); - // Setup initial positions for this buffer... - // if (!(_flags & _IO_NO_READS)) - _IO_wsetg(this, _wide_data->_IO_buf_base, _wide_data->_IO_buf_base, - _wide_data->_IO_buf_base); - // if (!(_flags & _IO_NO_WRITES)) - _IO_wsetp(this, _wide_data->_IO_buf_base, _wide_data->_IO_buf_base); - - // Setup codecvt bits... - _codecvt = &__c_libio_codecvt; - - // Do the same for narrow bits... - if (_IO_write_base == NULL) - { - _IO_doallocbuf(this); - // if (!(_flags & _IO_NO_READS)) - _IO_setg(this, _IO_buf_base, _IO_buf_base, _IO_buf_base); - // if (!(_flags & _IO_NO_WRITES)) - _IO_setp(this, _IO_buf_base, _IO_buf_base); - } - } - - int - __basic_file<wchar_t>::overflow(int __c) - { return _IO_wfile_overflow(this, __c); } - - int - __basic_file<wchar_t>::underflow() - { return _IO_wfile_underflow(this); } - - // NB: Unused. - int - __basic_file<wchar_t>::uflow() - { return _IO_wdefault_uflow(this); } - - // NB: Unused. - int - __basic_file<wchar_t>::pbackfail(int __c) - { return _IO_wdefault_pbackfail(this, __c); } - - streamsize - __basic_file<wchar_t>::xsputn(const wchar_t* __s, streamsize __n) - { return _IO_wfile_xsputn(this, __s, __n); } - - streamoff - __basic_file<wchar_t>::seekoff(streamoff __off, ios_base::seekdir __way, - ios_base::openmode __mode) - { return _IO_wfile_seekoff(this, __off, __way, __mode); } - - streamoff - __basic_file<wchar_t>::seekpos(streamoff __pos, ios_base::openmode __mode) - { return _IO_wfile_seekoff(this, __pos, ios_base::beg, __mode); } - - streambuf* - __basic_file<wchar_t>::setbuf(wchar_t* __b, int __len) - { return (streambuf*) _IO_wfile_setbuf(this,__b, __len); } - - int - __basic_file<wchar_t>::sync() - { return _IO_wfile_sync(this); } - - int - __basic_file<wchar_t>::doallocate() - { return _IO_wfile_doallocate(this); } -#endif - - // Need to instantiate base class here for type-info bits, etc - template struct __basic_file_base<char>; - template class __basic_file<char>; -#ifdef _GLIBCPP_USE_WCHAR_T - template struct __basic_file_base<wchar_t>; - template class __basic_file<wchar_t>; -#endif -} // namespace std - - - - - - - diff --git a/contrib/libstdc++/config/io/basic_file_libio.h b/contrib/libstdc++/config/io/basic_file_libio.h deleted file mode 100644 index 57d83c4..0000000 --- a/contrib/libstdc++/config/io/basic_file_libio.h +++ /dev/null @@ -1,498 +0,0 @@ -// Wrapper of C-language FILE struct -*- C++ -*- - -// Copyright (C) 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 -// 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. - -// -// ISO C++ 14882: 27.8 File-based streams -// - -/** @file basic_file.h - * This is an internal header file, included by other library headers. - * You should not attempt to use it directly. - */ - -#ifndef _CPP_BASIC_FILE -#define _CPP_BASIC_FILE 1 - -#pragma GCC system_header - -#include <bits/c++config.h> -#include <ios> -#include <libioP.h> - -namespace std -{ - // Ulrich is going to make some detailed comment here, explaining - // all this unpleasantness, providing detailed performance analysis - // as to why we have to do all this lame vtable hacking instead of a - // sane, function-based approach. This verbiage will provide a clear - // and detailed description of the whole object-layout, - // vtable-swapping, sordid history of this hack. - template<typename _CharT> - struct __basic_file_base: public __c_file_type - { - virtual - ~__basic_file_base() { }; - - virtual int - overflow(int __c = EOF) = 0; - - virtual int - underflow() = 0; - - virtual int - uflow() = 0; - - virtual int - pbackfail(int __c) = 0; - - virtual streamsize - xsputn(const _CharT* __s, streamsize __n) = 0; - - virtual streamsize - xsgetn(_CharT* __s, streamsize __n) = 0; - - virtual streamoff - seekoff(streamoff __off, ios_base::seekdir __way, - ios_base::openmode __mode = ios_base::in | ios_base::out) = 0; - - virtual streamoff - seekpos(streamoff __pos, - ios_base::openmode __mode = ios_base::in | ios_base::out) = 0; - - virtual streambuf* - setbuf(_CharT* __b, int __len) = 0; - - virtual int - sync() = 0; - - virtual int - doallocate() = 0; - - virtual streamsize - sys_read(_CharT* __s, streamsize __n) = 0; - - virtual streamsize - sys_write(const _CharT* __s, streamsize __n) = 0; - - virtual streamoff - sys_seek(streamoff __off, ios_base::seekdir __way) = 0; - - virtual int - sys_close() = 0; - - virtual int - sys_stat(void* __v) = 0; - - virtual int - showmanyc() = 0; - - virtual void - imbue(void* __v) = 0; - }; - - // Some of these member functions are based on libio/filebuf.cc. - // Also note that the order and number of virtual functions has to precisely - // match the order and number in the _IO_jump_t struct defined in libioP.h. - template<typename _CharT> - class __basic_file: public __basic_file_base<_CharT> - { -# ifdef _GLIBCPP_USE_WCHAR_T - __c_wfile_type _M_wfile; -# endif - - public: - __basic_file(__c_lock* __lock = 0); - - void - _M_open_mode(ios_base::openmode __mode, int& __p_mode, int& __rw_mode, - char* __c_mode); - - // Equivalent to the normal fopen function. - __basic_file* - open(const char* __name, ios_base::openmode __mode, int __prot = 0664); - - // Used for opening the standard streams, cin, cout, cerr, clog, - // and their wide-stream equivalents. Instead of calling open, it - // just sets - // - for libio: __c_file_type->_fileno and the respective _flags bits - // - for stdio: _M_cfile = __file and some internal flags - // and returns. - __basic_file* - sys_open(__c_file_type* __file, ios_base::openmode __mode); - - _CharT - sys_getc(); - - _CharT - sys_ungetc(_CharT); - - __basic_file* - close(); - - bool - is_open(); - - int - fd(); - - // NB: Must match FILE specific jump table starting here--this - // means all virtual functions starting with the dtor must match, - // slot by slot. For glibc-based dystems, this means the _IO_FILE - // as the FILE struct and _IO_jump_t as the jump table. - virtual - ~__basic_file(); // Takes the place of __finish. - - virtual int - overflow(int __c = EOF); - - virtual int - underflow(); - - virtual int - uflow(); - - virtual int - pbackfail(int __c); - - // A complex "write" function that sets all of __c_file_type's - // pointers and associated data members correctly and manages its - // relation to the external byte sequence. - virtual streamsize - xsputn(const _CharT* __s, streamsize __n); - - // A complex "read" function that sets all of __c_file_type's - // pointers and associated data members correctly and manages its - // relation to the external byte sequence. - virtual streamsize - xsgetn(_CharT* __s, streamsize __n); - - // A complex "seekoff" function that sets all of __c_file_type's - // pointers and associated data members correctly and manages its - // relation to the external byte sequence. - virtual streamoff - seekoff(streamoff __off, ios_base::seekdir __way, - ios_base::openmode __mode = ios_base::in | ios_base::out); - - // A complex "seekpos" function that sets all of __c_file_type's - // pointers and associated data members correctly and manages its - // relation to the external byte sequence. - virtual streamoff - seekpos(streamoff __pos, - ios_base::openmode __mode = ios_base::in | ios_base::out); - - virtual streambuf* - setbuf(_CharT* __b, int __len); - - virtual int - sync(); - - virtual int - doallocate(); - - // A simple read function for the external byte sequence, that - // does no mucking around with or setting of the pointers or flags - // in __c_file_type. - virtual streamsize - sys_read(_CharT* __s, streamsize __n); - - // A simple write function for the external byte sequence, that - // does no mucking around with or setting of the pointers or flags - // in __c_file_type. - virtual streamsize - sys_write(const _CharT* __s, streamsize __n); - - // A simple seek function for the external byte sequence, that - // does no mucking around with or setting of the pointers or flags - // in __c_file_type. - virtual streamoff - sys_seek(streamoff __off, ios_base::seekdir __way); - - virtual int - sys_close(); - - virtual int - sys_stat(void* __v); - - virtual int - showmanyc(); - - virtual void - imbue(void* __v); - }; - - // __basic_file<char> specializations - template<> - __basic_file<char>::__basic_file(__c_lock* __lock); - - template<> - int - __basic_file<char>::overflow(int __c); - - template<> - int - __basic_file<char>::underflow(); - - template<> - int - __basic_file<char>::uflow(); - - template<> - int - __basic_file<char>::pbackfail(int __c); - - template<> - streamsize - __basic_file<char>::xsputn(const char* __s, streamsize __n); - - template<> - streamoff - __basic_file<char>::seekoff(streamoff __off, ios_base::seekdir __way, - ios_base::openmode __mode); - - template<> - streamoff - __basic_file<char>::seekpos(streamoff __pos, ios_base::openmode __mode); - - template<> - streambuf* - __basic_file<char>::setbuf(char* __b, int __len); - - template<> - int - __basic_file<char>::sync(); - - template<> - int - __basic_file<char>::doallocate(); - - // __basic_file<wchar_t> specializations -#ifdef _GLIBCPP_USE_WCHAR_T - template<> - __basic_file<wchar_t>::__basic_file(__c_lock* __lock); - - template<> - int - __basic_file<wchar_t>::overflow(int __c); - - template<> - int - __basic_file<wchar_t>::underflow(); - - template<> - int - __basic_file<wchar_t>::uflow(); - - template<> - int - __basic_file<wchar_t>::pbackfail(int __c); - - template<> - streamsize - __basic_file<wchar_t>::xsputn(const wchar_t* __s, streamsize __n); - - template<> - streamoff - __basic_file<wchar_t>::seekoff(streamoff __off, ios_base::seekdir __way, - ios_base::openmode __mode); - - template<> - streamoff - __basic_file<wchar_t>::seekpos(streamoff __pos, ios_base::openmode __mode); - - template<> - streambuf* - __basic_file<wchar_t>::setbuf(wchar_t* __b, int __len); - - template<> - int - __basic_file<wchar_t>::sync(); - - template<> - int - __basic_file<wchar_t>::doallocate(); -#endif - - template<typename _CharT> - __basic_file<_CharT>::~__basic_file() - { _IO_file_finish(this, 0); } - - template<typename _CharT> - void - __basic_file<_CharT>::_M_open_mode(ios_base::openmode __mode, - int& __p_mode, int& __rw_mode, - char* /*__c_mode*/) - { -#ifdef O_BINARY - bool __testb = __mode & ios_base::binary; -#endif - bool __testi = __mode & ios_base::in; - bool __testo = __mode & ios_base::out; - bool __testt = __mode & ios_base::trunc; - bool __testa = __mode & ios_base::app; - - if (!__testi && __testo && !__testt && !__testa) - { - __p_mode = O_WRONLY | O_TRUNC | O_CREAT; - __rw_mode = _IO_NO_READS; - } - if (!__testi && __testo && !__testt && __testa) - { - __p_mode = O_WRONLY | O_APPEND | O_CREAT; - __rw_mode = _IO_NO_READS | _IO_IS_APPENDING; - } - if (!__testi && __testo && __testt && !__testa) - { - __p_mode = O_WRONLY | O_TRUNC | O_CREAT; - __rw_mode = _IO_NO_READS; - } - if (__testi && !__testo && !__testt && !__testa) - { - __p_mode = O_RDONLY; - __rw_mode = _IO_NO_WRITES; - } - if (__testi && __testo && !__testt && !__testa) - { - __p_mode = O_RDWR; - __rw_mode = 0; - } - if (__testi && __testo && __testt && !__testa) - { - __p_mode = O_RDWR | O_TRUNC | O_CREAT; - __rw_mode = 0; - } -#ifdef O_BINARY - if (__testb) - __p_mode |= O_BINARY; -#endif - } - - template<typename _CharT> - __basic_file<_CharT>* - __basic_file<_CharT>::sys_open(__c_file_type* __f, - ios_base::openmode __mode) - { - __basic_file* __ret = NULL; - int __fd = fileno(__f); - int __p_mode = 0; - int __rw_mode = _IO_NO_READS + _IO_NO_WRITES; - char __c_mode[4]; - - _M_open_mode(__mode, __p_mode, __rw_mode, __c_mode); - - if (!_IO_file_is_open(this)) - { - _fileno = __fd; - _flags &= ~(_IO_NO_READS + _IO_NO_WRITES); - _flags |= _IO_DELETE_DONT_CLOSE; - _offset = _IO_pos_BAD; - int __mask = _IO_NO_READS + _IO_NO_WRITES + _IO_IS_APPENDING; - _IO_mask_flags(this, __rw_mode, __mask); - } - - return __ret; - } - - template<typename _CharT> - __basic_file<_CharT>* - __basic_file<_CharT>::open(const char* __name, ios_base::openmode __mode, - int __prot) - { - __basic_file* __ret = NULL; - int __p_mode = 0; - int __rw_mode = _IO_NO_READS + _IO_NO_WRITES; - char __c_mode[4]; - - _M_open_mode(__mode, __p_mode, __rw_mode, __c_mode); - if (!_IO_file_is_open(this)) - { - __c_file_type* __f; - __f = _IO_file_open(this, __name, __p_mode, __prot, __rw_mode, 0); - __ret = __f ? this: NULL; - } - return __ret; - } - - template<typename _CharT> - bool - __basic_file<_CharT>::is_open() { return _fileno >= 0; } - - template<typename _CharT> - __basic_file<_CharT>* - __basic_file<_CharT>::close() - { - return _IO_file_close_it(this) ? static_cast<__basic_file*>(NULL) : this; - } - - template<typename _CharT> - streamsize - __basic_file<_CharT>::xsgetn(_CharT* __s, streamsize __n) - { return _IO_file_xsgetn(this, __s, __n); } - - // NB: Unused. - template<typename _CharT> - streamsize - __basic_file<_CharT>::sys_read(_CharT* __s, streamsize __n) - { return _IO_file_read(this, __s, __n); } - - // NB: Unused. - template<typename _CharT> - streamsize - __basic_file<_CharT>::sys_write(const _CharT* __s, streamsize __n) - { return _IO_file_write(this, __s, __n); } - - // NB: Unused. - template<typename _CharT> - streamoff - __basic_file<_CharT>::sys_seek(streamoff __pos, ios_base::seekdir __way) - { return _IO_file_seek(this, __pos, __way); } - - // NB: Unused. - template<typename _CharT> - int - __basic_file<_CharT>::sys_close() - { return _IO_file_close(this); } - - // NB: Unused. - template<typename _CharT> - int - __basic_file<_CharT>::sys_stat(void* __v) - { return _IO_file_stat(this, __v); } - - // NB: Unused. - template<typename _CharT> - int - __basic_file<_CharT>::showmanyc() { return EOF; } - - // NB: Unused. - template<typename _CharT> - void - __basic_file<_CharT>::imbue(void* /*__v*/) { } -} // namespace std - -#endif // _CPP_BASIC_FILE diff --git a/contrib/libstdc++/config/io/c_io_libio.h b/contrib/libstdc++/config/io/c_io_libio.h deleted file mode 100644 index acf6520..0000000 --- a/contrib/libstdc++/config/io/c_io_libio.h +++ /dev/null @@ -1,113 +0,0 @@ -// underlying io library -*- C++ -*- - -// Copyright (C) 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 -// 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. - -// c_io_libio.h - Defines for using the GNU libio - -#ifndef _CPP_IO_LIBIO_H -#define _CPP_IO_LIBIO_H 1 - -#include <libio.h> - -namespace std -{ -// from fpos.h - typedef _IO_ssize_t streamsize; // Signed integral type - typedef _IO_ssize_t wstreamsize; - -#if defined(_G_IO_IO_FILE_VERSION) && _G_IO_IO_FILE_VERSION == 0x20001 - typedef _IO_off64_t streamoff; - typedef _IO_fpos64_t __c_streampos; -#else - typedef _IO_off_t streamoff; - typedef _IO_fpos_t __c_streampos; -#endif - -#ifdef _GLIBCPP_USE_THREADS - typedef _IO_lock_t __c_lock; -#else - typedef int __c_lock; -#endif - -// from basic_file.h - typedef _IO_FILE __c_file_type; - typedef _IO_wide_data __c_wfile_type; - -#ifdef _GLIBCPP_USE_WCHAR_T - extern "C" _IO_codecvt __c_libio_codecvt; -#endif - -// from ios_base.h - struct __ios_flags - { - typedef short __int_type; - - static const __int_type _S_boolalpha = _IO_BAD_SEEN; - static const __int_type _S_dec = _IO_DEC; - static const __int_type _S_fixed = _IO_FIXED; - static const __int_type _S_hex = _IO_HEX; - static const __int_type _S_internal = _IO_INTERNAL; - static const __int_type _S_left = _IO_LEFT; - static const __int_type _S_oct = _IO_OCT; - static const __int_type _S_right = _IO_RIGHT; - static const __int_type _S_scientific = _IO_SCIENTIFIC; - static const __int_type _S_showbase = _IO_SHOWBASE; - static const __int_type _S_showpoint = _IO_SHOWPOINT; - static const __int_type _S_showpos = _IO_SHOWPOS; - static const __int_type _S_skipws = _IO_SKIPWS; - static const __int_type _S_unitbuf = _IO_UNITBUF; - static const __int_type _S_uppercase = _IO_UPPERCASE; - static const __int_type _S_adjustfield = _IO_LEFT | _IO_RIGHT - | _IO_INTERNAL; - static const __int_type _S_basefield = _IO_DEC | _IO_OCT | _IO_HEX; - static const __int_type _S_floatfield = _IO_SCIENTIFIC | _IO_FIXED; - - // 27.4.2.1.3 Type ios_base::iostate - static const __int_type _S_badbit = _IO_BAD_SEEN; - static const __int_type _S_eofbit = _IO_EOF_SEEN; - static const __int_type _S_failbit = _IO_ERR_SEEN; - - // 27.4.2.1.4 Type openmode - static const __int_type _S_app = _IOS_APPEND; - static const __int_type _S_ate = _IOS_ATEND; - static const __int_type _S_bin = _IOS_BIN; - static const __int_type _S_in = _IOS_INPUT; - static const __int_type _S_out = _IOS_OUTPUT; - static const __int_type _S_trunc = _IOS_TRUNC; - }; -} - -#endif // _CPP_IO_LIBIO_H - - - - - - - - diff --git a/contrib/libstdc++/config/io/c_io_libio_codecvt.c b/contrib/libstdc++/config/io/c_io_libio_codecvt.c deleted file mode 100644 index 38d8b55..0000000 --- a/contrib/libstdc++/config/io/c_io_libio_codecvt.c +++ /dev/null @@ -1,153 +0,0 @@ -/* Copyright (C) 2000 Free Software Foundation, Inc. - This file is part of the GNU IO 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, if you link this library with files - compiled with a GNU compiler to produce an executable, this does - not 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. */ - -/* Slightly modified from glibc/libio/iofwide.c */ - -#include <libio.h> - -#ifdef _GLIBCPP_USE_WCHAR_T - -/* Prototypes of libio's codecvt functions. */ -static enum __codecvt_result -do_out(struct _IO_codecvt *codecvt, __c_mbstate_t *statep, - const wchar_t *from_start, const wchar_t *from_end, - const wchar_t **from_stop, char *to_start, char *to_end, - char **to_stop); - -static enum __codecvt_result -do_unshift(struct _IO_codecvt *codecvt, __c_mbstate_t *statep, char *to_start, - char *to_end, char **to_stop); - -static enum __codecvt_result -do_in(struct _IO_codecvt *codecvt, __c_mbstate_t *statep, - const char *from_start, const char *from_end, const char **from_stop, - wchar_t *to_start, wchar_t *to_end, wchar_t **to_stop); - -static int -do_encoding(struct _IO_codecvt *codecvt); - -static int -do_length(struct _IO_codecvt *codecvt, __c_mbstate_t *statep, - const char *from_start, const char *from_end, _IO_size_t max); - -static int -do_max_length(struct _IO_codecvt *codecvt); - -static int -do_always_noconv(struct _IO_codecvt *codecvt); - - -/* The functions used in `codecvt' for libio are always the same. */ -struct _IO_codecvt __c_libio_codecvt = -{ - .__codecvt_destr = NULL, /* Destructor, never used. */ - .__codecvt_do_out = do_out, - .__codecvt_do_unshift = do_unshift, - .__codecvt_do_in = do_in, - .__codecvt_do_encoding = do_encoding, - .__codecvt_do_always_noconv = do_always_noconv, - .__codecvt_do_length = do_length, - .__codecvt_do_max_length = do_max_length -}; - -static enum __codecvt_result -do_out(struct _IO_codecvt *codecvt, __c_mbstate_t *statep, - const wchar_t *from_start, const wchar_t *from_end, - const wchar_t **from_stop, char *to_start, char *to_end, - char **to_stop) -{ - enum __codecvt_result res = __codecvt_ok; - - while (from_start < from_end) - { - if (to_start >= to_end) - { - res = __codecvt_partial; - break; - } - *to_start++ = (char) *from_start++; - } - - *from_stop = from_start; - *to_stop = to_start; - - return res; -} - - -static enum __codecvt_result -do_unshift(struct _IO_codecvt *codecvt, __c_mbstate_t *statep, - char *to_start, char *to_end, char **to_stop) -{ - *to_stop = to_start; - return __codecvt_ok; -} - - -static enum __codecvt_result -do_in(struct _IO_codecvt *codecvt, __c_mbstate_t *statep, - const char *from_start, const char *from_end, const char **from_stop, - wchar_t *to_start, wchar_t *to_end, wchar_t **to_stop) -{ - enum __codecvt_result res = __codecvt_ok; - - while (from_start < from_end) - { - if (to_start >= to_end) - { - res = __codecvt_partial; - break; - } - *to_start++ = (wchar_t) *from_start++; - } - - *from_stop = from_start; - *to_stop = to_start; - - return res; -} - - -static int -do_encoding(struct _IO_codecvt *codecvt) -{ return 1; } - - -static int -do_always_noconv(struct _IO_codecvt *codecvt) -{ return 0; } - - -static int -do_length(struct _IO_codecvt *codecvt, __c_mbstate_t *statep, - const char *from_start, const char *from_end, _IO_size_t max) -{ return from_end - from_start; } - - -static int -do_max_length(struct _IO_codecvt *codecvt) -{ return 1; } - -#endif /* _GLIBCPP_USE_WCHAR_T */ diff --git a/contrib/libstdc++/configure.in b/contrib/libstdc++/configure.in deleted file mode 100644 index b8d895f..0000000 --- a/contrib/libstdc++/configure.in +++ /dev/null @@ -1,554 +0,0 @@ -# Process this file with autoconf to produce a configure script, like so: -# aclocal && autoconf && autoheader && automake - -AC_PREREQ(2.13) -AC_INIT(src/ios.cc) - -# This works around the fact that libtool configuration may change LD -# for this particular configuration, but some shells, instead of -# keeping the changes in LD private, export them just because LD is -# exported. Only used at the end of this file. -ORIGINAL_LD_FOR_MULTILIBS=$LD - -PACKAGE=libstdc++ -AC_SUBST(PACKAGE) -# For libtool versioning info, format is CURRENT:REVISION:AGE -libtool_VERSION=5:5:0 -AC_SUBST(libtool_VERSION) - -GLIBCPP_TOPREL_CONFIGURE - -# Gets build, host, target, *_vendor, *_cpu, *_os, etc. -# -# You will slowly go insane if you do not grok the following fact: when -# building v3 as part of the compiler, the top-level /target/ becomes the -# library's /host/. `configure' then causes --target to default to --host, -# exactly like any other package using autoconf. Therefore, 'target' and -# 'host' will always be the same. This makes sense both for native and -# cross compilers, just think about it for a little while. :-) -# -# Also, if v3 is being configured as part of a cross compiler, the top-level -# configure script will pass the "real" host as $with_cross_host. -# -# AC 2.5x sets target_alias iff the user specified --target, but we use it -# everywhere, so we set it here just to be sure. In AC 2.13 -# AC_CANONICAL_TARGET was known as AC_CANONICAL_SYSTEM. -AC_CANONICAL_SYSTEM -target_alias=${target_alias-$target} -AC_SUBST(target_alias) - -# Runs configure.target, finds CC, CXX and assorted other critical bits. -# Must run this before the GLIBCPP_ENABLE_* macros below. -GLIBCPP_CONFIGURE(.) - -AM_INIT_AUTOMAKE($PACKAGE, $gcc_version) -AM_CONFIG_HEADER(config.h) - -AC_LIBTOOL_DLOPEN -AM_PROG_LIBTOOL -AC_SUBST(enable_shared) -AC_SUBST(enable_static) - -# Check for c++ or library specific bits that don't require linking. -#GLIBCPP_CHECK_COMPILER_VERSION -GLIBCPP_CHECK_GNU_MAKE - -# Enable all the variable C++ stuff. C_MBCHAR must come early. -GLIBCPP_ENABLE_CSTDIO -GLIBCPP_ENABLE_CLOCALE -GLIBCPP_ENABLE_CHEADERS([$c_model]) -GLIBCPP_ENABLE_C_MBCHAR([yes]) -GLIBCPP_ENABLE_C99([yes]) -GLIBCPP_ENABLE_LONG_LONG([yes]) -GLIBCPP_ENABLE_THREADS -GLIBCPP_ENABLE_SJLJ_EXCEPTIONS -GLIBCPP_ENABLE_LIBUNWIND_EXCEPTIONS -GLIBCPP_ENABLE_CONCEPT_CHECKS -GLIBCPP_ENABLE_CXX_FLAGS -GLIBCPP_ENABLE_DEBUG([no]) -GLIBCPP_ENABLE_DEBUG_FLAGS([none]) - -# Check for headers necessary for libsupc++ using dyn-string.c/cxa_demangle.c -AC_CHECK_HEADERS(string.h stdlib.h) - -# No surprises, no surprises... -if test $ATOMICITYH = cpu/generic ; then - AC_MSG_WARN([No native atomic operations are provided yet for this platform.]) - if test $target_thread_file = single; then - AC_MSG_WARN([They cannot be faked when thread support is disabled.]) - AC_MSG_WARN([Thread-safety of certain classes is not guaranteed.]) - else - AC_MSG_WARN([They will be faked using a mutex.]) - AC_MSG_WARN([Performance of certain classes will degrade as a result.]) - fi -fi - - -if test -n "$with_cross_host" || test x"$build" != x"$host"; then - - # We are being configured with some form of cross compiler. - GLIBCPP_IS_CROSS_COMPILING=true - - # This lets us hard-code the functionality we know we'll have in the cross - # target environment. "Let" is a sugar-coated word placed on an especially - # dull and tedious hack, actually. - # - # Here's why GLIBCPP_CHECK_MATH_SUPPORT, and other autoconf macros - # that involve linking, can't be used: - # "cannot open sim-crt0.o" - # "cannot open crt0.o" - # etc. All this is because there currently exists no unified, consistent - # way for top level CC information to be passed down to target directories: - # newlib includes, newlib linking info, libgloss versus newlib crt0.o, etc. - # When all of that is done, all of this hokey, excessive AC_DEFINE junk for - # crosses can be removed. - - # If Canadian cross, then don't pick up tools from the build directory. - # Used in GLIBCPP_EXPORT_INCLUDES (and nowhere else?). - if test -n "$with_cross_host" && test x"$build" != x"$with_cross_host"; then - CANADIAN=yes - else - CANADIAN=no - fi - - # Construct crosses by hand, eliminating bits that need ld... - # GLIBCPP_CHECK_COMPILER_FEATURES - # GLIBCPP_CHECK_BUILTIN_MATH_SUPPORT - # GLIBCPP_CHECK_MATH_SUPPORT - - case "$target" in - *-linux*) - os_include_dir="os/gnu-linux" - AC_CHECK_HEADERS([nan.h ieeefp.h endian.h sys/isa_defs.h \ - machine/endian.h machine/param.h sys/machine.h sys/types.h \ - fp.h locale.h float.h inttypes.h]) - SECTION_FLAGS='-ffunction-sections -fdata-sections' - AC_SUBST(SECTION_FLAGS) - GLIBCPP_CHECK_LINKER_FEATURES - GLIBCPP_CHECK_COMPLEX_MATH_SUPPORT - GLIBCPP_CHECK_WCHAR_T_SUPPORT - AC_DEFINE(HAVE_COPYSIGN) - AC_DEFINE(HAVE_COPYSIGNF) - AC_DEFINE(HAVE_FINITE) - AC_DEFINE(HAVE_FINITEF) - AC_DEFINE(HAVE_FREXPF) - AC_DEFINE(HAVE_HYPOTF) - AC_DEFINE(HAVE_ISINF) - AC_DEFINE(HAVE_ISINFF) - AC_DEFINE(HAVE_ISNAN) - AC_DEFINE(HAVE_ISNANF) - AC_DEFINE(HAVE_SINCOS) - AC_DEFINE(HAVE_SINCOSF) - if test x"long_double_math_on_this_cpu" = x"yes"; then - AC_DEFINE(HAVE_FINITEL) - AC_DEFINE(HAVE_HYPOTL) - AC_DEFINE(HAVE_ISINFL) - AC_DEFINE(HAVE_ISNANL) - fi - ;; - *-hpux*) - # Check for available headers. - AC_CHECK_HEADERS([nan.h ieeefp.h endian.h sys/isa_defs.h \ - machine/endian.h machine/param.h sys/machine.h sys/types.h \ - fp.h locale.h float.h inttypes.h]) - SECTION_FLAGS='-ffunction-sections -fdata-sections' - AC_SUBST(SECTION_FLAGS) - GLIBCPP_CHECK_LINKER_FEATURES - GLIBCPP_CHECK_COMPLEX_MATH_SUPPORT - GLIBCPP_CHECK_WCHAR_T_SUPPORT - os_include_dir="os/hpux" - AC_DEFINE(HAVE_COPYSIGN) - AC_DEFINE(HAVE_COPYSIGNF) - AC_DEFINE(HAVE_FREXPF) - AC_DEFINE(HAVE_HYPOT) - case "$target" in - *-hpux10*) - AC_DEFINE(HAVE_FINITE) - AC_DEFINE(HAVE_FINITEF) - AC_DEFINE(HAVE_ISINF) - AC_DEFINE(HAVE_ISINFF) - AC_DEFINE(HAVE_ISNAN) - AC_DEFINE(HAVE_ISNANF) - ;; - esac - - ;; - *-netbsd*) - # Check for available headers. - AC_CHECK_HEADERS([nan.h ieeefp.h endian.h sys/isa_defs.h \ - machine/endian.h machine/param.h sys/machine.h sys/types.h \ - fp.h locale.h float.h inttypes.h]) - SECTION_FLAGS='-ffunction-sections -fdata-sections' - AC_SUBST(SECTION_FLAGS) - GLIBCPP_CHECK_LINKER_FEATURES - GLIBCPP_CHECK_COMPLEX_MATH_SUPPORT - GLIBCPP_CHECK_WCHAR_T_SUPPORT - os_include_dir="os/bsd/netbsd" - AC_DEFINE(HAVE_COPYSIGN) - AC_DEFINE(HAVE_COPYSIGNF) - AC_DEFINE(HAVE_FINITEF) - AC_DEFINE(HAVE_FINITE) - AC_DEFINE(HAVE_FREXPF) - AC_DEFINE(HAVE_HYPOTF) - AC_DEFINE(HAVE_ISINF) - AC_DEFINE(HAVE_ISINFF) - AC_DEFINE(HAVE_ISNAN) - AC_DEFINE(HAVE_ISNANF) - if test x"long_double_math_on_this_cpu" = x"yes"; then - AC_DEFINE(HAVE_FINITEL) - AC_DEFINE(HAVE_ISINFL) - AC_DEFINE(HAVE_ISNANL) - fi - ;; - *-freebsd*) - # Check for available headers. - AC_CHECK_HEADERS([nan.h ieeefp.h endian.h sys/isa_defs.h \ - machine/endian.h machine/param.h sys/machine.h sys/types.h \ - fp.h locale.h float.h inttypes.h sys/resource.h sys/stat.h \ - sys/time.h unistd.h]) - SECTION_FLAGS='-ffunction-sections -fdata-sections' - AC_SUBST(SECTION_FLAGS) - GLIBCPP_CHECK_LINKER_FEATURES - GLIBCPP_CHECK_COMPLEX_MATH_SUPPORT - GLIBCPP_CHECK_WCHAR_T_SUPPORT - os_include_dir="os/bsd/freebsd" - AC_DEFINE(HAVE_LC_MESSAGES) - AC_DEFINE(HAVE_DRAND48) - AC_DEFINE(HAVE_GETPAGESIZE) - AC_DEFINE(HAVE_SETENV) - AC_DEFINE(HAVE_SIGSETJMP) - AC_DEFINE(HAVE_COPYSIGN) - AC_DEFINE(HAVE_COPYSIGNF) - AC_DEFINE(HAVE_FINITEF) - AC_DEFINE(HAVE_FINITE) - AC_DEFINE(HAVE_FREXPF) - AC_DEFINE(HAVE_HYPOT) - AC_DEFINE(HAVE_HYPOTF) - AC_DEFINE(HAVE_ISINF) - AC_DEFINE(HAVE_ISNAN) - AC_DEFINE(HAVE_ISNANF) - if test x"long_double_math_on_this_cpu" = x"yes"; then - AC_DEFINE(HAVE_FINITEL) - AC_DEFINE(HAVE_ISINFL) - AC_DEFINE(HAVE_ISNANL) - fi - ;; - *-mingw32*) - AC_CHECK_HEADERS([sys/types.h locale.h float.h]) - GLIBCPP_CHECK_LINKER_FEATURES - GLIBCPP_CHECK_COMPLEX_MATH_SUPPORT - GLIBCPP_CHECK_WCHAR_T_SUPPORT - os_include_dir="os/mingw32" - ;; - *-windiss*) - os_include_dir="os/windiss" - ;; -changequote(,)dnl - *-qnx6.[12]*) -changequote([,])dnl - SECTION_FLAGS='-ffunction-sections -fdata-sections' - AC_SUBST(SECTION_FLAGS) - GLIBCPP_CHECK_LINKER_FEATURES - GLIBCPP_CHECK_COMPLEX_MATH_SUPPORT - GLIBCPP_CHECK_WCHAR_T_SUPPORT - os_include_dir="os/qnx/qnx6.1" - AC_DEFINE(HAVE_COSF) - AC_DEFINE(HAVE_COSL) - AC_DEFINE(HAVE_COSHF) - AC_DEFINE(HAVE_COSHL) - AC_DEFINE(HAVE_LOGF) - AC_DEFINE(HAVE_LOGL) - AC_DEFINE(HAVE_LOG10F) - AC_DEFINE(HAVE_LOG10L) - AC_DEFINE(HAVE_SINF) - AC_DEFINE(HAVE_SINL) - AC_DEFINE(HAVE_SINHF) - AC_DEFINE(HAVE_SINHL) - ;; - *) - os_include_dir="os/newlib" - AC_DEFINE(HAVE_HYPOT) - ;; - esac - - case "$target" in - *-mingw32*) - ;; - *-windiss*) - AC_DEFINE(HAVE_ACOSF) - AC_DEFINE(HAVE_ASINF) - AC_DEFINE(HAVE_ATAN2F) - AC_DEFINE(HAVE_ATANF) - AC_DEFINE(HAVE_CEILF) - AC_DEFINE(HAVE_COPYSIGN) - AC_DEFINE(HAVE_COPYSIGNF) - AC_DEFINE(HAVE_COSF) - AC_DEFINE(HAVE_COSHF) - AC_DEFINE(HAVE_EXPF) - AC_DEFINE(HAVE_FABSF) - AC_DEFINE(HAVE_FLOORF) - AC_DEFINE(HAVE_FMODF) - AC_DEFINE(HAVE_FREXPF) - AC_DEFINE(HAVE_LDEXPF) - AC_DEFINE(HAVE_LOG10F) - AC_DEFINE(HAVE_LOGF) - AC_DEFINE(HAVE_MODFF) - AC_DEFINE(HAVE_POWF) - AC_DEFINE(HAVE_SINF) - AC_DEFINE(HAVE_SINHF) - AC_DEFINE(HAVE_SQRTF) - AC_DEFINE(HAVE_TANF) - AC_DEFINE(HAVE_TANHF) - ;; - *-freebsd*) - # Must replicate generic section since we don't have strtof or strtold. - AC_DEFINE(HAVE_MMAP) - AC_DEFINE(HAVE_ACOSF) - AC_DEFINE(HAVE_ASINF) - AC_DEFINE(HAVE_ATAN2F) - AC_DEFINE(HAVE_ATANF) - AC_DEFINE(HAVE_CEILF) - AC_DEFINE(HAVE_COPYSIGN) - AC_DEFINE(HAVE_COPYSIGNF) - AC_DEFINE(HAVE_COSF) - AC_DEFINE(HAVE_COSHF) - AC_DEFINE(HAVE_EXPF) - AC_DEFINE(HAVE_FABSF) - AC_DEFINE(HAVE_FLOORF) - AC_DEFINE(HAVE_FMODF) - AC_DEFINE(HAVE_FREXPF) - AC_DEFINE(HAVE_LDEXPF) - AC_DEFINE(HAVE_LOG10F) - AC_DEFINE(HAVE_LOGF) - AC_DEFINE(HAVE_MODFF) - AC_DEFINE(HAVE_POWF) - AC_DEFINE(HAVE_SINF) - AC_DEFINE(HAVE_SINHF) - AC_DEFINE(HAVE_SQRTF) - AC_DEFINE(HAVE_TANF) - AC_DEFINE(HAVE_TANHF) - ;; - *) - # GLIBCPP_CHECK_STDLIB_SUPPORT - AC_DEFINE(HAVE_STRTOF) - AC_DEFINE(HAVE_STRTOLD) - # AC_FUNC_MMAP - AC_DEFINE(HAVE_MMAP) - - AC_DEFINE(HAVE_ACOSF) - AC_DEFINE(HAVE_ASINF) - AC_DEFINE(HAVE_ATAN2F) - AC_DEFINE(HAVE_ATANF) - AC_DEFINE(HAVE_CEILF) - AC_DEFINE(HAVE_COPYSIGN) - AC_DEFINE(HAVE_COPYSIGNF) - AC_DEFINE(HAVE_COSF) - AC_DEFINE(HAVE_COSHF) - AC_DEFINE(HAVE_EXPF) - AC_DEFINE(HAVE_FABSF) - AC_DEFINE(HAVE_FLOORF) - AC_DEFINE(HAVE_FMODF) - AC_DEFINE(HAVE_FREXPF) - AC_DEFINE(HAVE_LDEXPF) - AC_DEFINE(HAVE_LOG10F) - AC_DEFINE(HAVE_LOGF) - AC_DEFINE(HAVE_MODFF) - AC_DEFINE(HAVE_POWF) - AC_DEFINE(HAVE_SINF) - AC_DEFINE(HAVE_SINHF) - AC_DEFINE(HAVE_SQRTF) - AC_DEFINE(HAVE_TANF) - AC_DEFINE(HAVE_TANHF) - ;; - esac - - # At some point, we should differentiate between architectures - # like x86, which have long double versions, and alpha/powerpc/etc., - # which don't. For the time being, punt. - if test x"long_double_math_on_this_cpu" = x"yes"; then - AC_DEFINE(HAVE_ACOSL) - AC_DEFINE(HAVE_ASINL) - AC_DEFINE(HAVE_ATAN2L) - AC_DEFINE(HAVE_ATANL) - AC_DEFINE(HAVE_CEILL) - AC_DEFINE(HAVE_COPYSIGNL) - AC_DEFINE(HAVE_COSL) - AC_DEFINE(HAVE_COSHL) - AC_DEFINE(HAVE_EXPL) - AC_DEFINE(HAVE_FABSL) - AC_DEFINE(HAVE_FLOORL) - AC_DEFINE(HAVE_FMODL) - AC_DEFINE(HAVE_FREXPL) - AC_DEFINE(HAVE_LDEXPL) - AC_DEFINE(HAVE_LOG10L) - AC_DEFINE(HAVE_LOGL) - AC_DEFINE(HAVE_MODFL) - AC_DEFINE(HAVE_POWL) - AC_DEFINE(HAVE_SINCOSL) - AC_DEFINE(HAVE_SINL) - AC_DEFINE(HAVE_SINHL) - AC_DEFINE(HAVE_SQRTL) - AC_DEFINE(HAVE_TANL) - AC_DEFINE(HAVE_TANHL) - fi - -else - - # We are being configured natively. We can do more elaborate tests - # that include AC_TRY_COMPILE now, as the linker is assumed to be - # working. - GLIBCPP_IS_CROSS_COMPILING=false - CANADIAN=no - - # Check for available headers. - AC_CHECK_HEADERS([nan.h ieeefp.h endian.h sys/isa_defs.h machine/endian.h \ - machine/param.h sys/machine.h fp.h locale.h float.h inttypes.h gconv.h sys/types.h]) - - GLIBCPP_CHECK_COMPILER_FEATURES - GLIBCPP_CHECK_LINKER_FEATURES - GLIBCPP_CHECK_BUILTIN_MATH_SUPPORT - GLIBCPP_CHECK_MATH_SUPPORT - GLIBCPP_CHECK_COMPLEX_MATH_SUPPORT - GLIBCPP_CHECK_WCHAR_T_SUPPORT - GLIBCPP_CHECK_STDLIB_SUPPORT - GLIBCPP_CHECK_UNISTD_SUPPORT - - # For showmanyc_helper(). - AC_CHECK_HEADERS(sys/ioctl.h sys/filio.h) - GLIBCPP_CHECK_POLL - GLIBCPP_CHECK_S_ISREG_OR_S_IFREG - - AC_LC_MESSAGES - - AC_TRY_COMPILE([ - #include <setjmp.h> - ], [sigjmp_buf env; while (! sigsetjmp (env, 1)) siglongjmp (env, 1);], - [AC_DEFINE(HAVE_SIGSETJMP, 1, [Define if sigsetjmp is available. ]) - ]) - - AC_FUNC_MMAP - -fi - -# This depends on GLIBCPP_CHECK_LINKER_FEATURES, but without it assumes no. -GLIBCPP_ENABLE_SYMVERS([yes]) - -# This depends on GLIBCPP_ENABLE_SYMVERS and GLIBCPP_IS_CROSS_COMPILING. -GLIBCPP_CONFIGURE_TESTSUITE - -# Propagate the target-specific source directories through the build chain. -# (Nothing currently uses cpu_include_dir directly; only ATOMICITYH -# uses it, and it only gets used in this file.) -OS_INC_SRCDIR=config/${os_include_dir} -ATOMICITY_INC_SRCDIR=config/${ATOMICITYH} -AC_SUBST(OS_INC_SRCDIR) -AC_SUBST(ATOMICITY_INC_SRCDIR) - -# Set up cross-compile flags -AC_SUBST(GLIBCPP_IS_CROSS_COMPILING) dnl Unused so far. -AM_CONDITIONAL(CANADIAN, test "$CANADIAN" = yes) - -AC_CACHE_SAVE - -if test "${multilib}" = "yes"; then - multilib_arg="--enable-multilib" -else - multilib_arg= -fi - -# Export all the install information -GLIBCPP_EXPORT_INSTALL_INFO - -# Export all the include and flag information to makefiles. -GLIBCPP_EXPORT_INCLUDES -GLIBCPP_EXPORT_FLAGS - -if ${CONFIG_SHELL-/bin/sh} ./libtool --tag CXX --features | - grep "enable shared" > /dev/null; then - LIBSUPCXX_PICFLAGS=-prefer-pic -else - LIBSUPCXX_PICFLAGS= -fi -AC_SUBST(LIBSUPCXX_PICFLAGS) - -# Generate the various Makefiles, include files, and scripts. -# NB: Multilibs need MULTISUBDIR defined correctly in src/Makefile.am -# libsupc++/Makefile.am and testsuite/Makefile.am so that multilib installs -# will end up installed in the correct place. To work around this not being -# passed down from config-ml.in -> top_srcdir/Makefile.am -> -# top_srcdir/{src,libsupc++}/Makefile.am, manually append it here. -AC_OUTPUT(Makefile \ - include/Makefile src/Makefile \ - libmath/Makefile libio/Makefile libsupc++/Makefile \ - po/Makefile testsuite/Makefile mkcheck testsuite_flags, -[if test -n "$CONFIG_FILES"; then - LD="${ORIGINAL_LD_FOR_MULTILIBS}" - ac_file=Makefile . ${glibcpp_basedir}/../config-ml.in - grep '^MULTISUBDIR =' Makefile >> src/Makefile - grep '^MULTISUBDIR =' Makefile >> libsupc++/Makefile - grep '^MULTISUBDIR =' Makefile >> testsuite/Makefile -fi -chmod +x mkcheck -chmod +x testsuite_flags -], -srcdir=${srcdir} -host=${host} -target=${target} -with_multisubdir=${with_multisubdir} -ac_configure_args="${multilib_arg} ${ac_configure_args}" -CONFIG_SHELL=${CONFIG_SHELL-/bin/sh} -glibcpp_basedir=${glibcpp_basedir} -CC="${CC}" -CXX="${CXX}" -ORIGINAL_LD_FOR_MULTILIBS="${ORIGINAL_LD_FOR_MULTILIBS}" -) -dnl In autoconf 2.5x, AC_OUTPUT is replaced by three AC_ macros: -dnl AC_CONFIG_FILES(Makefile \ -dnl include/Makefile src/Makefile \ -dnl libmath/Makefile libio/Makefile libsupc++/Makefile \ -dnl po/Makefile testsuite/Makefile mkcheck testsuite_flags) -dnl AC_CONFIG_COMMANDS([default], -dnl [if test -n "$CONFIG_FILES"; then -dnl ac_file=Makefile . ${glibcpp_basedir}/../config-ml.in -dnl grep '^MULTISUBDIR =' Makefile >> src/Makefile -dnl grep '^MULTISUBDIR =' Makefile >> libsupc++/Makefile -dnl grep '^MULTISUBDIR =' Makefile >> testsuite/Makefile -dnl fi -dnl chmod +x mkcheck -dnl chmod +x testsuite_flags -dnl ], -dnl srcdir=${srcdir} -dnl host=${host} -dnl target=${target} -dnl with_multisubdir=${with_multisubdir} -dnl ac_configure_args="${multilib_arg} ${ac_configure_args}" -dnl CONFIG_SHELL=${CONFIG_SHELL-/bin/sh} -dnl glibcpp_basedir=${glibcpp_basedir} -dnl CC="${CC}" -dnl CXX="${CXX}" -dnl ) -dnl AC_OUTPUT - - -# Sanity checking & User-visible messages. -# Checks down here, otherwise they get scrolled off before -# the user will notice. - -# Trying to get more people to read documentation. Possibly remove -# check and warn all the time. There is no "informational" AC_MSG_ -# macro, so these are going to be printed even when --quiet/--silent -# is given. -if test ! -f stamp-sanity-warned; then - touch stamp-sanity-warned - echo "" - echo "Please make certain that you read the installation information here:" - echo " faster => ${srcdir}/docs/html/install.html" - echo " slower => <URL:http://gcc.gnu.org/onlinedocs/libstdc++/install.html>" - echo "" - echo "and the configuration information here:" - echo " faster => ${srcdir}/docs/html/configopts.html" - echo " slower => <URL:http://gcc.gnu.org/onlinedocs/libstdc++/configopts.html>" - echo "" - echo "before proceeding with ${_cv_gnu_make_command}." - echo "" -fi diff --git a/contrib/libstdc++/configure.target b/contrib/libstdc++/configure.target deleted file mode 100644 index c1d1cb1..0000000 --- a/contrib/libstdc++/configure.target +++ /dev/null @@ -1,200 +0,0 @@ -# configure.target -# -# This shell script handles all target based configuration for libstdc++. -# It sets various shell variables based on the the target and the -# configuration options. You can modify this shell script without needing -# to rerun autoconf/aclocal/etc. This file is "sourced" not executed. -# -# You should read docs/html/17_intro/porting.* to make sense of this file. -# -# -# It uses the following shell variables as set by config.guess: -# target The configuration target (full CPU-vendor-OS triplet) -# target_cpu The configuration target CPU -# target_os The configuration target OS -# -# -# It sets the following shell variables: -# -# cpu_include_dir CPU-specific directory, defaults to cpu/generic -# if cpu/target_cpu doesn't exist. This is -# used to set ATOMICITYH. -# -# os_include_dir OS-specific directory, defaults to os/generic. -# -# c_model the model to use for "C" headers, defaults to c_std. -# -# c_compatibility if "C" compatibility headers are necessary, -# defaults to no. -# -# abi_baseline_pair directory name for ABI compat testing, -# defaults to target (as per config.guess) -# -# ATOMICITYH location of atomicity.h, -# defaults to cpu_include_dir -# -# It possibly modifies the following variables: -# -# OPT_LDFLAGS extra flags to pass when linking the library, of -# the form '-Wl,blah' -# (defaults to empty in acinclude.m4) -# -# -# If the defaults will not work for your platform, you need only change the -# variables that won't work, i.e., you do not need to explicitly set a -# working variable to its default. Most targets only need to change the two -# *_include_dir variables. - - -# DEFAULTS -# Try to guess a default cpu_include_dir based on the name of the CPU. We -# cannot do this for os_include_dir; there are too many portable operating -# systems out there. :-) -c_model=c_std -c_compatibility=no - - -# TARGET-SPECIFIC OVERRIDES -# Set any CPU-dependent bits. -# Here we override defaults and catch more general cases due to naming -# conventions (e.g., chip_name* to catch all variants). -# THIS TABLE IS SORTED. KEEP IT THAT WAY. - -case "${target_cpu}" in - alpha*) - try_cpu=alpha - ;; - athlon* | i586 | i686 | i786 | x86_64) - try_cpu=i486 - ;; - hppa*) - try_cpu=hppa - ;; - m680[246]0) - try_cpu=m68k - ;; - powerpc* | rs6000) - try_cpu=powerpc - ;; - s390x) - try_cpu=s390 - ;; - sparc* | ultrasparc) - try_cpu=sparc - ;; - *) - if test -d ${glibcpp_srcdir}/config/cpu/${target_cpu}; then - try_cpu=${target_cpu} - else - try_cpu=generic - fi - ;; -esac - - -# Now look for the file(s) usually tied to a CPU model, and make -# default choices for those if they haven't been explicitly set -# already. -cpu_include_dir="cpu/${try_cpu}" -ATOMICITYH=$cpu_include_dir -abi_baseline_pair=${try_cpu}-${host_os} - -# Set any OS-dependent bits. -# Set the os_include_dir. -# Set c_model, c_compatibility here. -# If atomic ops and/or numeric limits are OS-specific rather than -# CPU-specifc, set those here too. -# THIS TABLE IS SORTED. KEEP IT THAT WAY. -case "${target_os}" in - aix4.[3456789]* | aix[56789]*) - # We set os_include_dir to os/aix only on AIX 4.3 and newer, but - # os/aix/atomicity.h works on earlier versions of AIX 4.*, so we - # explicitly duplicate the directory for 4.[<3]. - os_include_dir="os/aix" - ATOMICITYH="os/aix" - OPT_LDFLAGS="-Wl,-G" - ;; - aix4.*) - ATOMICITYH="os/aix" - ;; - aix*) - ATOMICITYH="cpu/generic" - ;; - bsd*) - # Plain BSD attempts to share FreeBSD files. - os_include_dir="os/bsd/freebsd" - ;; - cygwin*) - os_include_dir="os/newlib" - ;; - *djgpp*) # leading * picks up "msdosdjgpp" - os_include_dir="os/djgpp" - ;; - freebsd*) - os_include_dir="os/bsd/freebsd" - ;; - gnu* | linux*) - os_include_dir="os/gnu-linux" - ;; - hpux*) - os_include_dir="os/hpux" - ;; - irix[1-6] | irix[1-5].* | irix6.[0-4]*) - # This is known to work on at least IRIX 5.2 and 6.3. - os_include_dir="os/irix/irix5.2" - ATOMICITYH=$os_include_dir - ;; - irix6.5*) - os_include_dir="os/irix/irix6.5" - ATOMICITYH=$os_include_dir - ;; - mingw32*) - os_include_dir="os/mingw32" - ;; - netbsd*) - os_include_dir="os/bsd/netbsd" - ;; - solaris2.5 | solaris2.5.[0-9]) - os_include_dir="os/solaris/solaris2.5" - ;; - solaris2.6) - os_include_dir="os/solaris/solaris2.6" - ;; - solaris2.[789] | solaris2.1[0-9]) - os_include_dir="os/solaris/solaris2.7" - ;; - windiss*) - os_include_dir="os/windiss" - ;; - qnx6.[12]*) - os_include_dir="os/qnx/qnx6.1" - c_model=c - ;; - *) - os_include_dir="os/generic" - ;; -esac - - -# Set any OS-dependent and CPU-dependent bits. -# THIS TABLE IS SORTED. KEEP IT THAT WAY. -case "${target}" in - mips*-*-linux*) - ATOMICITYH="cpu/mips" - ;; - x86_64-*-linux*) - abi_baseline_pair="x86_64-linux-gnu" - ;; - alpha*-*-freebsd5*) - abi_baseline_pair="alpha-freebsd5" - ;; - i*86-*-freebsd4*) - abi_baseline_pair="i386-freebsd4" - ;; - i*86-*-freebsd5*) - abi_baseline_pair="i386-freebsd5" - ;; - sparc*-*-freebsd5*) - abi_baseline_pair="sparc-freebsd5" - ;; -esac diff --git a/contrib/libstdc++/include/bits/fpos.h b/contrib/libstdc++/include/bits/fpos.h deleted file mode 100644 index 5432527..0000000 --- a/contrib/libstdc++/include/bits/fpos.h +++ /dev/null @@ -1,127 +0,0 @@ -// File position object and stream types - -// Copyright (C) 1997, 1998, 1999, 2000, 2001 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. - -// -// ISO C++ 14882: 27 Input/output library -// - -/** @file fpos.h - * This is an internal header file, included by other library headers. - * You should not attempt to use it directly. - */ - -#ifndef _CPP_BITS_FPOS_H -#define _CPP_BITS_FPOS_H 1 - -#pragma GCC system_header - -#include <bits/c++io.h> -#include <cwchar> // For mbstate_t. - -namespace std -{ - // 27.4.1 Types - - // [27.4.3] template class fpos - /** - * @doctodo - */ - template<typename _StateT> - class fpos - { - public: - // Types: - typedef _StateT __state_type; - - private: - streamoff _M_off; - __state_type _M_st; - - public: - __state_type - state() const { return _M_st; } - - void - state(__state_type __st) { _M_st = __st; } - - // NB: The standard defines only the implicit copy ctor and the - // previous two members. The rest is a "conforming extension". - fpos(): _M_off(streamoff()), _M_st(__state_type()) { } - - fpos(streamoff __off, __state_type __st = __state_type()) - : _M_off(__off), _M_st(__st) { } - - operator streamoff() const { return _M_off; } - - fpos& - operator+=(streamoff __off) { _M_off += __off; return *this; } - - fpos& - operator-=(streamoff __off) { _M_off -= __off; return *this; } - - fpos - operator+(streamoff __off) - { - fpos __t(*this); - __t += __off; - return __t; - } - - fpos - operator-(streamoff __off) - { - fpos __t(*this); - __t -= __off; - return __t; - } - - bool - operator==(const fpos& __pos) const - { return _M_off == __pos._M_off; } - - bool - operator!=(const fpos& __pos) const - { return _M_off != __pos._M_off; } - - streamoff - _M_position() const { return _M_off; } - - void - _M_position(streamoff __off) { _M_off = __off; } - }; - - /// 27.2, paragraph 10 about fpos/char_traits circularity - typedef fpos<mbstate_t> streampos; -# ifdef _GLIBCPP_USE_WCHAR_T - /// 27.2, paragraph 10 about fpos/char_traits circularity - typedef fpos<mbstate_t> wstreampos; -# endif -} // namespace std - -#endif diff --git a/contrib/libstdc++/include/bits/pthread_allocimpl.h b/contrib/libstdc++/include/bits/pthread_allocimpl.h deleted file mode 100644 index 050b206..0000000 --- a/contrib/libstdc++/include/bits/pthread_allocimpl.h +++ /dev/null @@ -1,525 +0,0 @@ -// POSIX thread-related memory allocation -*- C++ -*- - -// Copyright (C) 2001 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. - -/* - * Copyright (c) 1996 - * Silicon Graphics Computer Systems, Inc. - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Silicon Graphics makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - */ - -/** @file pthread_allocimpl.h - * This is an internal header file, included by other library headers. - * You should not attempt to use it directly. - */ - -#ifndef _CPP_BITS_PTHREAD_ALLOCIMPL_H -#define _CPP_BITS_PTHREAD_ALLOCIMPL_H 1 - -// Pthread-specific node allocator. -// This is similar to the default allocator, except that free-list -// information is kept separately for each thread, avoiding locking. -// This should be reasonably fast even in the presence of threads. -// The down side is that storage may not be well-utilized. -// It is not an error to allocate memory in thread A and deallocate -// it in thread B. But this effectively transfers ownership of the memory, -// so that it can only be reallocated by thread B. Thus this can effectively -// result in a storage leak if it's done on a regular basis. -// It can also result in frequent sharing of -// cache lines among processors, with potentially serious performance -// consequences. - -#include <bits/c++config.h> -#include <cerrno> -#include <bits/stl_alloc.h> -#ifndef __RESTRICT -# define __RESTRICT -#endif - -#include <new> - -namespace std -{ - -#define __STL_DATA_ALIGNMENT 8 - -union _Pthread_alloc_obj { - union _Pthread_alloc_obj * __free_list_link; - char __client_data[__STL_DATA_ALIGNMENT]; /* The client sees this. */ -}; - -// Pthread allocators don't appear to the client to have meaningful -// instances. We do in fact need to associate some state with each -// thread. That state is represented by -// _Pthread_alloc_per_thread_state<_Max_size>. - -template<size_t _Max_size> -struct _Pthread_alloc_per_thread_state { - typedef _Pthread_alloc_obj __obj; - enum { _S_NFREELISTS = _Max_size/__STL_DATA_ALIGNMENT }; - _Pthread_alloc_obj* volatile __free_list[_S_NFREELISTS]; - _Pthread_alloc_per_thread_state<_Max_size> * __next; - // Free list link for list of available per thread structures. - // When one of these becomes available for reuse due to thread - // termination, any objects in its free list remain associated - // with it. The whole structure may then be used by a newly - // created thread. - _Pthread_alloc_per_thread_state() : __next(0) - { - memset((void *)__free_list, 0, (size_t) _S_NFREELISTS * sizeof(__obj *)); - } - // Returns an object of size __n, and possibly adds to size n free list. - void *_M_refill(size_t __n); -}; - -// Pthread-specific allocator. -// The argument specifies the largest object size allocated from per-thread -// free lists. Larger objects are allocated using malloc_alloc. -// Max_size must be a power of 2. -template <size_t _Max_size = 128> -class _Pthread_alloc_template { - -public: // but only for internal use: - - typedef _Pthread_alloc_obj __obj; - - // Allocates a chunk for nobjs of size size. nobjs may be reduced - // if it is inconvenient to allocate the requested number. - static char *_S_chunk_alloc(size_t __size, int &__nobjs); - - enum {_S_ALIGN = __STL_DATA_ALIGNMENT}; - - static size_t _S_round_up(size_t __bytes) { - return (((__bytes) + (int) _S_ALIGN-1) & ~((int) _S_ALIGN - 1)); - } - static size_t _S_freelist_index(size_t __bytes) { - return (((__bytes) + (int) _S_ALIGN-1)/(int)_S_ALIGN - 1); - } - -private: - // Chunk allocation state. And other shared state. - // Protected by _S_chunk_allocator_lock. - static pthread_mutex_t _S_chunk_allocator_lock; - static char *_S_start_free; - static char *_S_end_free; - static size_t _S_heap_size; - static _Pthread_alloc_per_thread_state<_Max_size>* _S_free_per_thread_states; - static pthread_key_t _S_key; - static bool _S_key_initialized; - // Pthread key under which per thread state is stored. - // Allocator instances that are currently unclaimed by any thread. - static void _S_destructor(void *instance); - // Function to be called on thread exit to reclaim per thread - // state. - static _Pthread_alloc_per_thread_state<_Max_size> *_S_new_per_thread_state(); - // Return a recycled or new per thread state. - static _Pthread_alloc_per_thread_state<_Max_size> *_S_get_per_thread_state(); - // ensure that the current thread has an associated - // per thread state. - class _M_lock; - friend class _M_lock; - class _M_lock { - public: - _M_lock () { pthread_mutex_lock(&_S_chunk_allocator_lock); } - ~_M_lock () { pthread_mutex_unlock(&_S_chunk_allocator_lock); } - }; - -public: - - /* n must be > 0 */ - static void * allocate(size_t __n) - { - __obj * volatile * __my_free_list; - __obj * __RESTRICT __result; - _Pthread_alloc_per_thread_state<_Max_size>* __a; - - if (__n > _Max_size) { - return(malloc_alloc::allocate(__n)); - } - if (!_S_key_initialized || - !(__a = (_Pthread_alloc_per_thread_state<_Max_size>*) - pthread_getspecific(_S_key))) { - __a = _S_get_per_thread_state(); - } - __my_free_list = __a -> __free_list + _S_freelist_index(__n); - __result = *__my_free_list; - if (__result == 0) { - void *__r = __a -> _M_refill(_S_round_up(__n)); - return __r; - } - *__my_free_list = __result -> __free_list_link; - return (__result); - }; - - /* p may not be 0 */ - static void deallocate(void *__p, size_t __n) - { - __obj *__q = (__obj *)__p; - __obj * volatile * __my_free_list; - _Pthread_alloc_per_thread_state<_Max_size>* __a; - - if (__n > _Max_size) { - malloc_alloc::deallocate(__p, __n); - return; - } - if (!_S_key_initialized || - !(__a = (_Pthread_alloc_per_thread_state<_Max_size> *) - pthread_getspecific(_S_key))) { - __a = _S_get_per_thread_state(); - } - __my_free_list = __a->__free_list + _S_freelist_index(__n); - __q -> __free_list_link = *__my_free_list; - *__my_free_list = __q; - } - - static void * reallocate(void *__p, size_t __old_sz, size_t __new_sz); - -} ; - -typedef _Pthread_alloc_template<> pthread_alloc; - - -template <size_t _Max_size> -void _Pthread_alloc_template<_Max_size>::_S_destructor(void * __instance) -{ - _M_lock __lock_instance; // Need to acquire lock here. - _Pthread_alloc_per_thread_state<_Max_size>* __s = - (_Pthread_alloc_per_thread_state<_Max_size> *)__instance; - __s -> __next = _S_free_per_thread_states; - _S_free_per_thread_states = __s; -} - -template <size_t _Max_size> -_Pthread_alloc_per_thread_state<_Max_size> * -_Pthread_alloc_template<_Max_size>::_S_new_per_thread_state() -{ - /* lock already held here. */ - if (0 != _S_free_per_thread_states) { - _Pthread_alloc_per_thread_state<_Max_size> *__result = - _S_free_per_thread_states; - _S_free_per_thread_states = _S_free_per_thread_states -> __next; - return __result; - } else { - return new _Pthread_alloc_per_thread_state<_Max_size>; - } -} - -template <size_t _Max_size> -_Pthread_alloc_per_thread_state<_Max_size> * -_Pthread_alloc_template<_Max_size>::_S_get_per_thread_state() -{ - /*REFERENCED*/ - _M_lock __lock_instance; // Need to acquire lock here. - int __ret_code; - _Pthread_alloc_per_thread_state<_Max_size> * __result; - if (!_S_key_initialized) { - if (pthread_key_create(&_S_key, _S_destructor)) { - std::__throw_bad_alloc(); // defined in funcexcept.h - } - _S_key_initialized = true; - } - __result = _S_new_per_thread_state(); - __ret_code = pthread_setspecific(_S_key, __result); - if (__ret_code) { - if (__ret_code == ENOMEM) { - std::__throw_bad_alloc(); - } else { - // EINVAL - abort(); - } - } - return __result; -} - -/* We allocate memory in large chunks in order to avoid fragmenting */ -/* the malloc heap too much. */ -/* We assume that size is properly aligned. */ -template <size_t _Max_size> -char *_Pthread_alloc_template<_Max_size> -::_S_chunk_alloc(size_t __size, int &__nobjs) -{ - { - char * __result; - size_t __total_bytes; - size_t __bytes_left; - /*REFERENCED*/ - _M_lock __lock_instance; // Acquire lock for this routine - - __total_bytes = __size * __nobjs; - __bytes_left = _S_end_free - _S_start_free; - if (__bytes_left >= __total_bytes) { - __result = _S_start_free; - _S_start_free += __total_bytes; - return(__result); - } else if (__bytes_left >= __size) { - __nobjs = __bytes_left/__size; - __total_bytes = __size * __nobjs; - __result = _S_start_free; - _S_start_free += __total_bytes; - return(__result); - } else { - size_t __bytes_to_get = - 2 * __total_bytes + _S_round_up(_S_heap_size >> 4); - // Try to make use of the left-over piece. - if (__bytes_left > 0) { - _Pthread_alloc_per_thread_state<_Max_size>* __a = - (_Pthread_alloc_per_thread_state<_Max_size>*) - pthread_getspecific(_S_key); - __obj * volatile * __my_free_list = - __a->__free_list + _S_freelist_index(__bytes_left); - - ((__obj *)_S_start_free) -> __free_list_link = *__my_free_list; - *__my_free_list = (__obj *)_S_start_free; - } -# ifdef _SGI_SOURCE - // Try to get memory that's aligned on something like a - // cache line boundary, so as to avoid parceling out - // parts of the same line to different threads and thus - // possibly different processors. - { - const int __cache_line_size = 128; // probable upper bound - __bytes_to_get &= ~(__cache_line_size-1); - _S_start_free = (char *)memalign(__cache_line_size, __bytes_to_get); - if (0 == _S_start_free) { - _S_start_free = (char *)malloc_alloc::allocate(__bytes_to_get); - } - } -# else /* !SGI_SOURCE */ - _S_start_free = (char *)malloc_alloc::allocate(__bytes_to_get); -# endif - _S_heap_size += __bytes_to_get; - _S_end_free = _S_start_free + __bytes_to_get; - } - } - // lock is released here - return(_S_chunk_alloc(__size, __nobjs)); -} - - -/* Returns an object of size n, and optionally adds to size n free list.*/ -/* We assume that n is properly aligned. */ -/* We hold the allocation lock. */ -template <size_t _Max_size> -void *_Pthread_alloc_per_thread_state<_Max_size> -::_M_refill(size_t __n) -{ - int __nobjs = 128; - char * __chunk = - _Pthread_alloc_template<_Max_size>::_S_chunk_alloc(__n, __nobjs); - __obj * volatile * __my_free_list; - __obj * __result; - __obj * __current_obj, * __next_obj; - int __i; - - if (1 == __nobjs) { - return(__chunk); - } - __my_free_list = __free_list - + _Pthread_alloc_template<_Max_size>::_S_freelist_index(__n); - - /* Build free list in chunk */ - __result = (__obj *)__chunk; - *__my_free_list = __next_obj = (__obj *)(__chunk + __n); - for (__i = 1; ; __i++) { - __current_obj = __next_obj; - __next_obj = (__obj *)((char *)__next_obj + __n); - if (__nobjs - 1 == __i) { - __current_obj -> __free_list_link = 0; - break; - } else { - __current_obj -> __free_list_link = __next_obj; - } - } - return(__result); -} - -template <size_t _Max_size> -void *_Pthread_alloc_template<_Max_size> -::reallocate(void *__p, size_t __old_sz, size_t __new_sz) -{ - void * __result; - size_t __copy_sz; - - if (__old_sz > _Max_size - && __new_sz > _Max_size) { - return(realloc(__p, __new_sz)); - } - if (_S_round_up(__old_sz) == _S_round_up(__new_sz)) return(__p); - __result = allocate(__new_sz); - __copy_sz = __new_sz > __old_sz? __old_sz : __new_sz; - memcpy(__result, __p, __copy_sz); - deallocate(__p, __old_sz); - return(__result); -} - -template <size_t _Max_size> -_Pthread_alloc_per_thread_state<_Max_size> * -_Pthread_alloc_template<_Max_size>::_S_free_per_thread_states = 0; - -template <size_t _Max_size> -pthread_key_t _Pthread_alloc_template<_Max_size>::_S_key; - -template <size_t _Max_size> -bool _Pthread_alloc_template<_Max_size>::_S_key_initialized = false; - -template <size_t _Max_size> -pthread_mutex_t _Pthread_alloc_template<_Max_size>::_S_chunk_allocator_lock -= PTHREAD_MUTEX_INITIALIZER; - -template <size_t _Max_size> -char *_Pthread_alloc_template<_Max_size> -::_S_start_free = 0; - -template <size_t _Max_size> -char *_Pthread_alloc_template<_Max_size> -::_S_end_free = 0; - -template <size_t _Max_size> -size_t _Pthread_alloc_template<_Max_size> -::_S_heap_size = 0; - - -template <class _Tp> -class pthread_allocator { - typedef pthread_alloc _S_Alloc; // The underlying allocator. -public: - typedef size_t size_type; - typedef ptrdiff_t difference_type; - typedef _Tp* pointer; - typedef const _Tp* const_pointer; - typedef _Tp& reference; - typedef const _Tp& const_reference; - typedef _Tp value_type; - - template <class _NewType> struct rebind { - typedef pthread_allocator<_NewType> other; - }; - - pthread_allocator() throw() {} - pthread_allocator(const pthread_allocator& a) throw() {} - template <class _OtherType> - pthread_allocator(const pthread_allocator<_OtherType>&) - throw() {} - ~pthread_allocator() throw() {} - - pointer address(reference __x) const { return &__x; } - const_pointer address(const_reference __x) const { return &__x; } - - // __n is permitted to be 0. The C++ standard says nothing about what - // the return value is when __n == 0. - _Tp* allocate(size_type __n, const void* = 0) { - return __n != 0 ? static_cast<_Tp*>(_S_Alloc::allocate(__n * sizeof(_Tp))) - : 0; - } - - // p is not permitted to be a null pointer. - void deallocate(pointer __p, size_type __n) - { _S_Alloc::deallocate(__p, __n * sizeof(_Tp)); } - - size_type max_size() const throw() - { return size_t(-1) / sizeof(_Tp); } - - void construct(pointer __p, const _Tp& __val) { new(__p) _Tp(__val); } - void destroy(pointer _p) { _p->~_Tp(); } -}; - -template<> -class pthread_allocator<void> { -public: - typedef size_t size_type; - typedef ptrdiff_t difference_type; - typedef void* pointer; - typedef const void* const_pointer; - typedef void value_type; - - template <class _NewType> struct rebind { - typedef pthread_allocator<_NewType> other; - }; -}; - -template <size_t _Max_size> -inline bool operator==(const _Pthread_alloc_template<_Max_size>&, - const _Pthread_alloc_template<_Max_size>&) -{ - return true; -} - -template <class _T1, class _T2> -inline bool operator==(const pthread_allocator<_T1>&, - const pthread_allocator<_T2>& a2) -{ - return true; -} - -template <class _T1, class _T2> -inline bool operator!=(const pthread_allocator<_T1>&, - const pthread_allocator<_T2>&) -{ - return false; -} - -template <class _Tp, size_t _Max_size> -struct _Alloc_traits<_Tp, _Pthread_alloc_template<_Max_size> > -{ - static const bool _S_instanceless = true; - typedef simple_alloc<_Tp, _Pthread_alloc_template<_Max_size> > _Alloc_type; - typedef __allocator<_Tp, _Pthread_alloc_template<_Max_size> > - allocator_type; -}; - -template <class _Tp, class _Atype, size_t _Max> -struct _Alloc_traits<_Tp, __allocator<_Atype, _Pthread_alloc_template<_Max> > > -{ - static const bool _S_instanceless = true; - typedef simple_alloc<_Tp, _Pthread_alloc_template<_Max> > _Alloc_type; - typedef __allocator<_Tp, _Pthread_alloc_template<_Max> > allocator_type; -}; - -template <class _Tp, class _Atype> -struct _Alloc_traits<_Tp, pthread_allocator<_Atype> > -{ - static const bool _S_instanceless = true; - typedef simple_alloc<_Tp, _Pthread_alloc_template<> > _Alloc_type; - typedef pthread_allocator<_Tp> allocator_type; -}; - - -} // namespace std - -#endif /* _CPP_BITS_PTHREAD_ALLOCIMPL_H */ - -// Local Variables: -// mode:C++ -// End: diff --git a/contrib/libstdc++/include/bits/stl_alloc.h b/contrib/libstdc++/include/bits/stl_alloc.h deleted file mode 100644 index 9677c3e..0000000 --- a/contrib/libstdc++/include/bits/stl_alloc.h +++ /dev/null @@ -1,974 +0,0 @@ -// Allocators -*- C++ -*- - -// Copyright (C) 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. - -/* - * Copyright (c) 1996-1997 - * Silicon Graphics Computer Systems, Inc. - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Silicon Graphics makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - */ - -/** @file stl_alloc.h - * This is an internal header file, included by other library headers. - * You should not attempt to use it directly. - */ - -#ifndef __GLIBCPP_INTERNAL_ALLOC_H -#define __GLIBCPP_INTERNAL_ALLOC_H - -/** - * @defgroup Allocators Memory Allocators - * @if maint - * stl_alloc.h implements some node allocators. These are NOT the same as - * allocators in the C++ standard, nor in the original H-P STL. They do not - * encapsulate different pointer types; we assume that there is only one - * pointer type. The C++ standard allocators are intended to allocate - * individual objects, not pools or arenas. - * - * In this file allocators are of two different styles: "standard" and - * "SGI" (quotes included). "Standard" allocators conform to 20.4. "SGI" - * allocators differ in AT LEAST the following ways (add to this list as you - * discover them): - * - * - "Standard" allocate() takes two parameters (n_count,hint=0) but "SGI" - * allocate() takes one paramter (n_size). - * - Likewise, "standard" deallocate()'s argument is a count, but in "SGI" - * is a byte size. - * - max_size(), construct(), and destroy() are missing in "SGI" allocators. - * - reallocate(p,oldsz,newsz) is added in "SGI", and behaves as - * if p=realloc(p,newsz). - * - * "SGI" allocators may be wrapped in __allocator to convert the interface - * into a "standard" one. - * @endif - * - * @note The @c reallocate member functions have been deprecated for 3.2 - * and will be removed in 3.4. You must define @c _GLIBCPP_DEPRECATED - * to make this visible in 3.2; see c++config.h. - * - * The canonical description of these classes is in docs/html/ext/howto.html - * or online at http://gcc.gnu.org/onlinedocs/libstdc++/ext/howto.html#3 -*/ - -#include <cstddef> -#include <cstdlib> -#include <cstring> -#include <bits/functexcept.h> // For __throw_bad_alloc -#include <bits/stl_threads.h> - -#include <bits/atomicity.h> - -namespace std -{ - /** - * @if maint - * A new-based allocator, as required by the standard. Allocation and - * deallocation forward to global new and delete. "SGI" style, minus - * reallocate(). - * @endif - * (See @link Allocators allocators info @endlink for more.) - */ - class __new_alloc - { - public: - static void* - allocate(size_t __n) - { return ::operator new(__n); } - - static void - deallocate(void* __p, size_t) - { ::operator delete(__p); } - }; - - - /** - * @if maint - * A malloc-based allocator. Typically slower than the - * __default_alloc_template (below). Typically thread-safe and more - * storage efficient. The template argument is unused and is only present - * to permit multiple instantiations (but see __default_alloc_template - * for caveats). "SGI" style, plus __set_malloc_handler for OOM conditions. - * @endif - * (See @link Allocators allocators info @endlink for more.) - */ - template<int __inst> - class __malloc_alloc_template - { - private: - static void* _S_oom_malloc(size_t); - static void* _S_oom_realloc(void*, size_t); - static void (* __malloc_alloc_oom_handler)(); - - public: - static void* - allocate(size_t __n) - { - void* __result = malloc(__n); - if (__builtin_expect(__result == 0, 0)) - __result = _S_oom_malloc(__n); - return __result; - } - - static void - deallocate(void* __p, size_t /* __n */) - { free(__p); } - - static void* - reallocate(void* __p, size_t /* old_sz */, size_t __new_sz) - { - void* __result = realloc(__p, __new_sz); - if (__builtin_expect(__result == 0, 0)) - __result = _S_oom_realloc(__p, __new_sz); - return __result; - } - - static void (* __set_malloc_handler(void (*__f)()))() - { - void (* __old)() = __malloc_alloc_oom_handler; - __malloc_alloc_oom_handler = __f; - return __old; - } - }; - - // malloc_alloc out-of-memory handling - template<int __inst> - void (* __malloc_alloc_template<__inst>::__malloc_alloc_oom_handler)() = 0; - - template<int __inst> - void* - __malloc_alloc_template<__inst>:: - _S_oom_malloc(size_t __n) - { - void (* __my_malloc_handler)(); - void* __result; - - for (;;) - { - __my_malloc_handler = __malloc_alloc_oom_handler; - if (__builtin_expect(__my_malloc_handler == 0, 0)) - __throw_bad_alloc(); - (*__my_malloc_handler)(); - __result = malloc(__n); - if (__result) - return __result; - } - } - - template<int __inst> - void* - __malloc_alloc_template<__inst>:: - _S_oom_realloc(void* __p, size_t __n) - { - void (* __my_malloc_handler)(); - void* __result; - - for (;;) - { - __my_malloc_handler = __malloc_alloc_oom_handler; - if (__builtin_expect(__my_malloc_handler == 0, 0)) - __throw_bad_alloc(); - (*__my_malloc_handler)(); - __result = realloc(__p, __n); - if (__result) - return __result; - } - } - - // Should not be referenced within the library anymore. - typedef __new_alloc __mem_interface; - - /** - * @if maint - * This is used primarily (only?) in _Alloc_traits and other places to - * help provide the _Alloc_type typedef. All it does is forward the - * requests after some minimal checking. - * - * This is neither "standard"-conforming nor "SGI". The _Alloc parameter - * must be "SGI" style. - * @endif - * (See @link Allocators allocators info @endlink for more.) - */ - template<typename _Tp, typename _Alloc> - class __simple_alloc - { - public: - static _Tp* - allocate(size_t __n) - { - _Tp* __ret = 0; - if (__n) - __ret = static_cast<_Tp*>(_Alloc::allocate(__n * sizeof(_Tp))); - return __ret; - } - - static _Tp* - allocate() - { return (_Tp*) _Alloc::allocate(sizeof (_Tp)); } - - static void - deallocate(_Tp* __p, size_t __n) - { if (0 != __n) _Alloc::deallocate(__p, __n * sizeof (_Tp)); } - - static void - deallocate(_Tp* __p) - { _Alloc::deallocate(__p, sizeof (_Tp)); } - }; - - - /** - * @if maint - * An adaptor for an underlying allocator (_Alloc) to check the size - * arguments for debugging. - * - * "There is some evidence that this can confuse Purify." - SGI comment - * - * This adaptor is "SGI" style. The _Alloc parameter must also be "SGI". - * @endif - * (See @link Allocators allocators info @endlink for more.) - */ - template<typename _Alloc> - class __debug_alloc - { - private: - // Size of space used to store size. Note that this must be - // large enough to preserve alignment. - enum {_S_extra = 8}; - - public: - static void* - allocate(size_t __n) - { - char* __result = (char*)_Alloc::allocate(__n + (int) _S_extra); - *(size_t*)__result = __n; - return __result + (int) _S_extra; - } - - static void - deallocate(void* __p, size_t __n) - { - char* __real_p = (char*)__p - (int) _S_extra; - if (*(size_t*)__real_p != __n) - abort(); - _Alloc::deallocate(__real_p, __n + (int) _S_extra); - } - - static void* - reallocate(void* __p, size_t __old_sz, size_t __new_sz) - { - char* __real_p = (char*)__p - (int) _S_extra; - if (*(size_t*)__real_p != __old_sz) - abort(); - char* __result = (char*) _Alloc::reallocate(__real_p, - __old_sz + (int) _S_extra, - __new_sz + (int) _S_extra); - *(size_t*)__result = __new_sz; - return __result + (int) _S_extra; - } - }; - - - /** - * @if maint - * Default node allocator. "SGI" style. Uses various allocators to - * fulfill underlying requests (and makes as few requests as possible - * when in default high-speed pool mode). - * - * Important implementation properties: - * 0. If globally mandated, then allocate objects from __new_alloc - * 1. If the clients request an object of size > _MAX_BYTES, the resulting - * object will be obtained directly from __new_alloc - * 2. In all other cases, we allocate an object of size exactly - * _S_round_up(requested_size). Thus the client has enough size - * information that we can return the object to the proper free list - * without permanently losing part of the object. - * - * The first template parameter specifies whether more than one thread may - * use this allocator. It is safe to allocate an object from one instance - * of a default_alloc and deallocate it with another one. This effectively - * transfers its ownership to the second one. This may have undesirable - * effects on reference locality. - * - * The second parameter is unused and serves only to allow the creation of - * multiple default_alloc instances. Note that containers built on different - * allocator instances have different types, limiting the utility of this - * approach. If you do not wish to share the free lists with the main - * default_alloc instance, instantiate this with a non-zero __inst. - * - * @endif - * (See @link Allocators allocators info @endlink for more.) - */ - template<bool __threads, int __inst> - class __default_alloc_template - { - private: - enum {_ALIGN = 8}; - enum {_MAX_BYTES = 128}; - enum {_NFREELISTS = _MAX_BYTES / _ALIGN}; - - union _Obj - { - union _Obj* _M_free_list_link; - char _M_client_data[1]; // The client sees this. - }; - - static _Obj* volatile _S_free_list[_NFREELISTS]; - - // Chunk allocation state. - static char* _S_start_free; - static char* _S_end_free; - static size_t _S_heap_size; - - static _STL_mutex_lock _S_node_allocator_lock; - - static size_t - _S_round_up(size_t __bytes) - { return (((__bytes) + (size_t) _ALIGN-1) & ~((size_t) _ALIGN - 1)); } - - static size_t - _S_freelist_index(size_t __bytes) - { return (((__bytes) + (size_t)_ALIGN - 1)/(size_t)_ALIGN - 1); } - - // Returns an object of size __n, and optionally adds to size __n - // free list. - static void* - _S_refill(size_t __n); - - // Allocates a chunk for nobjs of size size. nobjs may be reduced - // if it is inconvenient to allocate the requested number. - static char* - _S_chunk_alloc(size_t __size, int& __nobjs); - - // It would be nice to use _STL_auto_lock here. But we need a - // test whether threads are in use. - struct _Lock - { - _Lock() { if (__threads) _S_node_allocator_lock._M_acquire_lock(); } - ~_Lock() { if (__threads) _S_node_allocator_lock._M_release_lock(); } - } __attribute__ ((__unused__)); - friend struct _Lock; - - static _Atomic_word _S_force_new; - - public: - // __n must be > 0 - static void* - allocate(size_t __n) - { - void* __ret = 0; - - // If there is a race through here, assume answer from getenv - // will resolve in same direction. Inspired by techniques - // to efficiently support threading found in basic_string.h. - if (_S_force_new == 0) - { - if (getenv("GLIBCPP_FORCE_NEW")) - __atomic_add(&_S_force_new, 1); - else - __atomic_add(&_S_force_new, -1); - } - - if ((__n > (size_t) _MAX_BYTES) || (_S_force_new > 0)) - __ret = __new_alloc::allocate(__n); - else - { - _Obj* volatile* __my_free_list = _S_free_list - + _S_freelist_index(__n); - // Acquire the lock here with a constructor call. This - // ensures that it is released in exit or during stack - // unwinding. - _Lock __lock_instance; - _Obj* __restrict__ __result = *__my_free_list; - if (__builtin_expect(__result == 0, 0)) - __ret = _S_refill(_S_round_up(__n)); - else - { - *__my_free_list = __result -> _M_free_list_link; - __ret = __result; - } - if (__builtin_expect(__ret == 0, 0)) - __throw_bad_alloc(); - } - return __ret; - } - - // __p may not be 0 - static void - deallocate(void* __p, size_t __n) - { - if ((__n > (size_t) _MAX_BYTES) || (_S_force_new > 0)) - __new_alloc::deallocate(__p, __n); - else - { - _Obj* volatile* __my_free_list = _S_free_list - + _S_freelist_index(__n); - _Obj* __q = (_Obj*)__p; - - // Acquire the lock here with a constructor call. This - // ensures that it is released in exit or during stack - // unwinding. - _Lock __lock_instance; - __q -> _M_free_list_link = *__my_free_list; - *__my_free_list = __q; - } - } - - static void* - reallocate(void* __p, size_t __old_sz, size_t __new_sz); - }; - - template<bool __threads, int __inst> _Atomic_word - __default_alloc_template<__threads, __inst>::_S_force_new = 0; - - template<bool __threads, int __inst> - inline bool - operator==(const __default_alloc_template<__threads,__inst>&, - const __default_alloc_template<__threads,__inst>&) - { return true; } - - template<bool __threads, int __inst> - inline bool - operator!=(const __default_alloc_template<__threads,__inst>&, - const __default_alloc_template<__threads,__inst>&) - { return false; } - - - // We allocate memory in large chunks in order to avoid fragmenting the - // heap too much. We assume that __size is properly aligned. We hold - // the allocation lock. - template<bool __threads, int __inst> - char* - __default_alloc_template<__threads, __inst>:: - _S_chunk_alloc(size_t __size, int& __nobjs) - { - char* __result; - size_t __total_bytes = __size * __nobjs; - size_t __bytes_left = _S_end_free - _S_start_free; - - if (__bytes_left >= __total_bytes) - { - __result = _S_start_free; - _S_start_free += __total_bytes; - return __result ; - } - else if (__bytes_left >= __size) - { - __nobjs = (int)(__bytes_left/__size); - __total_bytes = __size * __nobjs; - __result = _S_start_free; - _S_start_free += __total_bytes; - return __result; - } - else - { - size_t __bytes_to_get = - 2 * __total_bytes + _S_round_up(_S_heap_size >> 4); - // Try to make use of the left-over piece. - if (__bytes_left > 0) - { - _Obj* volatile* __my_free_list = - _S_free_list + _S_freelist_index(__bytes_left); - - ((_Obj*)(void*)_S_start_free) -> _M_free_list_link = *__my_free_list; - *__my_free_list = (_Obj*)(void*)_S_start_free; - } - _S_start_free = (char*) __new_alloc::allocate(__bytes_to_get); - if (_S_start_free == 0) - { - size_t __i; - _Obj* volatile* __my_free_list; - _Obj* __p; - // Try to make do with what we have. That can't hurt. We - // do not try smaller requests, since that tends to result - // in disaster on multi-process machines. - __i = __size; - for (; __i <= (size_t) _MAX_BYTES; __i += (size_t) _ALIGN) - { - __my_free_list = _S_free_list + _S_freelist_index(__i); - __p = *__my_free_list; - if (__p != 0) - { - *__my_free_list = __p -> _M_free_list_link; - _S_start_free = (char*)__p; - _S_end_free = _S_start_free + __i; - return _S_chunk_alloc(__size, __nobjs); - // Any leftover piece will eventually make it to the - // right free list. - } - } - _S_end_free = 0; // In case of exception. - _S_start_free = (char*)__new_alloc::allocate(__bytes_to_get); - // This should either throw an exception or remedy the situation. - // Thus we assume it succeeded. - } - _S_heap_size += __bytes_to_get; - _S_end_free = _S_start_free + __bytes_to_get; - return _S_chunk_alloc(__size, __nobjs); - } - } - - - // Returns an object of size __n, and optionally adds to "size - // __n"'s free list. We assume that __n is properly aligned. We - // hold the allocation lock. - template<bool __threads, int __inst> - void* - __default_alloc_template<__threads, __inst>::_S_refill(size_t __n) - { - int __nobjs = 20; - char* __chunk = _S_chunk_alloc(__n, __nobjs); - _Obj* volatile* __my_free_list; - _Obj* __result; - _Obj* __current_obj; - _Obj* __next_obj; - int __i; - - if (1 == __nobjs) - return __chunk; - __my_free_list = _S_free_list + _S_freelist_index(__n); - - // Build free list in chunk. - __result = (_Obj*)(void*)__chunk; - *__my_free_list = __next_obj = (_Obj*)(void*)(__chunk + __n); - for (__i = 1; ; __i++) - { - __current_obj = __next_obj; - __next_obj = (_Obj*)(void*)((char*)__next_obj + __n); - if (__nobjs - 1 == __i) - { - __current_obj -> _M_free_list_link = 0; - break; - } - else - __current_obj -> _M_free_list_link = __next_obj; - } - return __result; - } - - - template<bool threads, int inst> - void* - __default_alloc_template<threads, inst>:: - reallocate(void* __p, size_t __old_sz, size_t __new_sz) - { - void* __result; - size_t __copy_sz; - - if (__old_sz > (size_t) _MAX_BYTES && __new_sz > (size_t) _MAX_BYTES) - return(realloc(__p, __new_sz)); - if (_S_round_up(__old_sz) == _S_round_up(__new_sz)) - return(__p); - __result = allocate(__new_sz); - __copy_sz = __new_sz > __old_sz? __old_sz : __new_sz; - memcpy(__result, __p, __copy_sz); - deallocate(__p, __old_sz); - return __result; - } - - template<bool __threads, int __inst> - _STL_mutex_lock - __default_alloc_template<__threads,__inst>::_S_node_allocator_lock - __STL_MUTEX_INITIALIZER; - - template<bool __threads, int __inst> - char* __default_alloc_template<__threads,__inst>::_S_start_free = 0; - - template<bool __threads, int __inst> - char* __default_alloc_template<__threads,__inst>::_S_end_free = 0; - - template<bool __threads, int __inst> - size_t __default_alloc_template<__threads,__inst>::_S_heap_size = 0; - - template<bool __threads, int __inst> - typename __default_alloc_template<__threads,__inst>::_Obj* volatile - __default_alloc_template<__threads,__inst>::_S_free_list[_NFREELISTS]; - - typedef __default_alloc_template<true,0> __alloc; - typedef __default_alloc_template<false,0> __single_client_alloc; - - - /** - * @brief The "standard" allocator, as per [20.4]. - * - * The private _Alloc is "SGI" style. (See comments at the top - * of stl_alloc.h.) - * - * The underlying allocator behaves as follows. - * - __default_alloc_template is used via two typedefs - * - "__single_client_alloc" typedef does no locking for threads - * - "__alloc" typedef is threadsafe via the locks - * - __new_alloc is used for memory requests - * - * (See @link Allocators allocators info @endlink for more.) - */ - template<typename _Tp> - class allocator - { - typedef __alloc _Alloc; // The underlying allocator. - public: - typedef size_t size_type; - typedef ptrdiff_t difference_type; - typedef _Tp* pointer; - typedef const _Tp* const_pointer; - typedef _Tp& reference; - typedef const _Tp& const_reference; - typedef _Tp value_type; - - template<typename _Tp1> - struct rebind - { typedef allocator<_Tp1> other; }; - - allocator() throw() {} - allocator(const allocator&) throw() {} - template<typename _Tp1> - allocator(const allocator<_Tp1>&) throw() {} - ~allocator() throw() {} - - pointer - address(reference __x) const { return &__x; } - - const_pointer - address(const_reference __x) const { return &__x; } - - // NB: __n is permitted to be 0. The C++ standard says nothing - // about what the return value is when __n == 0. - _Tp* - allocate(size_type __n, const void* = 0) - { - _Tp* __ret = 0; - if (__n) - { - if (__n <= this->max_size()) - __ret = static_cast<_Tp*>(_Alloc::allocate(__n * sizeof(_Tp))); - else - __throw_bad_alloc(); - } - return __ret; - } - - // __p is not permitted to be a null pointer. - void - deallocate(pointer __p, size_type __n) - { _Alloc::deallocate(__p, __n * sizeof(_Tp)); } - - size_type - max_size() const throw() { return size_t(-1) / sizeof(_Tp); } - - void construct(pointer __p, const _Tp& __val) { new(__p) _Tp(__val); } - void destroy(pointer __p) { __p->~_Tp(); } - }; - - template<> - class allocator<void> - { - public: - typedef size_t size_type; - typedef ptrdiff_t difference_type; - typedef void* pointer; - typedef const void* const_pointer; - typedef void value_type; - - template<typename _Tp1> - struct rebind - { typedef allocator<_Tp1> other; }; - }; - - - template<typename _T1, typename _T2> - inline bool - operator==(const allocator<_T1>&, const allocator<_T2>&) - { return true; } - - template<typename _T1, typename _T2> - inline bool - operator!=(const allocator<_T1>&, const allocator<_T2>&) - { return false; } - - - /** - * @if maint - * Allocator adaptor to turn an "SGI" style allocator (e.g., - * __alloc, __malloc_alloc_template) into a "standard" conforming - * allocator. Note that this adaptor does *not* assume that all - * objects of the underlying alloc class are identical, nor does it - * assume that all of the underlying alloc's member functions are - * static member functions. Note, also, that __allocator<_Tp, - * __alloc> is essentially the same thing as allocator<_Tp>. - * @endif - * (See @link Allocators allocators info @endlink for more.) - */ - template<typename _Tp, typename _Alloc> - struct __allocator - { - _Alloc __underlying_alloc; - - typedef size_t size_type; - typedef ptrdiff_t difference_type; - typedef _Tp* pointer; - typedef const _Tp* const_pointer; - typedef _Tp& reference; - typedef const _Tp& const_reference; - typedef _Tp value_type; - - template<typename _Tp1> - struct rebind - { typedef __allocator<_Tp1, _Alloc> other; }; - - __allocator() throw() {} - __allocator(const __allocator& __a) throw() - : __underlying_alloc(__a.__underlying_alloc) {} - - template<typename _Tp1> - __allocator(const __allocator<_Tp1, _Alloc>& __a) throw() - : __underlying_alloc(__a.__underlying_alloc) {} - - ~__allocator() throw() {} - - pointer - address(reference __x) const { return &__x; } - - const_pointer - address(const_reference __x) const { return &__x; } - - // NB: __n is permitted to be 0. The C++ standard says nothing - // about what the return value is when __n == 0. - _Tp* - allocate(size_type __n, const void* = 0) - { - _Tp* __ret = 0; - if (__n) - __ret = static_cast<_Tp*>(_Alloc::allocate(__n * sizeof(_Tp))); - return __ret; - } - - // __p is not permitted to be a null pointer. - void - deallocate(pointer __p, size_type __n) - { __underlying_alloc.deallocate(__p, __n * sizeof(_Tp)); } - - size_type - max_size() const throw() { return size_t(-1) / sizeof(_Tp); } - - void - construct(pointer __p, const _Tp& __val) { new(__p) _Tp(__val); } - - void - destroy(pointer __p) { __p->~_Tp(); } - }; - - template<typename _Alloc> - struct __allocator<void, _Alloc> - { - typedef size_t size_type; - typedef ptrdiff_t difference_type; - typedef void* pointer; - typedef const void* const_pointer; - typedef void value_type; - - template<typename _Tp1> - struct rebind - { typedef __allocator<_Tp1, _Alloc> other; }; - }; - - template<typename _Tp, typename _Alloc> - inline bool - operator==(const __allocator<_Tp,_Alloc>& __a1, - const __allocator<_Tp,_Alloc>& __a2) - { return __a1.__underlying_alloc == __a2.__underlying_alloc; } - - template<typename _Tp, typename _Alloc> - inline bool - operator!=(const __allocator<_Tp, _Alloc>& __a1, - const __allocator<_Tp, _Alloc>& __a2) - { return __a1.__underlying_alloc != __a2.__underlying_alloc; } - - - //@{ - /** Comparison operators for all of the predifined SGI-style allocators. - * This ensures that __allocator<malloc_alloc> (for example) will work - * correctly. As required, all allocators compare equal. - */ - template<int inst> - inline bool - operator==(const __malloc_alloc_template<inst>&, - const __malloc_alloc_template<inst>&) - { return true; } - - template<int __inst> - inline bool - operator!=(const __malloc_alloc_template<__inst>&, - const __malloc_alloc_template<__inst>&) - { return false; } - - template<typename _Alloc> - inline bool - operator==(const __debug_alloc<_Alloc>&, const __debug_alloc<_Alloc>&) - { return true; } - - template<typename _Alloc> - inline bool - operator!=(const __debug_alloc<_Alloc>&, const __debug_alloc<_Alloc>&) - { return false; } - //@} - - - /** - * @if maint - * Another allocator adaptor: _Alloc_traits. This serves two purposes. - * First, make it possible to write containers that can use either "SGI" - * style allocators or "standard" allocators. Second, provide a mechanism - * so that containers can query whether or not the allocator has distinct - * instances. If not, the container can avoid wasting a word of memory to - * store an empty object. For examples of use, see stl_vector.h, etc, or - * any of the other classes derived from this one. - * - * This adaptor uses partial specialization. The general case of - * _Alloc_traits<_Tp, _Alloc> assumes that _Alloc is a - * standard-conforming allocator, possibly with non-equal instances and - * non-static members. (It still behaves correctly even if _Alloc has - * static member and if all instances are equal. Refinements affect - * performance, not correctness.) - * - * There are always two members: allocator_type, which is a standard- - * conforming allocator type for allocating objects of type _Tp, and - * _S_instanceless, a static const member of type bool. If - * _S_instanceless is true, this means that there is no difference - * between any two instances of type allocator_type. Furthermore, if - * _S_instanceless is true, then _Alloc_traits has one additional - * member: _Alloc_type. This type encapsulates allocation and - * deallocation of objects of type _Tp through a static interface; it - * has two member functions, whose signatures are - * - * - static _Tp* allocate(size_t) - * - static void deallocate(_Tp*, size_t) - * - * The size_t parameters are "standard" style (see top of stl_alloc.h) in - * that they take counts, not sizes. - * - * @endif - * (See @link Allocators allocators info @endlink for more.) - */ - //@{ - // The fully general version. - template<typename _Tp, typename _Allocator> - struct _Alloc_traits - { - static const bool _S_instanceless = false; - typedef typename _Allocator::template rebind<_Tp>::other allocator_type; - }; - - template<typename _Tp, typename _Allocator> - const bool _Alloc_traits<_Tp, _Allocator>::_S_instanceless; - - /// The version for the default allocator. - template<typename _Tp, typename _Tp1> - struct _Alloc_traits<_Tp, allocator<_Tp1> > - { - static const bool _S_instanceless = true; - typedef __simple_alloc<_Tp, __alloc> _Alloc_type; - typedef allocator<_Tp> allocator_type; - }; - //@} - - //@{ - /// Versions for the predefined "SGI" style allocators. - template<typename _Tp, int __inst> - struct _Alloc_traits<_Tp, __malloc_alloc_template<__inst> > - { - static const bool _S_instanceless = true; - typedef __simple_alloc<_Tp, __malloc_alloc_template<__inst> > _Alloc_type; - typedef __allocator<_Tp, __malloc_alloc_template<__inst> > allocator_type; - }; - - template<typename _Tp, bool __threads, int __inst> - struct _Alloc_traits<_Tp, __default_alloc_template<__threads, __inst> > - { - static const bool _S_instanceless = true; - typedef __simple_alloc<_Tp, __default_alloc_template<__threads, __inst> > - _Alloc_type; - typedef __allocator<_Tp, __default_alloc_template<__threads, __inst> > - allocator_type; - }; - - template<typename _Tp, typename _Alloc> - struct _Alloc_traits<_Tp, __debug_alloc<_Alloc> > - { - static const bool _S_instanceless = true; - typedef __simple_alloc<_Tp, __debug_alloc<_Alloc> > _Alloc_type; - typedef __allocator<_Tp, __debug_alloc<_Alloc> > allocator_type; - }; - //@} - - //@{ - /// Versions for the __allocator adaptor used with the predefined - /// "SGI" style allocators. - template<typename _Tp, typename _Tp1, int __inst> - struct _Alloc_traits<_Tp, - __allocator<_Tp1, __malloc_alloc_template<__inst> > > - { - static const bool _S_instanceless = true; - typedef __simple_alloc<_Tp, __malloc_alloc_template<__inst> > _Alloc_type; - typedef __allocator<_Tp, __malloc_alloc_template<__inst> > allocator_type; - }; - - template<typename _Tp, typename _Tp1, bool __thr, int __inst> - struct _Alloc_traits<_Tp, __allocator<_Tp1, __default_alloc_template<__thr, __inst> > > - { - static const bool _S_instanceless = true; - typedef __simple_alloc<_Tp, __default_alloc_template<__thr,__inst> > - _Alloc_type; - typedef __allocator<_Tp, __default_alloc_template<__thr,__inst> > - allocator_type; - }; - - template<typename _Tp, typename _Tp1, typename _Alloc> - struct _Alloc_traits<_Tp, __allocator<_Tp1, __debug_alloc<_Alloc> > > - { - static const bool _S_instanceless = true; - typedef __simple_alloc<_Tp, __debug_alloc<_Alloc> > _Alloc_type; - typedef __allocator<_Tp, __debug_alloc<_Alloc> > allocator_type; - }; - //@} - - // Inhibit implicit instantiations for required instantiations, - // which are defined via explicit instantiations elsewhere. - // NB: This syntax is a GNU extension. -#if _GLIBCPP_EXTERN_TEMPLATE - extern template class allocator<char>; - extern template class allocator<wchar_t>; - extern template class __default_alloc_template<true,0>; -#endif -} // namespace std - -#endif diff --git a/contrib/libstdc++/include/bits/stl_pthread_alloc.h b/contrib/libstdc++/include/bits/stl_pthread_alloc.h deleted file mode 100644 index 09b7d72..0000000 --- a/contrib/libstdc++/include/bits/stl_pthread_alloc.h +++ /dev/null @@ -1,60 +0,0 @@ -// Wrapper of pthread allocation header -*- C++ -*- - -// Copyright (C) 2001 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. - -/* - * Copyright (c) 1996-1997 - * Silicon Graphics Computer Systems, Inc. - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Silicon Graphics makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - */ - -/** @file stl_pthread_alloc.h - * This is an internal header file, included by other library headers. - * You should not attempt to use it directly. - */ - -#ifndef _CPP_BITS_STL_PTHREAD_ALLOC_H -#define _CPP_BITS_STL_PTHREAD_ALLOC_H 1 - -#include <bits/pthread_allocimpl.h> - -using std::_Pthread_alloc_template; -using std::pthread_alloc; - -#endif /* _CPP_BITS_STL_PTHREAD_ALLOC_H */ - -// Local Variables: -// mode:C++ -// End: diff --git a/contrib/libstdc++/include/bits/valarray_meta.h b/contrib/libstdc++/include/bits/valarray_meta.h deleted file mode 100644 index 29a2dac..0000000 --- a/contrib/libstdc++/include/bits/valarray_meta.h +++ /dev/null @@ -1,1147 +0,0 @@ -// The template and inlines for the -*- C++ -*- internal _Meta class. - -// Copyright (C) 1997, 1998, 1999, 2000, 2001 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_META_H -#define _CPP_VALARRAY_META_H 1 - -#pragma GCC system_header - -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 _Oper()(_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. - // - template<class _Dom> class _GBase { - public: - typedef typename _Dom::value_type value_type; - - _GBase (const _Dom& __e, const valarray<size_t>& __i) - : _M_expr (__e), _M_index(__i) {} - value_type operator[] (size_t __i) const - { return _M_expr[_M_index[__i]]; } - size_t size () const { return _M_index.size(); } - - private: - const _Dom& _M_expr; - const valarray<size_t>& _M_index; - }; - - template<typename _Tp> class _GBase<_Array<_Tp> > { - public: - typedef _Tp value_type; - - _GBase (_Array<_Tp> __a, const valarray<size_t>& __i) - : _M_array (__a), _M_index(__i) {} - value_type operator[] (size_t __i) const - { return _M_array._M_data[_M_index[__i]]; } - size_t size () const { return _M_index.size(); } - - private: - const _Array<_Tp> _M_array; - const valarray<size_t>& _M_index; - }; - - template<class _Dom> struct _GClos<_Expr,_Dom> : _GBase<_Dom> { - typedef _GBase<_Dom> _Base; - typedef typename _Base::value_type value_type; - - _GClos (const _Dom& __e, const valarray<size_t>& __i) - : _Base (__e, __i) {} - }; - - template<typename _Tp> - struct _GClos<_ValArray,_Tp> : _GBase<_Array<_Tp> > { - typedef _GBase<_Array<_Tp> > _Base; - typedef typename _Base::value_type value_type; - - _GClos (_Array<_Tp> __a, const valarray<size_t>& __i) - : _Base (__a, __i) {} - }; - - // - // indirect_array closure - // - - template<class _Dom> class _IBase { - public: - typedef typename _Dom::value_type value_type; - - _IBase (const _Dom& __e, const valarray<size_t>& __i) - : _M_expr (__e), _M_index (__i) {} - value_type operator[] (size_t __i) const - { return _M_expr[_M_index[__i]]; } - size_t size() const { return _M_index.size(); } - - private: - const _Dom& _M_expr; - const valarray<size_t>& _M_index; - }; - - template<class _Dom> struct _IClos<_Expr,_Dom> : _IBase<_Dom> { - typedef _IBase<_Dom> _Base; - typedef typename _Base::value_type value_type; - - _IClos (const _Dom& __e, const valarray<size_t>& __i) - : _Base (__e, __i) {} - }; - - template<typename _Tp> - struct _IClos<_ValArray,_Tp> : _IBase<valarray<_Tp> > { - typedef _IBase<valarray<_Tp> > _Base; - typedef _Tp value_type; - - _IClos (const valarray<_Tp>& __a, const valarray<size_t>& __i) - : _Base (__a, __i) {} - }; - - // - // class _Expr - // - template<class _Clos, typename _Tp> - class _Expr - { - public: - typedef _Tp value_type; - - _Expr(const _Clos&); - - const _Clos& operator()() const; - - value_type operator[](size_t) const; - valarray<value_type> operator[](slice) const; - valarray<value_type> operator[](const gslice&) const; - valarray<value_type> operator[](const valarray<bool>&) const; - valarray<value_type> operator[](const valarray<size_t>&) const; - - _Expr<_UnClos<__unary_plus,std::_Expr,_Clos>, value_type> - operator+() const; - - _Expr<_UnClos<__negate,std::_Expr,_Clos>, value_type> - operator-() const; - - _Expr<_UnClos<__bitwise_not,std::_Expr,_Clos>, value_type> - operator~() const; - - _Expr<_UnClos<__logical_not,std::_Expr,_Clos>, bool> - operator!() const; - - size_t size() const; - value_type sum() const; - - valarray<value_type> shift(int) const; - valarray<value_type> cshift(int) const; - - value_type min() const; - value_type max() const; - - valarray<value_type> apply(value_type (*)(const value_type&)) const; - valarray<value_type> apply(value_type (*)(value_type)) const; - - private: - const _Clos _M_closure; - }; - - template<class _Clos, typename _Tp> - inline - _Expr<_Clos,_Tp>::_Expr(const _Clos& __c) : _M_closure(__c) {} - - template<class _Clos, typename _Tp> - inline const _Clos& - _Expr<_Clos,_Tp>::operator()() const - { return _M_closure; } - - template<class _Clos, typename _Tp> - inline _Tp - _Expr<_Clos,_Tp>::operator[](size_t __i) const - { return _M_closure[__i]; } - - template<class _Clos, typename _Tp> - inline valarray<_Tp> - _Expr<_Clos,_Tp>::operator[](slice __s) const - { return _M_closure[__s]; } - - template<class _Clos, typename _Tp> - inline valarray<_Tp> - _Expr<_Clos,_Tp>::operator[](const gslice& __gs) const - { return _M_closure[__gs]; } - - template<class _Clos, typename _Tp> - inline valarray<_Tp> - _Expr<_Clos,_Tp>::operator[](const valarray<bool>& __m) const - { return _M_closure[__m]; } - - template<class _Clos, typename _Tp> - inline valarray<_Tp> - _Expr<_Clos,_Tp>::operator[](const valarray<size_t>& __i) const - { return _M_closure[__i]; } - - template<class _Clos, typename _Tp> - inline size_t - _Expr<_Clos,_Tp>::size() const { return _M_closure.size (); } - - template<class _Clos, typename _Tp> - inline valarray<_Tp> - _Expr<_Clos, _Tp>::shift(int __n) const - { return valarray<_Tp>(_M_closure).shift(__n); } - - template<class _Clos, typename _Tp> - inline valarray<_Tp> - _Expr<_Clos, _Tp>::cshift(int __n) const - { return valarray<_Tp>(_M_closure).cshift(__n); } - - template<class _Clos, typename _Tp> - inline valarray<_Tp> - _Expr<_Clos, _Tp>::apply(_Tp __f(const _Tp&)) const - { return valarray<_Tp>(_M_closure).apply(__f); } - - template<class _Clos, typename _Tp> - inline valarray<_Tp> - _Expr<_Clos, _Tp>::apply(_Tp __f(_Tp)) const - { return valarray<_Tp>(_M_closure).apply(__f); } - - // XXX: replace this with a more robust summation algorithm. - template<class _Clos, typename _Tp> - inline _Tp - _Expr<_Clos,_Tp>::sum() const - { - size_t __n = _M_closure.size(); - if (__n == 0) - return _Tp(); - else - { - _Tp __s = _M_closure[--__n]; - while (__n != 0) - __s += _M_closure[--__n]; - return __s; - } - } - - template<class _Clos, typename _Tp> - inline _Tp - _Expr<_Clos, _Tp>::min() const - { return __valarray_min(_M_closure); } - - template<class _Clos, typename _Tp> - inline _Tp - _Expr<_Clos, _Tp>::max() const - { return __valarray_max(_M_closure); } - - template<class _Dom, typename _Tp> - inline _Expr<_UnClos<__logical_not,_Expr,_Dom>, bool> - _Expr<_Dom,_Tp>::operator!() const - { - typedef _UnClos<__logical_not,std::_Expr,_Dom> _Closure; - return _Expr<_Closure,_Tp>(_Closure(this->_M_closure)); - } - -#define _DEFINE_EXPR_UNARY_OPERATOR(_Op, _Name) \ - template<class _Dom, typename _Tp> \ - inline _Expr<_UnClos<_Name,std::_Expr,_Dom>,_Tp> \ - _Expr<_Dom,_Tp>::operator _Op() const \ - { \ - typedef _UnClos<_Name,std::_Expr,_Dom> _Closure; \ - return _Expr<_Closure,_Tp>(_Closure(this->_M_closure)); \ - } - - _DEFINE_EXPR_UNARY_OPERATOR(+, __unary_plus) - _DEFINE_EXPR_UNARY_OPERATOR(-, __negate) - _DEFINE_EXPR_UNARY_OPERATOR(~, __bitwise_not) - -#undef _DEFINE_EXPR_UNARY_OPERATOR - - -#define _DEFINE_EXPR_BINARY_OPERATOR(_Op, _Name) \ - template<class _Dom1, class _Dom2> \ - inline _Expr<_BinClos<_Name,_Expr,_Expr,_Dom1,_Dom2>, \ - typename __fun<_Name, typename _Dom1::value_type>::result_type>\ - operator _Op(const _Expr<_Dom1,typename _Dom1::value_type>& __v, \ - const _Expr<_Dom2,typename _Dom2::value_type>& __w) \ - { \ - typedef typename _Dom1::value_type _Arg; \ - typedef typename __fun<_Name, _Arg>::result_type _Value; \ - typedef _BinClos<_Name,_Expr,_Expr,_Dom1,_Dom2> _Closure; \ - return _Expr<_Closure,_Value>(_Closure(__v(), __w())); \ - } \ - \ -template<class _Dom> \ -inline _Expr<_BinClos<_Name,_Expr,_Constant,_Dom,typename _Dom::value_type>,\ - typename __fun<_Name, typename _Dom::value_type>::result_type>\ -operator _Op(const _Expr<_Dom,typename _Dom::value_type>& __v, \ - const typename _Dom::value_type& __t) \ -{ \ - typedef typename _Dom::value_type _Arg; \ - typedef typename __fun<_Name, _Arg>::result_type _Value; \ - typedef _BinClos<_Name,_Expr,_Constant,_Dom,_Arg> _Closure; \ - return _Expr<_Closure,_Value>(_Closure(__v(), __t)); \ -} \ - \ -template<class _Dom> \ -inline _Expr<_BinClos<_Name,_Constant,_Expr,typename _Dom::value_type,_Dom>,\ - typename __fun<_Name, typename _Dom::value_type>::result_type>\ -operator _Op(const typename _Dom::value_type& __t, \ - const _Expr<_Dom,typename _Dom::value_type>& __v) \ -{ \ - typedef typename _Dom::value_type _Arg; \ - typedef typename __fun<_Name, _Arg>::result_type _Value; \ - typedef _BinClos<_Name,_Constant,_Expr,_Arg,_Dom> _Closure; \ - return _Expr<_Closure,_Value>(_Closure(__t, __v())); \ -} \ - \ -template<class _Dom> \ -inline _Expr<_BinClos<_Name,_Expr,_ValArray,_Dom,typename _Dom::value_type>,\ - typename __fun<_Name, typename _Dom::value_type>::result_type>\ -operator _Op(const _Expr<_Dom,typename _Dom::value_type>& __e, \ - const valarray<typename _Dom::value_type>& __v) \ -{ \ - typedef typename _Dom::value_type _Arg; \ - typedef typename __fun<_Name, _Arg>::result_type _Value; \ - typedef _BinClos<_Name,_Expr,_ValArray,_Dom,_Arg> _Closure; \ - return _Expr<_Closure,_Value>(_Closure(__e(), __v)); \ -} \ - \ -template<class _Dom> \ -inline _Expr<_BinClos<_Name,_ValArray,_Expr,typename _Dom::value_type,_Dom>,\ - typename __fun<_Name, typename _Dom::value_type>::result_type>\ -operator _Op(const valarray<typename _Dom::value_type>& __v, \ - const _Expr<_Dom,typename _Dom::value_type>& __e) \ -{ \ - typedef typename _Dom::value_type _Tp; \ - typedef typename __fun<_Name, _Tp>::result_type _Value; \ - typedef _BinClos<_Name,_ValArray,_Expr,_Tp,_Dom> _Closure; \ - return _Expr<_Closure,_Value> (_Closure (__v, __e ())); \ -} - - _DEFINE_EXPR_BINARY_OPERATOR(+, __plus) - _DEFINE_EXPR_BINARY_OPERATOR(-, __minus) - _DEFINE_EXPR_BINARY_OPERATOR(*, __multiplies) - _DEFINE_EXPR_BINARY_OPERATOR(/, __divides) - _DEFINE_EXPR_BINARY_OPERATOR(%, __modulus) - _DEFINE_EXPR_BINARY_OPERATOR(^, __bitwise_xor) - _DEFINE_EXPR_BINARY_OPERATOR(&, __bitwise_and) - _DEFINE_EXPR_BINARY_OPERATOR(|, __bitwise_or) - _DEFINE_EXPR_BINARY_OPERATOR(<<, __shift_left) - _DEFINE_EXPR_BINARY_OPERATOR(>>, __shift_right) - _DEFINE_EXPR_BINARY_OPERATOR(&&, __logical_and) - _DEFINE_EXPR_BINARY_OPERATOR(||, __logical_or) - _DEFINE_EXPR_BINARY_OPERATOR(==, __equal_to) - _DEFINE_EXPR_BINARY_OPERATOR(!=, __not_equal_to) - _DEFINE_EXPR_BINARY_OPERATOR(<, __less) - _DEFINE_EXPR_BINARY_OPERATOR(>, __greater) - _DEFINE_EXPR_BINARY_OPERATOR(<=, __less_equal) - _DEFINE_EXPR_BINARY_OPERATOR(>=, __greater_equal) - -#undef _DEFINE_EXPR_BINARY_OPERATOR - -#define _DEFINE_EXPR_UNARY_FUNCTION(_Name) \ - template<class _Dom> \ - inline _Expr<_UnClos<__##_Name,_Expr,_Dom>,typename _Dom::value_type>\ - _Name(const _Expr<_Dom,typename _Dom::value_type>& __e) \ - { \ - typedef typename _Dom::value_type _Tp; \ - typedef _UnClos<__##_Name,_Expr,_Dom> _Closure; \ - return _Expr<_Closure,_Tp>(_Closure(__e())); \ - } \ - \ - template<typename _Tp> \ - inline _Expr<_UnClos<__##_Name,_ValArray,_Tp>,_Tp> \ - _Name(const valarray<_Tp>& __v) \ - { \ - typedef _UnClos<__##_Name,_ValArray,_Tp> _Closure; \ - return _Expr<_Closure,_Tp>(_Closure(__v)); \ - } - - _DEFINE_EXPR_UNARY_FUNCTION(abs) - _DEFINE_EXPR_UNARY_FUNCTION(cos) - _DEFINE_EXPR_UNARY_FUNCTION(acos) - _DEFINE_EXPR_UNARY_FUNCTION(cosh) - _DEFINE_EXPR_UNARY_FUNCTION(sin) - _DEFINE_EXPR_UNARY_FUNCTION(asin) - _DEFINE_EXPR_UNARY_FUNCTION(sinh) - _DEFINE_EXPR_UNARY_FUNCTION(tan) - _DEFINE_EXPR_UNARY_FUNCTION(tanh) - _DEFINE_EXPR_UNARY_FUNCTION(atan) - _DEFINE_EXPR_UNARY_FUNCTION(exp) - _DEFINE_EXPR_UNARY_FUNCTION(log) - _DEFINE_EXPR_UNARY_FUNCTION(log10) - _DEFINE_EXPR_UNARY_FUNCTION(sqrt) - -#undef _DEFINE_EXPR_UNARY_FUNCTION - -#define _DEFINE_EXPR_BINARY_FUNCTION(_Fun) \ - template<class _Dom1, class _Dom2> \ - inline _Expr<_BinClos<__##_Fun,_Expr,_Expr,_Dom1,_Dom2>, \ - typename _Dom1::value_type> \ - _Fun(const _Expr<_Dom1,typename _Dom1::value_type>& __e1, \ - const _Expr<_Dom2,typename _Dom2::value_type>& __e2) \ - { \ - typedef typename _Dom1::value_type _Tp; \ - typedef _BinClos<__##_Fun,_Expr,_Expr,_Dom1,_Dom2> _Closure; \ - return _Expr<_Closure,_Tp>(_Closure(__e1(), __e2())); \ - } \ - \ - template<class _Dom> \ - inline _Expr<_BinClos<__##_Fun, _Expr, _ValArray, _Dom, \ - typename _Dom::value_type>, \ - typename _Dom::value_type> \ - _Fun(const _Expr<_Dom,typename _Dom::value_type>& __e, \ - const valarray<typename _Dom::value_type>& __v) \ - { \ - typedef typename _Dom::value_type _Tp; \ - typedef _BinClos<__##_Fun, _Expr, _ValArray, _Dom, _Tp> _Closure;\ - return _Expr<_Closure,_Tp>(_Closure(__e(), __v)); \ - } \ - \ - template<class _Dom> \ - inline _Expr<_BinClos<__##_Fun, _ValArray, _Expr, \ - typename _Dom::value_type,_Dom>, \ - typename _Dom::value_type> \ - _Fun(const valarray<typename _Dom::valarray>& __v, \ - const _Expr<_Dom,typename _Dom::value_type>& __e) \ - { \ - typedef typename _Dom::value_type _Tp; \ - typedef _BinClos<__##_Fun,_ValArray,_Expr,_Tp,_Dom> _Closure; \ - return _Expr<_Closure,_Tp>(_Closure(__v, __e())); \ - } \ - \ - template<class _Dom> \ - inline _Expr<_BinClos<__##_Fun,_Expr,_Constant,_Dom, \ - typename _Dom::value_type>, \ - typename _Dom::value_type> \ - _Fun(const _Expr<_Dom, typename _Dom::value_type>& __e, \ - const typename _Dom::value_type& __t) \ - { \ - typedef typename _Dom::value_type _Tp; \ - typedef _BinClos<__##_Fun,_Expr,_Constant,_Dom,_Tp> _Closure; \ - return _Expr<_Closure,_Tp>(_Closure(__e(), __t)); \ - } \ - \ - template<class _Dom> \ - inline _Expr<_BinClos<__##_Fun,_Constant,_Expr, \ - typename _Dom::value_type,_Dom>, \ - typename _Dom::value_type> \ - _Fun(const typename _Dom::value_type& __t, \ - const _Expr<_Dom,typename _Dom::value_type>& __e) \ - { \ - typedef typename _Dom::value_type _Tp; \ - typedef _BinClos<__##_Fun, _Constant,_Expr,_Tp,_Dom> _Closure; \ - return _Expr<_Closure,_Tp>(_Closure(__t, __e())); \ - } \ - \ - template<typename _Tp> \ - inline _Expr<_BinClos<__##_Fun,_ValArray,_ValArray,_Tp,_Tp>, _Tp> \ - _Fun(const valarray<_Tp>& __v, const valarray<_Tp>& __w) \ - { \ - typedef _BinClos<__##_Fun,_ValArray,_ValArray,_Tp,_Tp> _Closure; \ - return _Expr<_Closure,_Tp>(_Closure(__v, __w)); \ - } \ - \ - template<typename _Tp> \ - inline _Expr<_BinClos<__##_Fun,_ValArray,_Constant,_Tp,_Tp>,_Tp> \ - _Fun(const valarray<_Tp>& __v, const _Tp& __t) \ - { \ - typedef _BinClos<__##_Fun,_ValArray,_Constant,_Tp,_Tp> _Closure; \ - return _Expr<_Closure,_Tp>(_Closure(__v, __t)); \ - } \ - \ - template<typename _Tp> \ - inline _Expr<_BinClos<__##_Fun,_Constant,_ValArray,_Tp,_Tp>,_Tp> \ - _Fun(const _Tp& __t, const valarray<_Tp>& __v) \ - { \ - typedef _BinClos<__##_Fun,_Constant,_ValArray,_Tp,_Tp> _Closure; \ - return _Expr<_Closure,_Tp>(_Closure(__t, __v)); \ - } - -_DEFINE_EXPR_BINARY_FUNCTION(atan2) -_DEFINE_EXPR_BINARY_FUNCTION(pow) - -#undef _DEFINE_EXPR_BINARY_FUNCTION - -} // std:: - - -#endif /* _CPP_VALARRAY_META_H */ - -// Local Variables: -// mode:c++ -// End: diff --git a/contrib/libstdc++/include/ext/stl_hash_fun.h b/contrib/libstdc++/include/ext/stl_hash_fun.h deleted file mode 100644 index 562fe7a..0000000 --- a/contrib/libstdc++/include/ext/stl_hash_fun.h +++ /dev/null @@ -1,126 +0,0 @@ -// 'struct hash' from SGI -*- C++ -*- - -// Copyright (C) 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 -// 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. - -/* - * Copyright (c) 1996-1998 - * Silicon Graphics Computer Systems, Inc. - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Silicon Graphics makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Hewlett-Packard Company makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - */ - -/** @file ext/stl_hash_fun.h - * This file is a GNU extension to the Standard C++ Library (possibly - * containing extensions from the HP/SGI STL subset). You should only - * include this header if you are using GCC 3 or later. - */ - -#ifndef _CPP_BITS_STL_HASH_FUN_H -#define _CPP_BITS_STL_HASH_FUN_H 1 - -#include <cstddef> - -namespace __gnu_cxx -{ -using std::size_t; - -template <class _Key> struct hash { }; - -inline size_t __stl_hash_string(const char* __s) -{ - unsigned long __h = 0; - for ( ; *__s; ++__s) - __h = 5*__h + *__s; - - return size_t(__h); -} - -template<> struct hash<char*> -{ - size_t operator()(const char* __s) const { return __stl_hash_string(__s); } -}; - -template<> struct hash<const char*> -{ - size_t operator()(const char* __s) const { return __stl_hash_string(__s); } -}; - -template<> struct hash<char> { - size_t operator()(char __x) const { return __x; } -}; -template<> struct hash<unsigned char> { - size_t operator()(unsigned char __x) const { return __x; } -}; -template<> struct hash<signed char> { - size_t operator()(unsigned char __x) const { return __x; } -}; -template<> struct hash<short> { - size_t operator()(short __x) const { return __x; } -}; -template<> struct hash<unsigned short> { - size_t operator()(unsigned short __x) const { return __x; } -}; -template<> struct hash<int> { - size_t operator()(int __x) const { return __x; } -}; -template<> struct hash<unsigned int> { - size_t operator()(unsigned int __x) const { return __x; } -}; -template<> struct hash<long> { - size_t operator()(long __x) const { return __x; } -}; -template<> struct hash<unsigned long> { - size_t operator()(unsigned long __x) const { return __x; } -}; - -} // namespace __gnu_cxx - -#endif /* _CPP_BITS_STL_HASH_FUN_H */ - -// Local Variables: -// mode:C++ -// End: diff --git a/contrib/libstdc++/include/ext/stl_hashtable.h b/contrib/libstdc++/include/ext/stl_hashtable.h deleted file mode 100644 index b41c821..0000000 --- a/contrib/libstdc++/include/ext/stl_hashtable.h +++ /dev/null @@ -1,996 +0,0 @@ -// Hashtable implementation used by containers -*- C++ -*- - -// Copyright (C) 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 -// 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. - -/* - * Copyright (c) 1996,1997 - * Silicon Graphics Computer Systems, Inc. - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Silicon Graphics makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Hewlett-Packard Company makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - */ - -/** @file ext/stl_hashtable.h - * This file is a GNU extension to the Standard C++ Library (possibly - * containing extensions from the HP/SGI STL subset). You should only - * include this header if you are using GCC 3 or later. - */ - -#ifndef __SGI_STL_INTERNAL_HASHTABLE_H -#define __SGI_STL_INTERNAL_HASHTABLE_H - -// Hashtable class, used to implement the hashed associative containers -// hash_set, hash_map, hash_multiset, and hash_multimap. - -#include <vector> -#include <iterator> -#include <bits/stl_algo.h> -#include <bits/stl_function.h> -#include <ext/stl_hash_fun.h> - -namespace __gnu_cxx -{ -using std::size_t; -using std::ptrdiff_t; -using std::forward_iterator_tag; -using std::input_iterator_tag; -using std::_Alloc_traits; -using std::_Construct; -using std::_Destroy; -using std::distance; -using std::vector; -using std::pair; -using std::__iterator_category; - -template <class _Val> -struct _Hashtable_node -{ - _Hashtable_node* _M_next; - _Val _M_val; -}; - -template <class _Val, class _Key, class _HashFcn, - class _ExtractKey, class _EqualKey, class _Alloc = std::__alloc> -class hashtable; - -template <class _Val, class _Key, class _HashFcn, - class _ExtractKey, class _EqualKey, class _Alloc> -struct _Hashtable_iterator; - -template <class _Val, class _Key, class _HashFcn, - class _ExtractKey, class _EqualKey, class _Alloc> -struct _Hashtable_const_iterator; - -template <class _Val, class _Key, class _HashFcn, - class _ExtractKey, class _EqualKey, class _Alloc> -struct _Hashtable_iterator { - typedef hashtable<_Val,_Key,_HashFcn,_ExtractKey,_EqualKey,_Alloc> - _Hashtable; - typedef _Hashtable_iterator<_Val, _Key, _HashFcn, - _ExtractKey, _EqualKey, _Alloc> - iterator; - typedef _Hashtable_const_iterator<_Val, _Key, _HashFcn, - _ExtractKey, _EqualKey, _Alloc> - const_iterator; - typedef _Hashtable_node<_Val> _Node; - - typedef forward_iterator_tag iterator_category; - typedef _Val value_type; - typedef ptrdiff_t difference_type; - typedef size_t size_type; - typedef _Val& reference; - typedef _Val* pointer; - - _Node* _M_cur; - _Hashtable* _M_ht; - - _Hashtable_iterator(_Node* __n, _Hashtable* __tab) - : _M_cur(__n), _M_ht(__tab) {} - _Hashtable_iterator() {} - reference operator*() const { return _M_cur->_M_val; } - pointer operator->() const { return &(operator*()); } - iterator& operator++(); - iterator operator++(int); - bool operator==(const iterator& __it) const - { return _M_cur == __it._M_cur; } - bool operator!=(const iterator& __it) const - { return _M_cur != __it._M_cur; } -}; - - -template <class _Val, class _Key, class _HashFcn, - class _ExtractKey, class _EqualKey, class _Alloc> -struct _Hashtable_const_iterator { - typedef hashtable<_Val,_Key,_HashFcn,_ExtractKey,_EqualKey,_Alloc> - _Hashtable; - typedef _Hashtable_iterator<_Val,_Key,_HashFcn, - _ExtractKey,_EqualKey,_Alloc> - iterator; - typedef _Hashtable_const_iterator<_Val, _Key, _HashFcn, - _ExtractKey, _EqualKey, _Alloc> - const_iterator; - typedef _Hashtable_node<_Val> _Node; - - typedef forward_iterator_tag iterator_category; - typedef _Val value_type; - typedef ptrdiff_t difference_type; - typedef size_t size_type; - typedef const _Val& reference; - typedef const _Val* pointer; - - const _Node* _M_cur; - const _Hashtable* _M_ht; - - _Hashtable_const_iterator(const _Node* __n, const _Hashtable* __tab) - : _M_cur(__n), _M_ht(__tab) {} - _Hashtable_const_iterator() {} - _Hashtable_const_iterator(const iterator& __it) - : _M_cur(__it._M_cur), _M_ht(__it._M_ht) {} - reference operator*() const { return _M_cur->_M_val; } - pointer operator->() const { return &(operator*()); } - const_iterator& operator++(); - const_iterator operator++(int); - bool operator==(const const_iterator& __it) const - { return _M_cur == __it._M_cur; } - bool operator!=(const const_iterator& __it) const - { return _M_cur != __it._M_cur; } -}; - -// Note: assumes long is at least 32 bits. -enum { __stl_num_primes = 28 }; - -static const unsigned long __stl_prime_list[__stl_num_primes] = -{ - 53ul, 97ul, 193ul, 389ul, 769ul, - 1543ul, 3079ul, 6151ul, 12289ul, 24593ul, - 49157ul, 98317ul, 196613ul, 393241ul, 786433ul, - 1572869ul, 3145739ul, 6291469ul, 12582917ul, 25165843ul, - 50331653ul, 100663319ul, 201326611ul, 402653189ul, 805306457ul, - 1610612741ul, 3221225473ul, 4294967291ul -}; - -inline unsigned long __stl_next_prime(unsigned long __n) -{ - const unsigned long* __first = __stl_prime_list; - const unsigned long* __last = __stl_prime_list + (int)__stl_num_primes; - const unsigned long* pos = std::lower_bound(__first, __last, __n); - return pos == __last ? *(__last - 1) : *pos; -} - -// Forward declaration of operator==. - -template <class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All> -class hashtable; - -template <class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All> -bool operator==(const hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>& __ht1, - const hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>& __ht2); - - -// Hashtables handle allocators a bit differently than other containers -// do. If we're using standard-conforming allocators, then a hashtable -// unconditionally has a member variable to hold its allocator, even if -// it so happens that all instances of the allocator type are identical. -// This is because, for hashtables, this extra storage is negligible. -// Additionally, a base class wouldn't serve any other purposes; it -// wouldn't, for example, simplify the exception-handling code. - -template <class _Val, class _Key, class _HashFcn, - class _ExtractKey, class _EqualKey, class _Alloc> -class hashtable { -public: - typedef _Key key_type; - typedef _Val value_type; - typedef _HashFcn hasher; - typedef _EqualKey key_equal; - - typedef size_t size_type; - typedef ptrdiff_t difference_type; - typedef value_type* pointer; - typedef const value_type* const_pointer; - typedef value_type& reference; - typedef const value_type& const_reference; - - hasher hash_funct() const { return _M_hash; } - key_equal key_eq() const { return _M_equals; } - -private: - typedef _Hashtable_node<_Val> _Node; - -public: - typedef typename _Alloc_traits<_Val,_Alloc>::allocator_type allocator_type; - allocator_type get_allocator() const { return _M_node_allocator; } -private: - typename _Alloc_traits<_Node, _Alloc>::allocator_type _M_node_allocator; - _Node* _M_get_node() { return _M_node_allocator.allocate(1); } - void _M_put_node(_Node* __p) { _M_node_allocator.deallocate(__p, 1); } - -private: - hasher _M_hash; - key_equal _M_equals; - _ExtractKey _M_get_key; - vector<_Node*,_Alloc> _M_buckets; - size_type _M_num_elements; - -public: - typedef _Hashtable_iterator<_Val,_Key,_HashFcn,_ExtractKey,_EqualKey,_Alloc> - iterator; - typedef _Hashtable_const_iterator<_Val,_Key,_HashFcn,_ExtractKey,_EqualKey, - _Alloc> - const_iterator; - - friend struct - _Hashtable_iterator<_Val,_Key,_HashFcn,_ExtractKey,_EqualKey,_Alloc>; - friend struct - _Hashtable_const_iterator<_Val,_Key,_HashFcn,_ExtractKey,_EqualKey,_Alloc>; - -public: - hashtable(size_type __n, - const _HashFcn& __hf, - const _EqualKey& __eql, - const _ExtractKey& __ext, - const allocator_type& __a = allocator_type()) - : _M_node_allocator(__a), - _M_hash(__hf), - _M_equals(__eql), - _M_get_key(__ext), - _M_buckets(__a), - _M_num_elements(0) - { - _M_initialize_buckets(__n); - } - - hashtable(size_type __n, - const _HashFcn& __hf, - const _EqualKey& __eql, - const allocator_type& __a = allocator_type()) - : _M_node_allocator(__a), - _M_hash(__hf), - _M_equals(__eql), - _M_get_key(_ExtractKey()), - _M_buckets(__a), - _M_num_elements(0) - { - _M_initialize_buckets(__n); - } - - hashtable(const hashtable& __ht) - : _M_node_allocator(__ht.get_allocator()), - _M_hash(__ht._M_hash), - _M_equals(__ht._M_equals), - _M_get_key(__ht._M_get_key), - _M_buckets(__ht.get_allocator()), - _M_num_elements(0) - { - _M_copy_from(__ht); - } - - hashtable& operator= (const hashtable& __ht) - { - if (&__ht != this) { - clear(); - _M_hash = __ht._M_hash; - _M_equals = __ht._M_equals; - _M_get_key = __ht._M_get_key; - _M_copy_from(__ht); - } - return *this; - } - - ~hashtable() { clear(); } - - size_type size() const { return _M_num_elements; } - size_type max_size() const { return size_type(-1); } - bool empty() const { return size() == 0; } - - void swap(hashtable& __ht) - { - std::swap(_M_hash, __ht._M_hash); - std::swap(_M_equals, __ht._M_equals); - std::swap(_M_get_key, __ht._M_get_key); - _M_buckets.swap(__ht._M_buckets); - std::swap(_M_num_elements, __ht._M_num_elements); - } - - iterator begin() - { - for (size_type __n = 0; __n < _M_buckets.size(); ++__n) - if (_M_buckets[__n]) - return iterator(_M_buckets[__n], this); - return end(); - } - - iterator end() { return iterator(0, this); } - - const_iterator begin() const - { - for (size_type __n = 0; __n < _M_buckets.size(); ++__n) - if (_M_buckets[__n]) - return const_iterator(_M_buckets[__n], this); - return end(); - } - - const_iterator end() const { return const_iterator(0, this); } - - template <class _Vl, class _Ky, class _HF, class _Ex, class _Eq, class _Al> - friend bool operator== (const hashtable<_Vl, _Ky, _HF, _Ex, _Eq, _Al>&, - const hashtable<_Vl, _Ky, _HF, _Ex, _Eq, _Al>&); -public: - - size_type bucket_count() const { return _M_buckets.size(); } - - size_type max_bucket_count() const - { return __stl_prime_list[(int)__stl_num_primes - 1]; } - - size_type elems_in_bucket(size_type __bucket) const - { - size_type __result = 0; - for (_Node* __cur = _M_buckets[__bucket]; __cur; __cur = __cur->_M_next) - __result += 1; - return __result; - } - - pair<iterator, bool> insert_unique(const value_type& __obj) - { - resize(_M_num_elements + 1); - return insert_unique_noresize(__obj); - } - - iterator insert_equal(const value_type& __obj) - { - resize(_M_num_elements + 1); - return insert_equal_noresize(__obj); - } - - pair<iterator, bool> insert_unique_noresize(const value_type& __obj); - iterator insert_equal_noresize(const value_type& __obj); - - template <class _InputIterator> - void insert_unique(_InputIterator __f, _InputIterator __l) - { - insert_unique(__f, __l, __iterator_category(__f)); - } - - template <class _InputIterator> - void insert_equal(_InputIterator __f, _InputIterator __l) - { - insert_equal(__f, __l, __iterator_category(__f)); - } - - template <class _InputIterator> - void insert_unique(_InputIterator __f, _InputIterator __l, - input_iterator_tag) - { - for ( ; __f != __l; ++__f) - insert_unique(*__f); - } - - template <class _InputIterator> - void insert_equal(_InputIterator __f, _InputIterator __l, - input_iterator_tag) - { - for ( ; __f != __l; ++__f) - insert_equal(*__f); - } - - template <class _ForwardIterator> - void insert_unique(_ForwardIterator __f, _ForwardIterator __l, - forward_iterator_tag) - { - size_type __n = distance(__f, __l); - resize(_M_num_elements + __n); - for ( ; __n > 0; --__n, ++__f) - insert_unique_noresize(*__f); - } - - template <class _ForwardIterator> - void insert_equal(_ForwardIterator __f, _ForwardIterator __l, - forward_iterator_tag) - { - size_type __n = distance(__f, __l); - resize(_M_num_elements + __n); - for ( ; __n > 0; --__n, ++__f) - insert_equal_noresize(*__f); - } - - reference find_or_insert(const value_type& __obj); - - iterator find(const key_type& __key) - { - size_type __n = _M_bkt_num_key(__key); - _Node* __first; - for ( __first = _M_buckets[__n]; - __first && !_M_equals(_M_get_key(__first->_M_val), __key); - __first = __first->_M_next) - {} - return iterator(__first, this); - } - - const_iterator find(const key_type& __key) const - { - size_type __n = _M_bkt_num_key(__key); - const _Node* __first; - for ( __first = _M_buckets[__n]; - __first && !_M_equals(_M_get_key(__first->_M_val), __key); - __first = __first->_M_next) - {} - return const_iterator(__first, this); - } - - size_type count(const key_type& __key) const - { - const size_type __n = _M_bkt_num_key(__key); - size_type __result = 0; - - for (const _Node* __cur = _M_buckets[__n]; __cur; __cur = __cur->_M_next) - if (_M_equals(_M_get_key(__cur->_M_val), __key)) - ++__result; - return __result; - } - - pair<iterator, iterator> - equal_range(const key_type& __key); - - pair<const_iterator, const_iterator> - equal_range(const key_type& __key) const; - - size_type erase(const key_type& __key); - void erase(const iterator& __it); - void erase(iterator __first, iterator __last); - - void erase(const const_iterator& __it); - void erase(const_iterator __first, const_iterator __last); - - void resize(size_type __num_elements_hint); - void clear(); - -private: - size_type _M_next_size(size_type __n) const - { return __stl_next_prime(__n); } - - void _M_initialize_buckets(size_type __n) - { - const size_type __n_buckets = _M_next_size(__n); - _M_buckets.reserve(__n_buckets); - _M_buckets.insert(_M_buckets.end(), __n_buckets, (_Node*) 0); - _M_num_elements = 0; - } - - size_type _M_bkt_num_key(const key_type& __key) const - { - return _M_bkt_num_key(__key, _M_buckets.size()); - } - - size_type _M_bkt_num(const value_type& __obj) const - { - return _M_bkt_num_key(_M_get_key(__obj)); - } - - size_type _M_bkt_num_key(const key_type& __key, size_t __n) const - { - return _M_hash(__key) % __n; - } - - size_type _M_bkt_num(const value_type& __obj, size_t __n) const - { - return _M_bkt_num_key(_M_get_key(__obj), __n); - } - - _Node* _M_new_node(const value_type& __obj) - { - _Node* __n = _M_get_node(); - __n->_M_next = 0; - try { - _Construct(&__n->_M_val, __obj); - return __n; - } - catch(...) - { - _M_put_node(__n); - __throw_exception_again; - } - } - - void _M_delete_node(_Node* __n) - { - _Destroy(&__n->_M_val); - _M_put_node(__n); - } - - void _M_erase_bucket(const size_type __n, _Node* __first, _Node* __last); - void _M_erase_bucket(const size_type __n, _Node* __last); - - void _M_copy_from(const hashtable& __ht); - -}; - -template <class _Val, class _Key, class _HF, class _ExK, class _EqK, - class _All> -_Hashtable_iterator<_Val,_Key,_HF,_ExK,_EqK,_All>& -_Hashtable_iterator<_Val,_Key,_HF,_ExK,_EqK,_All>::operator++() -{ - const _Node* __old = _M_cur; - _M_cur = _M_cur->_M_next; - if (!_M_cur) { - size_type __bucket = _M_ht->_M_bkt_num(__old->_M_val); - while (!_M_cur && ++__bucket < _M_ht->_M_buckets.size()) - _M_cur = _M_ht->_M_buckets[__bucket]; - } - return *this; -} - -template <class _Val, class _Key, class _HF, class _ExK, class _EqK, - class _All> -inline _Hashtable_iterator<_Val,_Key,_HF,_ExK,_EqK,_All> -_Hashtable_iterator<_Val,_Key,_HF,_ExK,_EqK,_All>::operator++(int) -{ - iterator __tmp = *this; - ++*this; - return __tmp; -} - -template <class _Val, class _Key, class _HF, class _ExK, class _EqK, - class _All> -_Hashtable_const_iterator<_Val,_Key,_HF,_ExK,_EqK,_All>& -_Hashtable_const_iterator<_Val,_Key,_HF,_ExK,_EqK,_All>::operator++() -{ - const _Node* __old = _M_cur; - _M_cur = _M_cur->_M_next; - if (!_M_cur) { - size_type __bucket = _M_ht->_M_bkt_num(__old->_M_val); - while (!_M_cur && ++__bucket < _M_ht->_M_buckets.size()) - _M_cur = _M_ht->_M_buckets[__bucket]; - } - return *this; -} - -template <class _Val, class _Key, class _HF, class _ExK, class _EqK, - class _All> -inline _Hashtable_const_iterator<_Val,_Key,_HF,_ExK,_EqK,_All> -_Hashtable_const_iterator<_Val,_Key,_HF,_ExK,_EqK,_All>::operator++(int) -{ - const_iterator __tmp = *this; - ++*this; - return __tmp; -} - -template <class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All> -bool operator==(const hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>& __ht1, - const hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>& __ht2) -{ - typedef typename hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>::_Node _Node; - if (__ht1._M_buckets.size() != __ht2._M_buckets.size()) - return false; - for (size_t __n = 0; __n < __ht1._M_buckets.size(); ++__n) { - _Node* __cur1 = __ht1._M_buckets[__n]; - _Node* __cur2 = __ht2._M_buckets[__n]; - // Check same length of lists - for ( ; __cur1 && __cur2; - __cur1 = __cur1->_M_next, __cur2 = __cur2->_M_next) - {} - if (__cur1 || __cur2) - return false; - // Now check one's elements are in the other - for (__cur1 = __ht1._M_buckets[__n] ; __cur1; __cur1 = __cur1->_M_next) - { - bool _found__cur1 = false; - for (_Node* __cur2 = __ht2._M_buckets[__n]; - __cur2; __cur2 = __cur2->_M_next) - { - if (__cur1->_M_val == __cur2->_M_val) - { - _found__cur1 = true; - break; - } - } - if (!_found__cur1) - return false; - } - } - return true; -} - -template <class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All> -inline bool operator!=(const hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>& __ht1, - const hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>& __ht2) { - return !(__ht1 == __ht2); -} - -template <class _Val, class _Key, class _HF, class _Extract, class _EqKey, - class _All> -inline void swap(hashtable<_Val, _Key, _HF, _Extract, _EqKey, _All>& __ht1, - hashtable<_Val, _Key, _HF, _Extract, _EqKey, _All>& __ht2) { - __ht1.swap(__ht2); -} - - -template <class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All> -pair<typename hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>::iterator, bool> -hashtable<_Val,_Key,_HF,_Ex,_Eq,_All> - ::insert_unique_noresize(const value_type& __obj) -{ - const size_type __n = _M_bkt_num(__obj); - _Node* __first = _M_buckets[__n]; - - for (_Node* __cur = __first; __cur; __cur = __cur->_M_next) - if (_M_equals(_M_get_key(__cur->_M_val), _M_get_key(__obj))) - return pair<iterator, bool>(iterator(__cur, this), false); - - _Node* __tmp = _M_new_node(__obj); - __tmp->_M_next = __first; - _M_buckets[__n] = __tmp; - ++_M_num_elements; - return pair<iterator, bool>(iterator(__tmp, this), true); -} - -template <class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All> -typename hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>::iterator -hashtable<_Val,_Key,_HF,_Ex,_Eq,_All> - ::insert_equal_noresize(const value_type& __obj) -{ - const size_type __n = _M_bkt_num(__obj); - _Node* __first = _M_buckets[__n]; - - for (_Node* __cur = __first; __cur; __cur = __cur->_M_next) - if (_M_equals(_M_get_key(__cur->_M_val), _M_get_key(__obj))) { - _Node* __tmp = _M_new_node(__obj); - __tmp->_M_next = __cur->_M_next; - __cur->_M_next = __tmp; - ++_M_num_elements; - return iterator(__tmp, this); - } - - _Node* __tmp = _M_new_node(__obj); - __tmp->_M_next = __first; - _M_buckets[__n] = __tmp; - ++_M_num_elements; - return iterator(__tmp, this); -} - -template <class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All> -typename hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>::reference -hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>::find_or_insert(const value_type& __obj) -{ - resize(_M_num_elements + 1); - - size_type __n = _M_bkt_num(__obj); - _Node* __first = _M_buckets[__n]; - - for (_Node* __cur = __first; __cur; __cur = __cur->_M_next) - if (_M_equals(_M_get_key(__cur->_M_val), _M_get_key(__obj))) - return __cur->_M_val; - - _Node* __tmp = _M_new_node(__obj); - __tmp->_M_next = __first; - _M_buckets[__n] = __tmp; - ++_M_num_elements; - return __tmp->_M_val; -} - -template <class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All> -pair<typename hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>::iterator, - typename hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>::iterator> -hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>::equal_range(const key_type& __key) -{ - typedef pair<iterator, iterator> _Pii; - const size_type __n = _M_bkt_num_key(__key); - - for (_Node* __first = _M_buckets[__n]; __first; __first = __first->_M_next) - if (_M_equals(_M_get_key(__first->_M_val), __key)) { - for (_Node* __cur = __first->_M_next; __cur; __cur = __cur->_M_next) - if (!_M_equals(_M_get_key(__cur->_M_val), __key)) - return _Pii(iterator(__first, this), iterator(__cur, this)); - for (size_type __m = __n + 1; __m < _M_buckets.size(); ++__m) - if (_M_buckets[__m]) - return _Pii(iterator(__first, this), - iterator(_M_buckets[__m], this)); - return _Pii(iterator(__first, this), end()); - } - return _Pii(end(), end()); -} - -template <class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All> -pair<typename hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>::const_iterator, - typename hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>::const_iterator> -hashtable<_Val,_Key,_HF,_Ex,_Eq,_All> - ::equal_range(const key_type& __key) const -{ - typedef pair<const_iterator, const_iterator> _Pii; - const size_type __n = _M_bkt_num_key(__key); - - for (const _Node* __first = _M_buckets[__n] ; - __first; - __first = __first->_M_next) { - if (_M_equals(_M_get_key(__first->_M_val), __key)) { - for (const _Node* __cur = __first->_M_next; - __cur; - __cur = __cur->_M_next) - if (!_M_equals(_M_get_key(__cur->_M_val), __key)) - return _Pii(const_iterator(__first, this), - const_iterator(__cur, this)); - for (size_type __m = __n + 1; __m < _M_buckets.size(); ++__m) - if (_M_buckets[__m]) - return _Pii(const_iterator(__first, this), - const_iterator(_M_buckets[__m], this)); - return _Pii(const_iterator(__first, this), end()); - } - } - return _Pii(end(), end()); -} - -template <class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All> -typename hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>::size_type -hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>::erase(const key_type& __key) -{ - const size_type __n = _M_bkt_num_key(__key); - _Node* __first = _M_buckets[__n]; - size_type __erased = 0; - - if (__first) { - _Node* __cur = __first; - _Node* __next = __cur->_M_next; - while (__next) { - if (_M_equals(_M_get_key(__next->_M_val), __key)) { - __cur->_M_next = __next->_M_next; - _M_delete_node(__next); - __next = __cur->_M_next; - ++__erased; - --_M_num_elements; - } - else { - __cur = __next; - __next = __cur->_M_next; - } - } - if (_M_equals(_M_get_key(__first->_M_val), __key)) { - _M_buckets[__n] = __first->_M_next; - _M_delete_node(__first); - ++__erased; - --_M_num_elements; - } - } - return __erased; -} - -template <class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All> -void hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>::erase(const iterator& __it) -{ - _Node* __p = __it._M_cur; - if (__p) { - const size_type __n = _M_bkt_num(__p->_M_val); - _Node* __cur = _M_buckets[__n]; - - if (__cur == __p) { - _M_buckets[__n] = __cur->_M_next; - _M_delete_node(__cur); - --_M_num_elements; - } - else { - _Node* __next = __cur->_M_next; - while (__next) { - if (__next == __p) { - __cur->_M_next = __next->_M_next; - _M_delete_node(__next); - --_M_num_elements; - break; - } - else { - __cur = __next; - __next = __cur->_M_next; - } - } - } - } -} - -template <class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All> -void hashtable<_Val,_Key,_HF,_Ex,_Eq,_All> - ::erase(iterator __first, iterator __last) -{ - size_type __f_bucket = __first._M_cur ? - _M_bkt_num(__first._M_cur->_M_val) : _M_buckets.size(); - size_type __l_bucket = __last._M_cur ? - _M_bkt_num(__last._M_cur->_M_val) : _M_buckets.size(); - - if (__first._M_cur == __last._M_cur) - return; - else if (__f_bucket == __l_bucket) - _M_erase_bucket(__f_bucket, __first._M_cur, __last._M_cur); - else { - _M_erase_bucket(__f_bucket, __first._M_cur, 0); - for (size_type __n = __f_bucket + 1; __n < __l_bucket; ++__n) - _M_erase_bucket(__n, 0); - if (__l_bucket != _M_buckets.size()) - _M_erase_bucket(__l_bucket, __last._M_cur); - } -} - -template <class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All> -inline void -hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>::erase(const_iterator __first, - const_iterator __last) -{ - erase(iterator(const_cast<_Node*>(__first._M_cur), - const_cast<hashtable*>(__first._M_ht)), - iterator(const_cast<_Node*>(__last._M_cur), - const_cast<hashtable*>(__last._M_ht))); -} - -template <class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All> -inline void -hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>::erase(const const_iterator& __it) -{ - erase(iterator(const_cast<_Node*>(__it._M_cur), - const_cast<hashtable*>(__it._M_ht))); -} - -template <class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All> -void hashtable<_Val,_Key,_HF,_Ex,_Eq,_All> - ::resize(size_type __num_elements_hint) -{ - const size_type __old_n = _M_buckets.size(); - if (__num_elements_hint > __old_n) { - const size_type __n = _M_next_size(__num_elements_hint); - if (__n > __old_n) { - vector<_Node*, _All> __tmp(__n, (_Node*)(0), - _M_buckets.get_allocator()); - try { - for (size_type __bucket = 0; __bucket < __old_n; ++__bucket) { - _Node* __first = _M_buckets[__bucket]; - while (__first) { - size_type __new_bucket = _M_bkt_num(__first->_M_val, __n); - _M_buckets[__bucket] = __first->_M_next; - __first->_M_next = __tmp[__new_bucket]; - __tmp[__new_bucket] = __first; - __first = _M_buckets[__bucket]; - } - } - _M_buckets.swap(__tmp); - } - catch(...) { - for (size_type __bucket = 0; __bucket < __tmp.size(); ++__bucket) { - while (__tmp[__bucket]) { - _Node* __next = __tmp[__bucket]->_M_next; - _M_delete_node(__tmp[__bucket]); - __tmp[__bucket] = __next; - } - } - __throw_exception_again; - } - } - } -} - -template <class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All> -void hashtable<_Val,_Key,_HF,_Ex,_Eq,_All> - ::_M_erase_bucket(const size_type __n, _Node* __first, _Node* __last) -{ - _Node* __cur = _M_buckets[__n]; - if (__cur == __first) - _M_erase_bucket(__n, __last); - else { - _Node* __next; - for (__next = __cur->_M_next; - __next != __first; - __cur = __next, __next = __cur->_M_next) - ; - while (__next != __last) { - __cur->_M_next = __next->_M_next; - _M_delete_node(__next); - __next = __cur->_M_next; - --_M_num_elements; - } - } -} - -template <class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All> -void hashtable<_Val,_Key,_HF,_Ex,_Eq,_All> - ::_M_erase_bucket(const size_type __n, _Node* __last) -{ - _Node* __cur = _M_buckets[__n]; - while (__cur != __last) { - _Node* __next = __cur->_M_next; - _M_delete_node(__cur); - __cur = __next; - _M_buckets[__n] = __cur; - --_M_num_elements; - } -} - -template <class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All> -void hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>::clear() -{ - for (size_type __i = 0; __i < _M_buckets.size(); ++__i) { - _Node* __cur = _M_buckets[__i]; - while (__cur != 0) { - _Node* __next = __cur->_M_next; - _M_delete_node(__cur); - __cur = __next; - } - _M_buckets[__i] = 0; - } - _M_num_elements = 0; -} - - -template <class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All> -void hashtable<_Val,_Key,_HF,_Ex,_Eq,_All> - ::_M_copy_from(const hashtable& __ht) -{ - _M_buckets.clear(); - _M_buckets.reserve(__ht._M_buckets.size()); - _M_buckets.insert(_M_buckets.end(), __ht._M_buckets.size(), (_Node*) 0); - try { - for (size_type __i = 0; __i < __ht._M_buckets.size(); ++__i) { - const _Node* __cur = __ht._M_buckets[__i]; - if (__cur) { - _Node* __local_copy = _M_new_node(__cur->_M_val); - _M_buckets[__i] = __local_copy; - - for (_Node* __next = __cur->_M_next; - __next; - __cur = __next, __next = __cur->_M_next) { - __local_copy->_M_next = _M_new_node(__next->_M_val); - __local_copy = __local_copy->_M_next; - } - } - } - _M_num_elements = __ht._M_num_elements; - } - catch(...) - { - clear(); - __throw_exception_again; - } -} - -} // namespace __gnu_cxx - -#endif /* __SGI_STL_INTERNAL_HASHTABLE_H */ - -// Local Variables: -// mode:C++ -// End: diff --git a/contrib/libstdc++/include/ext/stl_rope.h b/contrib/libstdc++/include/ext/stl_rope.h deleted file mode 100644 index eae2613..0000000 --- a/contrib/libstdc++/include/ext/stl_rope.h +++ /dev/null @@ -1,2503 +0,0 @@ -// SGI's rope implementation -*- C++ -*- - -// Copyright (C) 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 -// 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. - -/* - * Copyright (c) 1997-1998 - * Silicon Graphics Computer Systems, Inc. - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Silicon Graphics makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - */ - -/** @file ext/stl_rope.h - * This file is a GNU extension to the Standard C++ Library (possibly - * containing extensions from the HP/SGI STL subset). You should only - * include this header if you are using GCC 3 or later. - */ - -// rope<_CharT,_Alloc> is a sequence of _CharT. -// Ropes appear to be mutable, but update operations -// really copy enough of the data structure to leave the original -// valid. Thus ropes can be logically copied by just copying -// a pointer value. - -#ifndef __SGI_STL_INTERNAL_ROPE_H -# define __SGI_STL_INTERNAL_ROPE_H - -# ifdef __GC -# define __GC_CONST const -# else -# include <bits/stl_threads.h> -# define __GC_CONST // constant except for deallocation -# endif - -#include <ext/memory> // For uninitialized_copy_n - -namespace __gnu_cxx -{ -using std::size_t; -using std::ptrdiff_t; -using std::allocator; -using std::iterator; -using std::reverse_iterator; -using std::_Alloc_traits; -using std::_Destroy; -using std::_Refcount_Base; - -// The _S_eos function is used for those functions that -// convert to/from C-like strings to detect the end of the string. - -// The end-of-C-string character. -// This is what the draft standard says it should be. -template <class _CharT> -inline _CharT _S_eos(_CharT*) { return _CharT(); } - -// Test for basic character types. -// For basic character types leaves having a trailing eos. -template <class _CharT> -inline bool _S_is_basic_char_type(_CharT*) { return false; } -template <class _CharT> -inline bool _S_is_one_byte_char_type(_CharT*) { return false; } - -inline bool _S_is_basic_char_type(char*) { return true; } -inline bool _S_is_one_byte_char_type(char*) { return true; } -inline bool _S_is_basic_char_type(wchar_t*) { return true; } - -// Store an eos iff _CharT is a basic character type. -// Do not reference _S_eos if it isn't. -template <class _CharT> -inline void _S_cond_store_eos(_CharT&) {} - -inline void _S_cond_store_eos(char& __c) { __c = 0; } -inline void _S_cond_store_eos(wchar_t& __c) { __c = 0; } - -// char_producers are logically functions that generate a section of -// a string. These can be convereted to ropes. The resulting rope -// invokes the char_producer on demand. This allows, for example, -// files to be viewed as ropes without reading the entire file. -template <class _CharT> -class char_producer { - public: - virtual ~char_producer() {}; - virtual void operator()(size_t __start_pos, size_t __len, - _CharT* __buffer) = 0; - // Buffer should really be an arbitrary output iterator. - // That way we could flatten directly into an ostream, etc. - // This is thoroughly impossible, since iterator types don't - // have runtime descriptions. -}; - -// Sequence buffers: -// -// Sequence must provide an append operation that appends an -// array to the sequence. Sequence buffers are useful only if -// appending an entire array is cheaper than appending element by element. -// This is true for many string representations. -// This should perhaps inherit from ostream<sequence::value_type> -// and be implemented correspondingly, so that they can be used -// for formatted. For the sake of portability, we don't do this yet. -// -// For now, sequence buffers behave as output iterators. But they also -// behave a little like basic_ostringstream<sequence::value_type> and a -// little like containers. - -template<class _Sequence, size_t _Buf_sz = 100> -class sequence_buffer : public iterator<std::output_iterator_tag,void,void,void,void> -{ - public: - typedef typename _Sequence::value_type value_type; - protected: - _Sequence* _M_prefix; - value_type _M_buffer[_Buf_sz]; - size_t _M_buf_count; - public: - void flush() { - _M_prefix->append(_M_buffer, _M_buffer + _M_buf_count); - _M_buf_count = 0; - } - ~sequence_buffer() { flush(); } - sequence_buffer() : _M_prefix(0), _M_buf_count(0) {} - sequence_buffer(const sequence_buffer& __x) { - _M_prefix = __x._M_prefix; - _M_buf_count = __x._M_buf_count; - copy(__x._M_buffer, __x._M_buffer + __x._M_buf_count, _M_buffer); - } - sequence_buffer(sequence_buffer& __x) { - __x.flush(); - _M_prefix = __x._M_prefix; - _M_buf_count = 0; - } - sequence_buffer(_Sequence& __s) : _M_prefix(&__s), _M_buf_count(0) {} - sequence_buffer& operator= (sequence_buffer& __x) { - __x.flush(); - _M_prefix = __x._M_prefix; - _M_buf_count = 0; - return *this; - } - sequence_buffer& operator= (const sequence_buffer& __x) { - _M_prefix = __x._M_prefix; - _M_buf_count = __x._M_buf_count; - copy(__x._M_buffer, __x._M_buffer + __x._M_buf_count, _M_buffer); - return *this; - } - void push_back(value_type __x) - { - if (_M_buf_count < _Buf_sz) { - _M_buffer[_M_buf_count] = __x; - ++_M_buf_count; - } else { - flush(); - _M_buffer[0] = __x; - _M_buf_count = 1; - } - } - void append(value_type* __s, size_t __len) - { - if (__len + _M_buf_count <= _Buf_sz) { - size_t __i = _M_buf_count; - size_t __j = 0; - for (; __j < __len; __i++, __j++) { - _M_buffer[__i] = __s[__j]; - } - _M_buf_count += __len; - } else if (0 == _M_buf_count) { - _M_prefix->append(__s, __s + __len); - } else { - flush(); - append(__s, __len); - } - } - sequence_buffer& write(value_type* __s, size_t __len) - { - append(__s, __len); - return *this; - } - sequence_buffer& put(value_type __x) - { - push_back(__x); - return *this; - } - sequence_buffer& operator=(const value_type& __rhs) - { - push_back(__rhs); - return *this; - } - sequence_buffer& operator*() { return *this; } - sequence_buffer& operator++() { return *this; } - sequence_buffer& operator++(int) { return *this; } -}; - -// The following should be treated as private, at least for now. -template<class _CharT> -class _Rope_char_consumer { - public: - // If we had member templates, these should not be virtual. - // For now we need to use run-time parametrization where - // compile-time would do. Hence this should all be private - // for now. - // The symmetry with char_producer is accidental and temporary. - virtual ~_Rope_char_consumer() {}; - virtual bool operator()(const _CharT* __buffer, size_t __len) = 0; -}; - -// First a lot of forward declarations. The standard seems to require -// much stricter "declaration before use" than many of the implementations -// that preceded it. -template<class _CharT, class _Alloc=allocator<_CharT> > class rope; -template<class _CharT, class _Alloc> struct _Rope_RopeConcatenation; -template<class _CharT, class _Alloc> struct _Rope_RopeLeaf; -template<class _CharT, class _Alloc> struct _Rope_RopeFunction; -template<class _CharT, class _Alloc> struct _Rope_RopeSubstring; -template<class _CharT, class _Alloc> class _Rope_iterator; -template<class _CharT, class _Alloc> class _Rope_const_iterator; -template<class _CharT, class _Alloc> class _Rope_char_ref_proxy; -template<class _CharT, class _Alloc> class _Rope_char_ptr_proxy; - -template<class _CharT, class _Alloc> -bool operator== (const _Rope_char_ptr_proxy<_CharT,_Alloc>& __x, - const _Rope_char_ptr_proxy<_CharT,_Alloc>& __y); - -template<class _CharT, class _Alloc> -_Rope_const_iterator<_CharT,_Alloc> operator- - (const _Rope_const_iterator<_CharT,_Alloc>& __x, - ptrdiff_t __n); - -template<class _CharT, class _Alloc> -_Rope_const_iterator<_CharT,_Alloc> operator+ - (const _Rope_const_iterator<_CharT,_Alloc>& __x, - ptrdiff_t __n); - -template<class _CharT, class _Alloc> -_Rope_const_iterator<_CharT,_Alloc> operator+ - (ptrdiff_t __n, - const _Rope_const_iterator<_CharT,_Alloc>& __x); - -template<class _CharT, class _Alloc> -bool operator== - (const _Rope_const_iterator<_CharT,_Alloc>& __x, - const _Rope_const_iterator<_CharT,_Alloc>& __y); - -template<class _CharT, class _Alloc> -bool operator< - (const _Rope_const_iterator<_CharT,_Alloc>& __x, - const _Rope_const_iterator<_CharT,_Alloc>& __y); - -template<class _CharT, class _Alloc> -ptrdiff_t operator- - (const _Rope_const_iterator<_CharT,_Alloc>& __x, - const _Rope_const_iterator<_CharT,_Alloc>& __y); - -template<class _CharT, class _Alloc> -_Rope_iterator<_CharT,_Alloc> operator- - (const _Rope_iterator<_CharT,_Alloc>& __x, - ptrdiff_t __n); - -template<class _CharT, class _Alloc> -_Rope_iterator<_CharT,_Alloc> operator+ - (const _Rope_iterator<_CharT,_Alloc>& __x, - ptrdiff_t __n); - -template<class _CharT, class _Alloc> -_Rope_iterator<_CharT,_Alloc> operator+ - (ptrdiff_t __n, - const _Rope_iterator<_CharT,_Alloc>& __x); - -template<class _CharT, class _Alloc> -bool operator== - (const _Rope_iterator<_CharT,_Alloc>& __x, - const _Rope_iterator<_CharT,_Alloc>& __y); - -template<class _CharT, class _Alloc> -bool operator< - (const _Rope_iterator<_CharT,_Alloc>& __x, - const _Rope_iterator<_CharT,_Alloc>& __y); - -template<class _CharT, class _Alloc> -ptrdiff_t operator- - (const _Rope_iterator<_CharT,_Alloc>& __x, - const _Rope_iterator<_CharT,_Alloc>& __y); - -template<class _CharT, class _Alloc> -rope<_CharT,_Alloc> operator+ (const rope<_CharT,_Alloc>& __left, - const rope<_CharT,_Alloc>& __right); - -template<class _CharT, class _Alloc> -rope<_CharT,_Alloc> operator+ (const rope<_CharT,_Alloc>& __left, - const _CharT* __right); - -template<class _CharT, class _Alloc> -rope<_CharT,_Alloc> operator+ (const rope<_CharT,_Alloc>& __left, - _CharT __right); - -// Some helpers, so we can use power on ropes. -// See below for why this isn't local to the implementation. - -// This uses a nonstandard refcount convention. -// The result has refcount 0. -template<class _CharT, class _Alloc> -struct _Rope_Concat_fn - : public std::binary_function<rope<_CharT,_Alloc>, rope<_CharT,_Alloc>, - rope<_CharT,_Alloc> > { - rope<_CharT,_Alloc> operator() (const rope<_CharT,_Alloc>& __x, - const rope<_CharT,_Alloc>& __y) { - return __x + __y; - } -}; - -template <class _CharT, class _Alloc> -inline -rope<_CharT,_Alloc> -identity_element(_Rope_Concat_fn<_CharT, _Alloc>) -{ - return rope<_CharT,_Alloc>(); -} - - -// -// What follows should really be local to rope. Unfortunately, -// that doesn't work, since it makes it impossible to define generic -// equality on rope iterators. According to the draft standard, the -// template parameters for such an equality operator cannot be inferred -// from the occurrence of a member class as a parameter. -// (SGI compilers in fact allow this, but the __result wouldn't be -// portable.) -// Similarly, some of the static member functions are member functions -// only to avoid polluting the global namespace, and to circumvent -// restrictions on type inference for template functions. -// - -// -// The internal data structure for representing a rope. This is -// private to the implementation. A rope is really just a pointer -// to one of these. -// -// A few basic functions for manipulating this data structure -// are members of _RopeRep. Most of the more complex algorithms -// are implemented as rope members. -// -// Some of the static member functions of _RopeRep have identically -// named functions in rope that simply invoke the _RopeRep versions. -// -// A macro to introduce various allocation and deallocation functions -// These need to be defined differently depending on whether or not -// we are using standard conforming allocators, and whether the allocator -// instances have real state. Thus this macro is invoked repeatedly -// with different definitions of __ROPE_DEFINE_ALLOC. -// __ROPE_DEFINE_ALLOC(type,name) defines -// type * name_allocate(size_t) and -// void name_deallocate(tipe *, size_t) -// Both functions may or may not be static. - -#define __ROPE_DEFINE_ALLOCS(__a) \ - __ROPE_DEFINE_ALLOC(_CharT,_Data) /* character data */ \ - typedef _Rope_RopeConcatenation<_CharT,__a> __C; \ - __ROPE_DEFINE_ALLOC(__C,_C) \ - typedef _Rope_RopeLeaf<_CharT,__a> __L; \ - __ROPE_DEFINE_ALLOC(__L,_L) \ - typedef _Rope_RopeFunction<_CharT,__a> __F; \ - __ROPE_DEFINE_ALLOC(__F,_F) \ - typedef _Rope_RopeSubstring<_CharT,__a> __S; \ - __ROPE_DEFINE_ALLOC(__S,_S) - -// Internal rope nodes potentially store a copy of the allocator -// instance used to allocate them. This is mostly redundant. -// But the alternative would be to pass allocator instances around -// in some form to nearly all internal functions, since any pointer -// assignment may result in a zero reference count and thus require -// deallocation. -// The _Rope_rep_base class encapsulates -// the differences between SGI-style allocators and standard-conforming -// allocators. - -#define __STATIC_IF_SGI_ALLOC /* not static */ - -// Base class for ordinary allocators. -template <class _CharT, class _Allocator, bool _IsStatic> -class _Rope_rep_alloc_base { -public: - typedef typename _Alloc_traits<_CharT,_Allocator>::allocator_type - allocator_type; - allocator_type get_allocator() const { return _M_data_allocator; } - _Rope_rep_alloc_base(size_t __size, const allocator_type& __a) - : _M_size(__size), _M_data_allocator(__a) {} - size_t _M_size; // This is here only to avoid wasting space - // for an otherwise empty base class. - - -protected: - allocator_type _M_data_allocator; - -# define __ROPE_DEFINE_ALLOC(_Tp, __name) \ - typedef typename \ - _Alloc_traits<_Tp,_Allocator>::allocator_type __name##Allocator; \ - /*static*/ _Tp * __name##_allocate(size_t __n) \ - { return __name##Allocator(_M_data_allocator).allocate(__n); } \ - void __name##_deallocate(_Tp* __p, size_t __n) \ - { __name##Allocator(_M_data_allocator).deallocate(__p, __n); } - __ROPE_DEFINE_ALLOCS(_Allocator); -# undef __ROPE_DEFINE_ALLOC -}; - -// Specialization for allocators that have the property that we don't -// actually have to store an allocator object. -template <class _CharT, class _Allocator> -class _Rope_rep_alloc_base<_CharT,_Allocator,true> { -public: - typedef typename _Alloc_traits<_CharT,_Allocator>::allocator_type - allocator_type; - allocator_type get_allocator() const { return allocator_type(); } - _Rope_rep_alloc_base(size_t __size, const allocator_type&) - : _M_size(__size) {} - size_t _M_size; - -protected: - -# define __ROPE_DEFINE_ALLOC(_Tp, __name) \ - typedef typename \ - _Alloc_traits<_Tp,_Allocator>::_Alloc_type __name##Alloc; \ - typedef typename \ - _Alloc_traits<_Tp,_Allocator>::allocator_type __name##Allocator; \ - static _Tp* __name##_allocate(size_t __n) \ - { return __name##Alloc::allocate(__n); } \ - void __name##_deallocate(_Tp *__p, size_t __n) \ - { __name##Alloc::deallocate(__p, __n); } - __ROPE_DEFINE_ALLOCS(_Allocator); -# undef __ROPE_DEFINE_ALLOC -}; - -template <class _CharT, class _Alloc> -struct _Rope_rep_base - : public _Rope_rep_alloc_base<_CharT,_Alloc, - _Alloc_traits<_CharT,_Alloc>::_S_instanceless> -{ - typedef _Rope_rep_alloc_base<_CharT,_Alloc, - _Alloc_traits<_CharT,_Alloc>::_S_instanceless> - _Base; - typedef typename _Base::allocator_type allocator_type; - _Rope_rep_base(size_t __size, const allocator_type& __a) - : _Base(__size, __a) {} -}; - - -template<class _CharT, class _Alloc> -struct _Rope_RopeRep : public _Rope_rep_base<_CharT,_Alloc> -# ifndef __GC - , _Refcount_Base -# endif -{ - public: - enum { _S_max_rope_depth = 45 }; - enum _Tag {_S_leaf, _S_concat, _S_substringfn, _S_function}; - _Tag _M_tag:8; - bool _M_is_balanced:8; - unsigned char _M_depth; - __GC_CONST _CharT* _M_c_string; - /* Flattened version of string, if needed. */ - /* typically 0. */ - /* If it's not 0, then the memory is owned */ - /* by this node. */ - /* In the case of a leaf, this may point to */ - /* the same memory as the data field. */ - typedef typename _Rope_rep_base<_CharT,_Alloc>::allocator_type - allocator_type; - _Rope_RopeRep(_Tag __t, int __d, bool __b, size_t __size, - allocator_type __a) - : _Rope_rep_base<_CharT,_Alloc>(__size, __a), -# ifndef __GC - _Refcount_Base(1), -# endif - _M_tag(__t), _M_is_balanced(__b), _M_depth(__d), _M_c_string(0) - { } -# ifdef __GC - void _M_incr () {} -# endif - static void _S_free_string(__GC_CONST _CharT*, size_t __len, - allocator_type __a); -# define __STL_FREE_STRING(__s, __l, __a) _S_free_string(__s, __l, __a); - // Deallocate data section of a leaf. - // This shouldn't be a member function. - // But its hard to do anything else at the - // moment, because it's templatized w.r.t. - // an allocator. - // Does nothing if __GC is defined. -# ifndef __GC - void _M_free_c_string(); - void _M_free_tree(); - // Deallocate t. Assumes t is not 0. - void _M_unref_nonnil() - { - if (0 == _M_decr()) _M_free_tree(); - } - void _M_ref_nonnil() - { - _M_incr(); - } - static void _S_unref(_Rope_RopeRep* __t) - { - if (0 != __t) { - __t->_M_unref_nonnil(); - } - } - static void _S_ref(_Rope_RopeRep* __t) - { - if (0 != __t) __t->_M_incr(); - } - static void _S_free_if_unref(_Rope_RopeRep* __t) - { - if (0 != __t && 0 == __t->_M_ref_count) __t->_M_free_tree(); - } -# else /* __GC */ - void _M_unref_nonnil() {} - void _M_ref_nonnil() {} - static void _S_unref(_Rope_RopeRep*) {} - static void _S_ref(_Rope_RopeRep*) {} - static void _S_free_if_unref(_Rope_RopeRep*) {} -# endif - -}; - -template<class _CharT, class _Alloc> -struct _Rope_RopeLeaf : public _Rope_RopeRep<_CharT,_Alloc> { - public: - // Apparently needed by VC++ - // The data fields of leaves are allocated with some - // extra space, to accommodate future growth and for basic - // character types, to hold a trailing eos character. - enum { _S_alloc_granularity = 8 }; - static size_t _S_rounded_up_size(size_t __n) { - size_t __size_with_eos; - - if (_S_is_basic_char_type((_CharT*)0)) { - __size_with_eos = __n + 1; - } else { - __size_with_eos = __n; - } -# ifdef __GC - return __size_with_eos; -# else - // Allow slop for in-place expansion. - return (__size_with_eos + _S_alloc_granularity-1) - &~ (_S_alloc_granularity-1); -# endif - } - __GC_CONST _CharT* _M_data; /* Not necessarily 0 terminated. */ - /* The allocated size is */ - /* _S_rounded_up_size(size), except */ - /* in the GC case, in which it */ - /* doesn't matter. */ - typedef typename _Rope_rep_base<_CharT,_Alloc>::allocator_type - allocator_type; - _Rope_RopeLeaf(__GC_CONST _CharT* __d, size_t __size, allocator_type __a) - : _Rope_RopeRep<_CharT,_Alloc>(_S_leaf, 0, true, __size, __a), - _M_data(__d) - { - if (_S_is_basic_char_type((_CharT *)0)) { - // already eos terminated. - _M_c_string = __d; - } - } - // The constructor assumes that d has been allocated with - // the proper allocator and the properly padded size. - // In contrast, the destructor deallocates the data: -# ifndef __GC - ~_Rope_RopeLeaf() { - if (_M_data != _M_c_string) { - _M_free_c_string(); - } - __STL_FREE_STRING(_M_data, _M_size, get_allocator()); - } -# endif -}; - -template<class _CharT, class _Alloc> -struct _Rope_RopeConcatenation : public _Rope_RopeRep<_CharT,_Alloc> { - public: - _Rope_RopeRep<_CharT,_Alloc>* _M_left; - _Rope_RopeRep<_CharT,_Alloc>* _M_right; - typedef typename _Rope_rep_base<_CharT,_Alloc>::allocator_type - allocator_type; - _Rope_RopeConcatenation(_Rope_RopeRep<_CharT,_Alloc>* __l, - _Rope_RopeRep<_CharT,_Alloc>* __r, - allocator_type __a) - - : _Rope_RopeRep<_CharT,_Alloc>(_S_concat, - std::max(__l->_M_depth, __r->_M_depth) + 1, - false, - __l->_M_size + __r->_M_size, __a), - _M_left(__l), _M_right(__r) - {} -# ifndef __GC - ~_Rope_RopeConcatenation() { - _M_free_c_string(); - _M_left->_M_unref_nonnil(); - _M_right->_M_unref_nonnil(); - } -# endif -}; - -template<class _CharT, class _Alloc> -struct _Rope_RopeFunction : public _Rope_RopeRep<_CharT,_Alloc> { - public: - char_producer<_CharT>* _M_fn; -# ifndef __GC - bool _M_delete_when_done; // Char_producer is owned by the - // rope and should be explicitly - // deleted when the rope becomes - // inaccessible. -# else - // In the GC case, we either register the rope for - // finalization, or not. Thus the field is unnecessary; - // the information is stored in the collector data structures. - // We do need a finalization procedure to be invoked by the - // collector. - static void _S_fn_finalization_proc(void * __tree, void *) { - delete ((_Rope_RopeFunction *)__tree) -> _M_fn; - } -# endif - typedef typename _Rope_rep_base<_CharT,_Alloc>::allocator_type - allocator_type; - _Rope_RopeFunction(char_producer<_CharT>* __f, size_t __size, - bool __d, allocator_type __a) - : _Rope_RopeRep<_CharT,_Alloc>(_S_function, 0, true, __size, __a) - , _M_fn(__f) -# ifndef __GC - , _M_delete_when_done(__d) -# endif - { -# ifdef __GC - if (__d) { - GC_REGISTER_FINALIZER( - this, _Rope_RopeFunction::_S_fn_finalization_proc, 0, 0, 0); - } -# endif - } -# ifndef __GC - ~_Rope_RopeFunction() { - _M_free_c_string(); - if (_M_delete_when_done) { - delete _M_fn; - } - } -# endif -}; -// Substring results are usually represented using just -// concatenation nodes. But in the case of very long flat ropes -// or ropes with a functional representation that isn't practical. -// In that case, we represent the __result as a special case of -// RopeFunction, whose char_producer points back to the rope itself. -// In all cases except repeated substring operations and -// deallocation, we treat the __result as a RopeFunction. -template<class _CharT, class _Alloc> -struct _Rope_RopeSubstring : public _Rope_RopeFunction<_CharT,_Alloc>, - public char_producer<_CharT> { - public: - // XXX this whole class should be rewritten. - _Rope_RopeRep<_CharT,_Alloc>* _M_base; // not 0 - size_t _M_start; - virtual void operator()(size_t __start_pos, size_t __req_len, - _CharT* __buffer) { - switch(_M_base->_M_tag) { - case _S_function: - case _S_substringfn: - { - char_producer<_CharT>* __fn = - ((_Rope_RopeFunction<_CharT,_Alloc>*)_M_base)->_M_fn; - (*__fn)(__start_pos + _M_start, __req_len, __buffer); - } - break; - case _S_leaf: - { - __GC_CONST _CharT* __s = - ((_Rope_RopeLeaf<_CharT,_Alloc>*)_M_base)->_M_data; - uninitialized_copy_n(__s + __start_pos + _M_start, __req_len, - __buffer); - } - break; - default: - break; - } - } - typedef typename _Rope_rep_base<_CharT,_Alloc>::allocator_type - allocator_type; - _Rope_RopeSubstring(_Rope_RopeRep<_CharT,_Alloc>* __b, size_t __s, - size_t __l, allocator_type __a) - : _Rope_RopeFunction<_CharT,_Alloc>(this, __l, false, __a), - char_producer<_CharT>(), - _M_base(__b), - _M_start(__s) - { -# ifndef __GC - _M_base->_M_ref_nonnil(); -# endif - _M_tag = _S_substringfn; - } - virtual ~_Rope_RopeSubstring() - { -# ifndef __GC - _M_base->_M_unref_nonnil(); - // _M_free_c_string(); -- done by parent class -# endif - } -}; - - -// Self-destructing pointers to Rope_rep. -// These are not conventional smart pointers. Their -// only purpose in life is to ensure that unref is called -// on the pointer either at normal exit or if an exception -// is raised. It is the caller's responsibility to -// adjust reference counts when these pointers are initialized -// or assigned to. (This convention significantly reduces -// the number of potentially expensive reference count -// updates.) -#ifndef __GC - template<class _CharT, class _Alloc> - struct _Rope_self_destruct_ptr { - _Rope_RopeRep<_CharT,_Alloc>* _M_ptr; - ~_Rope_self_destruct_ptr() - { _Rope_RopeRep<_CharT,_Alloc>::_S_unref(_M_ptr); } -#ifdef __EXCEPTIONS - _Rope_self_destruct_ptr() : _M_ptr(0) {}; -#else - _Rope_self_destruct_ptr() {}; -#endif - _Rope_self_destruct_ptr(_Rope_RopeRep<_CharT,_Alloc>* __p) : _M_ptr(__p) {} - _Rope_RopeRep<_CharT,_Alloc>& operator*() { return *_M_ptr; } - _Rope_RopeRep<_CharT,_Alloc>* operator->() { return _M_ptr; } - operator _Rope_RopeRep<_CharT,_Alloc>*() { return _M_ptr; } - _Rope_self_destruct_ptr& operator= (_Rope_RopeRep<_CharT,_Alloc>* __x) - { _M_ptr = __x; return *this; } - }; -#endif - -// Dereferencing a nonconst iterator has to return something -// that behaves almost like a reference. It's not possible to -// return an actual reference since assignment requires extra -// work. And we would get into the same problems as with the -// CD2 version of basic_string. -template<class _CharT, class _Alloc> -class _Rope_char_ref_proxy { - friend class rope<_CharT,_Alloc>; - friend class _Rope_iterator<_CharT,_Alloc>; - friend class _Rope_char_ptr_proxy<_CharT,_Alloc>; -# ifdef __GC - typedef _Rope_RopeRep<_CharT,_Alloc>* _Self_destruct_ptr; -# else - typedef _Rope_self_destruct_ptr<_CharT,_Alloc> _Self_destruct_ptr; -# endif - typedef _Rope_RopeRep<_CharT,_Alloc> _RopeRep; - typedef rope<_CharT,_Alloc> _My_rope; - size_t _M_pos; - _CharT _M_current; - bool _M_current_valid; - _My_rope* _M_root; // The whole rope. - public: - _Rope_char_ref_proxy(_My_rope* __r, size_t __p) - : _M_pos(__p), _M_current_valid(false), _M_root(__r) {} - _Rope_char_ref_proxy(const _Rope_char_ref_proxy& __x) - : _M_pos(__x._M_pos), _M_current_valid(false), _M_root(__x._M_root) {} - // Don't preserve cache if the reference can outlive the - // expression. We claim that's not possible without calling - // a copy constructor or generating reference to a proxy - // reference. We declare the latter to have undefined semantics. - _Rope_char_ref_proxy(_My_rope* __r, size_t __p, _CharT __c) - : _M_pos(__p), _M_current(__c), _M_current_valid(true), _M_root(__r) {} - inline operator _CharT () const; - _Rope_char_ref_proxy& operator= (_CharT __c); - _Rope_char_ptr_proxy<_CharT,_Alloc> operator& () const; - _Rope_char_ref_proxy& operator= (const _Rope_char_ref_proxy& __c) { - return operator=((_CharT)__c); - } -}; - -template<class _CharT, class __Alloc> -inline void swap(_Rope_char_ref_proxy <_CharT, __Alloc > __a, - _Rope_char_ref_proxy <_CharT, __Alloc > __b) { - _CharT __tmp = __a; - __a = __b; - __b = __tmp; -} - -template<class _CharT, class _Alloc> -class _Rope_char_ptr_proxy { - // XXX this class should be rewritten. - friend class _Rope_char_ref_proxy<_CharT,_Alloc>; - size_t _M_pos; - rope<_CharT,_Alloc>* _M_root; // The whole rope. - public: - _Rope_char_ptr_proxy(const _Rope_char_ref_proxy<_CharT,_Alloc>& __x) - : _M_pos(__x._M_pos), _M_root(__x._M_root) {} - _Rope_char_ptr_proxy(const _Rope_char_ptr_proxy& __x) - : _M_pos(__x._M_pos), _M_root(__x._M_root) {} - _Rope_char_ptr_proxy() {} - _Rope_char_ptr_proxy(_CharT* __x) : _M_root(0), _M_pos(0) { - } - _Rope_char_ptr_proxy& - operator= (const _Rope_char_ptr_proxy& __x) { - _M_pos = __x._M_pos; - _M_root = __x._M_root; - return *this; - } - template<class _CharT2, class _Alloc2> - friend bool operator== (const _Rope_char_ptr_proxy<_CharT2,_Alloc2>& __x, - const _Rope_char_ptr_proxy<_CharT2,_Alloc2>& __y); - _Rope_char_ref_proxy<_CharT,_Alloc> operator*() const { - return _Rope_char_ref_proxy<_CharT,_Alloc>(_M_root, _M_pos); - } -}; - - -// Rope iterators: -// Unlike in the C version, we cache only part of the stack -// for rope iterators, since they must be efficiently copyable. -// When we run out of cache, we have to reconstruct the iterator -// value. -// Pointers from iterators are not included in reference counts. -// Iterators are assumed to be thread private. Ropes can -// be shared. - -template<class _CharT, class _Alloc> -class _Rope_iterator_base - : public iterator<std::random_access_iterator_tag, _CharT> -{ - friend class rope<_CharT,_Alloc>; - public: - typedef _Alloc _allocator_type; // used in _Rope_rotate, VC++ workaround - typedef _Rope_RopeRep<_CharT,_Alloc> _RopeRep; - // Borland doesn't want this to be protected. - protected: - enum { _S_path_cache_len = 4 }; // Must be <= 9. - enum { _S_iterator_buf_len = 15 }; - size_t _M_current_pos; - _RopeRep* _M_root; // The whole rope. - size_t _M_leaf_pos; // Starting position for current leaf - __GC_CONST _CharT* _M_buf_start; - // Buffer possibly - // containing current char. - __GC_CONST _CharT* _M_buf_ptr; - // Pointer to current char in buffer. - // != 0 ==> buffer valid. - __GC_CONST _CharT* _M_buf_end; - // One past __last valid char in buffer. - // What follows is the path cache. We go out of our - // way to make this compact. - // Path_end contains the bottom section of the path from - // the root to the current leaf. - const _RopeRep* _M_path_end[_S_path_cache_len]; - int _M_leaf_index; // Last valid __pos in path_end; - // _M_path_end[0] ... _M_path_end[leaf_index-1] - // point to concatenation nodes. - unsigned char _M_path_directions; - // (path_directions >> __i) & 1 is 1 - // iff we got from _M_path_end[leaf_index - __i - 1] - // to _M_path_end[leaf_index - __i] by going to the - // __right. Assumes path_cache_len <= 9. - _CharT _M_tmp_buf[_S_iterator_buf_len]; - // Short buffer for surrounding chars. - // This is useful primarily for - // RopeFunctions. We put the buffer - // here to avoid locking in the - // multithreaded case. - // The cached path is generally assumed to be valid - // only if the buffer is valid. - static void _S_setbuf(_Rope_iterator_base& __x); - // Set buffer contents given - // path cache. - static void _S_setcache(_Rope_iterator_base& __x); - // Set buffer contents and - // path cache. - static void _S_setcache_for_incr(_Rope_iterator_base& __x); - // As above, but assumes path - // cache is valid for previous posn. - _Rope_iterator_base() {} - _Rope_iterator_base(_RopeRep* __root, size_t __pos) - : _M_current_pos(__pos), _M_root(__root), _M_buf_ptr(0) {} - void _M_incr(size_t __n); - void _M_decr(size_t __n); - public: - size_t index() const { return _M_current_pos; } - _Rope_iterator_base(const _Rope_iterator_base& __x) { - if (0 != __x._M_buf_ptr) { - *this = __x; - } else { - _M_current_pos = __x._M_current_pos; - _M_root = __x._M_root; - _M_buf_ptr = 0; - } - } -}; - -template<class _CharT, class _Alloc> class _Rope_iterator; - -template<class _CharT, class _Alloc> -class _Rope_const_iterator : public _Rope_iterator_base<_CharT,_Alloc> { - friend class rope<_CharT,_Alloc>; - protected: - typedef _Rope_RopeRep<_CharT,_Alloc> _RopeRep; - // The one from the base class may not be directly visible. - _Rope_const_iterator(const _RopeRep* __root, size_t __pos): - _Rope_iterator_base<_CharT,_Alloc>( - const_cast<_RopeRep*>(__root), __pos) - // Only nonconst iterators modify root ref count - {} - public: - typedef _CharT reference; // Really a value. Returning a reference - // Would be a mess, since it would have - // to be included in refcount. - typedef const _CharT* pointer; - - public: - _Rope_const_iterator() {}; - _Rope_const_iterator(const _Rope_const_iterator& __x) : - _Rope_iterator_base<_CharT,_Alloc>(__x) { } - _Rope_const_iterator(const _Rope_iterator<_CharT,_Alloc>& __x); - _Rope_const_iterator(const rope<_CharT,_Alloc>& __r, size_t __pos) : - _Rope_iterator_base<_CharT,_Alloc>(__r._M_tree_ptr, __pos) {} - _Rope_const_iterator& operator= (const _Rope_const_iterator& __x) { - if (0 != __x._M_buf_ptr) { - *(static_cast<_Rope_iterator_base<_CharT,_Alloc>*>(this)) = __x; - } else { - _M_current_pos = __x._M_current_pos; - _M_root = __x._M_root; - _M_buf_ptr = 0; - } - return(*this); - } - reference operator*() { - if (0 == _M_buf_ptr) _S_setcache(*this); - return *_M_buf_ptr; - } - _Rope_const_iterator& operator++() { - __GC_CONST _CharT* __next; - if (0 != _M_buf_ptr && (__next = _M_buf_ptr + 1) < _M_buf_end) { - _M_buf_ptr = __next; - ++_M_current_pos; - } else { - _M_incr(1); - } - return *this; - } - _Rope_const_iterator& operator+=(ptrdiff_t __n) { - if (__n >= 0) { - _M_incr(__n); - } else { - _M_decr(-__n); - } - return *this; - } - _Rope_const_iterator& operator--() { - _M_decr(1); - return *this; - } - _Rope_const_iterator& operator-=(ptrdiff_t __n) { - if (__n >= 0) { - _M_decr(__n); - } else { - _M_incr(-__n); - } - return *this; - } - _Rope_const_iterator operator++(int) { - size_t __old_pos = _M_current_pos; - _M_incr(1); - return _Rope_const_iterator<_CharT,_Alloc>(_M_root, __old_pos); - // This makes a subsequent dereference expensive. - // Perhaps we should instead copy the iterator - // if it has a valid cache? - } - _Rope_const_iterator operator--(int) { - size_t __old_pos = _M_current_pos; - _M_decr(1); - return _Rope_const_iterator<_CharT,_Alloc>(_M_root, __old_pos); - } - template<class _CharT2, class _Alloc2> - friend _Rope_const_iterator<_CharT2,_Alloc2> operator- - (const _Rope_const_iterator<_CharT2,_Alloc2>& __x, - ptrdiff_t __n); - template<class _CharT2, class _Alloc2> - friend _Rope_const_iterator<_CharT2,_Alloc2> operator+ - (const _Rope_const_iterator<_CharT2,_Alloc2>& __x, - ptrdiff_t __n); - template<class _CharT2, class _Alloc2> - friend _Rope_const_iterator<_CharT2,_Alloc2> operator+ - (ptrdiff_t __n, - const _Rope_const_iterator<_CharT2,_Alloc2>& __x); - reference operator[](size_t __n) { - return rope<_CharT,_Alloc>::_S_fetch(_M_root, _M_current_pos + __n); - } - - template<class _CharT2, class _Alloc2> - friend bool operator== - (const _Rope_const_iterator<_CharT2,_Alloc2>& __x, - const _Rope_const_iterator<_CharT2,_Alloc2>& __y); - template<class _CharT2, class _Alloc2> - friend bool operator< - (const _Rope_const_iterator<_CharT2,_Alloc2>& __x, - const _Rope_const_iterator<_CharT2,_Alloc2>& __y); - template<class _CharT2, class _Alloc2> - friend ptrdiff_t operator- - (const _Rope_const_iterator<_CharT2,_Alloc2>& __x, - const _Rope_const_iterator<_CharT2,_Alloc2>& __y); -}; - -template<class _CharT, class _Alloc> -class _Rope_iterator : public _Rope_iterator_base<_CharT,_Alloc> { - friend class rope<_CharT,_Alloc>; - protected: - typedef typename _Rope_iterator_base<_CharT,_Alloc>::_RopeRep _RopeRep; - rope<_CharT,_Alloc>* _M_root_rope; - // root is treated as a cached version of this, - // and is used to detect changes to the underlying - // rope. - // Root is included in the reference count. - // This is necessary so that we can detect changes reliably. - // Unfortunately, it requires careful bookkeeping for the - // nonGC case. - _Rope_iterator(rope<_CharT,_Alloc>* __r, size_t __pos) - : _Rope_iterator_base<_CharT,_Alloc>(__r->_M_tree_ptr, __pos), - _M_root_rope(__r) - { _RopeRep::_S_ref(_M_root); if (!(__r -> empty()))_S_setcache(*this); } - - void _M_check(); - public: - typedef _Rope_char_ref_proxy<_CharT,_Alloc> reference; - typedef _Rope_char_ref_proxy<_CharT,_Alloc>* pointer; - - public: - rope<_CharT,_Alloc>& container() { return *_M_root_rope; } - _Rope_iterator() { - _M_root = 0; // Needed for reference counting. - }; - _Rope_iterator(const _Rope_iterator& __x) : - _Rope_iterator_base<_CharT,_Alloc>(__x) { - _M_root_rope = __x._M_root_rope; - _RopeRep::_S_ref(_M_root); - } - _Rope_iterator(rope<_CharT,_Alloc>& __r, size_t __pos); - ~_Rope_iterator() { - _RopeRep::_S_unref(_M_root); - } - _Rope_iterator& operator= (const _Rope_iterator& __x) { - _RopeRep* __old = _M_root; - - _RopeRep::_S_ref(__x._M_root); - if (0 != __x._M_buf_ptr) { - _M_root_rope = __x._M_root_rope; - *(static_cast<_Rope_iterator_base<_CharT,_Alloc>*>(this)) = __x; - } else { - _M_current_pos = __x._M_current_pos; - _M_root = __x._M_root; - _M_root_rope = __x._M_root_rope; - _M_buf_ptr = 0; - } - _RopeRep::_S_unref(__old); - return(*this); - } - reference operator*() { - _M_check(); - if (0 == _M_buf_ptr) { - return _Rope_char_ref_proxy<_CharT,_Alloc>( - _M_root_rope, _M_current_pos); - } else { - return _Rope_char_ref_proxy<_CharT,_Alloc>( - _M_root_rope, _M_current_pos, *_M_buf_ptr); - } - } - _Rope_iterator& operator++() { - _M_incr(1); - return *this; - } - _Rope_iterator& operator+=(ptrdiff_t __n) { - if (__n >= 0) { - _M_incr(__n); - } else { - _M_decr(-__n); - } - return *this; - } - _Rope_iterator& operator--() { - _M_decr(1); - return *this; - } - _Rope_iterator& operator-=(ptrdiff_t __n) { - if (__n >= 0) { - _M_decr(__n); - } else { - _M_incr(-__n); - } - return *this; - } - _Rope_iterator operator++(int) { - size_t __old_pos = _M_current_pos; - _M_incr(1); - return _Rope_iterator<_CharT,_Alloc>(_M_root_rope, __old_pos); - } - _Rope_iterator operator--(int) { - size_t __old_pos = _M_current_pos; - _M_decr(1); - return _Rope_iterator<_CharT,_Alloc>(_M_root_rope, __old_pos); - } - reference operator[](ptrdiff_t __n) { - return _Rope_char_ref_proxy<_CharT,_Alloc>( - _M_root_rope, _M_current_pos + __n); - } - - template<class _CharT2, class _Alloc2> - friend bool operator== - (const _Rope_iterator<_CharT2,_Alloc2>& __x, - const _Rope_iterator<_CharT2,_Alloc2>& __y); - template<class _CharT2, class _Alloc2> - friend bool operator< - (const _Rope_iterator<_CharT2,_Alloc2>& __x, - const _Rope_iterator<_CharT2,_Alloc2>& __y); - template<class _CharT2, class _Alloc2> - friend ptrdiff_t operator- - (const _Rope_iterator<_CharT2,_Alloc2>& __x, - const _Rope_iterator<_CharT2,_Alloc2>& __y); - template<class _CharT2, class _Alloc2> - friend _Rope_iterator<_CharT2,_Alloc2> operator- - (const _Rope_iterator<_CharT2,_Alloc2>& __x, - ptrdiff_t __n); - template<class _CharT2, class _Alloc2> - friend _Rope_iterator<_CharT2,_Alloc2> operator+ - (const _Rope_iterator<_CharT2,_Alloc2>& __x, - ptrdiff_t __n); - template<class _CharT2, class _Alloc2> - friend _Rope_iterator<_CharT2,_Alloc2> operator+ - (ptrdiff_t __n, - const _Rope_iterator<_CharT2,_Alloc2>& __x); -}; - -// The rope base class encapsulates -// the differences between SGI-style allocators and standard-conforming -// allocators. - -// Base class for ordinary allocators. -template <class _CharT, class _Allocator, bool _IsStatic> -class _Rope_alloc_base { -public: - typedef _Rope_RopeRep<_CharT,_Allocator> _RopeRep; - typedef typename _Alloc_traits<_CharT,_Allocator>::allocator_type - allocator_type; - allocator_type get_allocator() const { return _M_data_allocator; } - _Rope_alloc_base(_RopeRep *__t, const allocator_type& __a) - : _M_tree_ptr(__t), _M_data_allocator(__a) {} - _Rope_alloc_base(const allocator_type& __a) - : _M_data_allocator(__a) {} - -protected: - // The only data members of a rope: - allocator_type _M_data_allocator; - _RopeRep* _M_tree_ptr; - -# define __ROPE_DEFINE_ALLOC(_Tp, __name) \ - typedef typename \ - _Alloc_traits<_Tp,_Allocator>::allocator_type __name##Allocator; \ - _Tp* __name##_allocate(size_t __n) const \ - { return __name##Allocator(_M_data_allocator).allocate(__n); } \ - void __name##_deallocate(_Tp *__p, size_t __n) const \ - { __name##Allocator(_M_data_allocator).deallocate(__p, __n); } - __ROPE_DEFINE_ALLOCS(_Allocator) -# undef __ROPE_DEFINE_ALLOC -}; - -// Specialization for allocators that have the property that we don't -// actually have to store an allocator object. -template <class _CharT, class _Allocator> -class _Rope_alloc_base<_CharT,_Allocator,true> { -public: - typedef _Rope_RopeRep<_CharT,_Allocator> _RopeRep; - typedef typename _Alloc_traits<_CharT,_Allocator>::allocator_type - allocator_type; - allocator_type get_allocator() const { return allocator_type(); } - _Rope_alloc_base(_RopeRep *__t, const allocator_type&) - : _M_tree_ptr(__t) {} - _Rope_alloc_base(const allocator_type&) {} - -protected: - // The only data member of a rope: - _RopeRep *_M_tree_ptr; - -# define __ROPE_DEFINE_ALLOC(_Tp, __name) \ - typedef typename \ - _Alloc_traits<_Tp,_Allocator>::_Alloc_type __name##Alloc; \ - typedef typename \ - _Alloc_traits<_Tp,_Allocator>::allocator_type __name##Allocator; \ - static _Tp* __name##_allocate(size_t __n) \ - { return __name##Alloc::allocate(__n); } \ - static void __name##_deallocate(_Tp *__p, size_t __n) \ - { __name##Alloc::deallocate(__p, __n); } - __ROPE_DEFINE_ALLOCS(_Allocator) -# undef __ROPE_DEFINE_ALLOC -}; - -template <class _CharT, class _Alloc> -struct _Rope_base - : public _Rope_alloc_base<_CharT,_Alloc, - _Alloc_traits<_CharT,_Alloc>::_S_instanceless> -{ - typedef _Rope_alloc_base<_CharT,_Alloc, - _Alloc_traits<_CharT,_Alloc>::_S_instanceless> - _Base; - typedef typename _Base::allocator_type allocator_type; - typedef _Rope_RopeRep<_CharT,_Alloc> _RopeRep; - // The one in _Base may not be visible due to template rules. - _Rope_base(_RopeRep* __t, const allocator_type& __a) : _Base(__t, __a) {} - _Rope_base(const allocator_type& __a) : _Base(__a) {} -}; - - -/** - * This is an SGI extension. - * @ingroup SGIextensions - * @doctodo -*/ -template <class _CharT, class _Alloc> -class rope : public _Rope_base<_CharT,_Alloc> { - public: - typedef _CharT value_type; - typedef ptrdiff_t difference_type; - typedef size_t size_type; - typedef _CharT const_reference; - typedef const _CharT* const_pointer; - typedef _Rope_iterator<_CharT,_Alloc> iterator; - typedef _Rope_const_iterator<_CharT,_Alloc> const_iterator; - typedef _Rope_char_ref_proxy<_CharT,_Alloc> reference; - typedef _Rope_char_ptr_proxy<_CharT,_Alloc> pointer; - - friend class _Rope_iterator<_CharT,_Alloc>; - friend class _Rope_const_iterator<_CharT,_Alloc>; - friend struct _Rope_RopeRep<_CharT,_Alloc>; - friend class _Rope_iterator_base<_CharT,_Alloc>; - friend class _Rope_char_ptr_proxy<_CharT,_Alloc>; - friend class _Rope_char_ref_proxy<_CharT,_Alloc>; - friend struct _Rope_RopeSubstring<_CharT,_Alloc>; - - protected: - typedef _Rope_base<_CharT,_Alloc> _Base; - typedef typename _Base::allocator_type allocator_type; - using _Base::_M_tree_ptr; - typedef __GC_CONST _CharT* _Cstrptr; - - static _CharT _S_empty_c_str[1]; - - static bool _S_is0(_CharT __c) { return __c == _S_eos((_CharT*)0); } - enum { _S_copy_max = 23 }; - // For strings shorter than _S_copy_max, we copy to - // concatenate. - - typedef _Rope_RopeRep<_CharT,_Alloc> _RopeRep; - typedef _Rope_RopeConcatenation<_CharT,_Alloc> _RopeConcatenation; - typedef _Rope_RopeLeaf<_CharT,_Alloc> _RopeLeaf; - typedef _Rope_RopeFunction<_CharT,_Alloc> _RopeFunction; - typedef _Rope_RopeSubstring<_CharT,_Alloc> _RopeSubstring; - - // Retrieve a character at the indicated position. - static _CharT _S_fetch(_RopeRep* __r, size_type __pos); - -# ifndef __GC - // Obtain a pointer to the character at the indicated position. - // The pointer can be used to change the character. - // If such a pointer cannot be produced, as is frequently the - // case, 0 is returned instead. - // (Returns nonzero only if all nodes in the path have a refcount - // of 1.) - static _CharT* _S_fetch_ptr(_RopeRep* __r, size_type __pos); -# endif - - static bool _S_apply_to_pieces( - // should be template parameter - _Rope_char_consumer<_CharT>& __c, - const _RopeRep* __r, - size_t __begin, size_t __end); - // begin and end are assumed to be in range. - -# ifndef __GC - static void _S_unref(_RopeRep* __t) - { - _RopeRep::_S_unref(__t); - } - static void _S_ref(_RopeRep* __t) - { - _RopeRep::_S_ref(__t); - } -# else /* __GC */ - static void _S_unref(_RopeRep*) {} - static void _S_ref(_RopeRep*) {} -# endif - - -# ifdef __GC - typedef _Rope_RopeRep<_CharT,_Alloc>* _Self_destruct_ptr; -# else - typedef _Rope_self_destruct_ptr<_CharT,_Alloc> _Self_destruct_ptr; -# endif - - // _Result is counted in refcount. - static _RopeRep* _S_substring(_RopeRep* __base, - size_t __start, size_t __endp1); - - static _RopeRep* _S_concat_char_iter(_RopeRep* __r, - const _CharT* __iter, size_t __slen); - // Concatenate rope and char ptr, copying __s. - // Should really take an arbitrary iterator. - // Result is counted in refcount. - static _RopeRep* _S_destr_concat_char_iter(_RopeRep* __r, - const _CharT* __iter, size_t __slen) - // As above, but one reference to __r is about to be - // destroyed. Thus the pieces may be recycled if all - // relevant reference counts are 1. -# ifdef __GC - // We can't really do anything since refcounts are unavailable. - { return _S_concat_char_iter(__r, __iter, __slen); } -# else - ; -# endif - - static _RopeRep* _S_concat(_RopeRep* __left, _RopeRep* __right); - // General concatenation on _RopeRep. _Result - // has refcount of 1. Adjusts argument refcounts. - - public: - void apply_to_pieces( size_t __begin, size_t __end, - _Rope_char_consumer<_CharT>& __c) const { - _S_apply_to_pieces(__c, _M_tree_ptr, __begin, __end); - } - - - protected: - - static size_t _S_rounded_up_size(size_t __n) { - return _RopeLeaf::_S_rounded_up_size(__n); - } - - static size_t _S_allocated_capacity(size_t __n) { - if (_S_is_basic_char_type((_CharT*)0)) { - return _S_rounded_up_size(__n) - 1; - } else { - return _S_rounded_up_size(__n); - } - } - - // Allocate and construct a RopeLeaf using the supplied allocator - // Takes ownership of s instead of copying. - static _RopeLeaf* _S_new_RopeLeaf(__GC_CONST _CharT *__s, - size_t __size, allocator_type __a) - { - _RopeLeaf* __space = typename _Base::_LAllocator(__a).allocate(1); - return new(__space) _RopeLeaf(__s, __size, __a); - } - - static _RopeConcatenation* _S_new_RopeConcatenation( - _RopeRep* __left, _RopeRep* __right, - allocator_type __a) - { - _RopeConcatenation* __space = typename _Base::_CAllocator(__a).allocate(1); - return new(__space) _RopeConcatenation(__left, __right, __a); - } - - static _RopeFunction* _S_new_RopeFunction(char_producer<_CharT>* __f, - size_t __size, bool __d, allocator_type __a) - { - _RopeFunction* __space = typename _Base::_FAllocator(__a).allocate(1); - return new(__space) _RopeFunction(__f, __size, __d, __a); - } - - static _RopeSubstring* _S_new_RopeSubstring( - _Rope_RopeRep<_CharT,_Alloc>* __b, size_t __s, - size_t __l, allocator_type __a) - { - _RopeSubstring* __space = typename _Base::_SAllocator(__a).allocate(1); - return new(__space) _RopeSubstring(__b, __s, __l, __a); - } - - static - _RopeLeaf* _S_RopeLeaf_from_unowned_char_ptr(const _CharT *__s, - size_t __size, allocator_type __a) -# define __STL_ROPE_FROM_UNOWNED_CHAR_PTR(__s, __size, __a) \ - _S_RopeLeaf_from_unowned_char_ptr(__s, __size, __a) - { - if (0 == __size) return 0; - _CharT* __buf = __a.allocate(_S_rounded_up_size(__size)); - - uninitialized_copy_n(__s, __size, __buf); - _S_cond_store_eos(__buf[__size]); - try { - return _S_new_RopeLeaf(__buf, __size, __a); - } - catch(...) - { - _RopeRep::__STL_FREE_STRING(__buf, __size, __a); - __throw_exception_again; - } - } - - - // Concatenation of nonempty strings. - // Always builds a concatenation node. - // Rebalances if the result is too deep. - // Result has refcount 1. - // Does not increment left and right ref counts even though - // they are referenced. - static _RopeRep* - _S_tree_concat(_RopeRep* __left, _RopeRep* __right); - - // Concatenation helper functions - static _RopeLeaf* - _S_leaf_concat_char_iter(_RopeLeaf* __r, - const _CharT* __iter, size_t __slen); - // Concatenate by copying leaf. - // should take an arbitrary iterator - // result has refcount 1. -# ifndef __GC - static _RopeLeaf* _S_destr_leaf_concat_char_iter - (_RopeLeaf* __r, const _CharT* __iter, size_t __slen); - // A version that potentially clobbers __r if __r->_M_ref_count == 1. -# endif - - private: - - static size_t _S_char_ptr_len(const _CharT* __s); - // slightly generalized strlen - - rope(_RopeRep* __t, const allocator_type& __a = allocator_type()) - : _Base(__t,__a) { } - - - // Copy __r to the _CharT buffer. - // Returns __buffer + __r->_M_size. - // Assumes that buffer is uninitialized. - static _CharT* _S_flatten(_RopeRep* __r, _CharT* __buffer); - - // Again, with explicit starting position and length. - // Assumes that buffer is uninitialized. - static _CharT* _S_flatten(_RopeRep* __r, - size_t __start, size_t __len, - _CharT* __buffer); - - static const unsigned long - _S_min_len[_RopeRep::_S_max_rope_depth + 1]; - - static bool _S_is_balanced(_RopeRep* __r) - { return (__r->_M_size >= _S_min_len[__r->_M_depth]); } - - static bool _S_is_almost_balanced(_RopeRep* __r) - { return (__r->_M_depth == 0 || - __r->_M_size >= _S_min_len[__r->_M_depth - 1]); } - - static bool _S_is_roughly_balanced(_RopeRep* __r) - { return (__r->_M_depth <= 1 || - __r->_M_size >= _S_min_len[__r->_M_depth - 2]); } - - // Assumes the result is not empty. - static _RopeRep* _S_concat_and_set_balanced(_RopeRep* __left, - _RopeRep* __right) - { - _RopeRep* __result = _S_concat(__left, __right); - if (_S_is_balanced(__result)) __result->_M_is_balanced = true; - return __result; - } - - // The basic rebalancing operation. Logically copies the - // rope. The result has refcount of 1. The client will - // usually decrement the reference count of __r. - // The result is within height 2 of balanced by the above - // definition. - static _RopeRep* _S_balance(_RopeRep* __r); - - // Add all unbalanced subtrees to the forest of balanceed trees. - // Used only by balance. - static void _S_add_to_forest(_RopeRep*__r, _RopeRep** __forest); - - // Add __r to forest, assuming __r is already balanced. - static void _S_add_leaf_to_forest(_RopeRep* __r, _RopeRep** __forest); - - // Print to stdout, exposing structure - static void _S_dump(_RopeRep* __r, int __indent = 0); - - // Return -1, 0, or 1 if __x < __y, __x == __y, or __x > __y resp. - static int _S_compare(const _RopeRep* __x, const _RopeRep* __y); - - public: - bool empty() const { return 0 == _M_tree_ptr; } - - // Comparison member function. This is public only for those - // clients that need a ternary comparison. Others - // should use the comparison operators below. - int compare(const rope& __y) const { - return _S_compare(_M_tree_ptr, __y._M_tree_ptr); - } - - rope(const _CharT* __s, const allocator_type& __a = allocator_type()) - : _Base(__STL_ROPE_FROM_UNOWNED_CHAR_PTR(__s, _S_char_ptr_len(__s), - __a),__a) - { } - - rope(const _CharT* __s, size_t __len, - const allocator_type& __a = allocator_type()) - : _Base(__STL_ROPE_FROM_UNOWNED_CHAR_PTR(__s, __len, __a), __a) - { } - - // Should perhaps be templatized with respect to the iterator type - // and use Sequence_buffer. (It should perhaps use sequence_buffer - // even now.) - rope(const _CharT *__s, const _CharT *__e, - const allocator_type& __a = allocator_type()) - : _Base(__STL_ROPE_FROM_UNOWNED_CHAR_PTR(__s, __e - __s, __a), __a) - { } - - rope(const const_iterator& __s, const const_iterator& __e, - const allocator_type& __a = allocator_type()) - : _Base(_S_substring(__s._M_root, __s._M_current_pos, - __e._M_current_pos), __a) - { } - - rope(const iterator& __s, const iterator& __e, - const allocator_type& __a = allocator_type()) - : _Base(_S_substring(__s._M_root, __s._M_current_pos, - __e._M_current_pos), __a) - { } - - rope(_CharT __c, const allocator_type& __a = allocator_type()) - : _Base(__a) - { - _CharT* __buf = _Data_allocate(_S_rounded_up_size(1)); - - std::_Construct(__buf, __c); - try { - _M_tree_ptr = _S_new_RopeLeaf(__buf, 1, __a); - } - catch(...) - { - _RopeRep::__STL_FREE_STRING(__buf, 1, __a); - __throw_exception_again; - } - } - - rope(size_t __n, _CharT __c, - const allocator_type& __a = allocator_type()); - - rope(const allocator_type& __a = allocator_type()) - : _Base(0, __a) {} - - // Construct a rope from a function that can compute its members - rope(char_producer<_CharT> *__fn, size_t __len, bool __delete_fn, - const allocator_type& __a = allocator_type()) - : _Base(__a) - { - _M_tree_ptr = (0 == __len) ? - 0 : _S_new_RopeFunction(__fn, __len, __delete_fn, __a); - } - - rope(const rope& __x, const allocator_type& __a = allocator_type()) - : _Base(__x._M_tree_ptr, __a) - { - _S_ref(_M_tree_ptr); - } - - ~rope() - { - _S_unref(_M_tree_ptr); - } - - rope& operator=(const rope& __x) - { - _RopeRep* __old = _M_tree_ptr; - _M_tree_ptr = __x._M_tree_ptr; - _S_ref(_M_tree_ptr); - _S_unref(__old); - return(*this); - } - - void clear() - { - _S_unref(_M_tree_ptr); - _M_tree_ptr = 0; - } - - void push_back(_CharT __x) - { - _RopeRep* __old = _M_tree_ptr; - _M_tree_ptr = _S_destr_concat_char_iter(_M_tree_ptr, &__x, 1); - _S_unref(__old); - } - - void pop_back() - { - _RopeRep* __old = _M_tree_ptr; - _M_tree_ptr = - _S_substring(_M_tree_ptr, 0, _M_tree_ptr->_M_size - 1); - _S_unref(__old); - } - - _CharT back() const - { - return _S_fetch(_M_tree_ptr, _M_tree_ptr->_M_size - 1); - } - - void push_front(_CharT __x) - { - _RopeRep* __old = _M_tree_ptr; - _RopeRep* __left = - __STL_ROPE_FROM_UNOWNED_CHAR_PTR(&__x, 1, get_allocator()); - try { - _M_tree_ptr = _S_concat(__left, _M_tree_ptr); - _S_unref(__old); - _S_unref(__left); - } - catch(...) - { - _S_unref(__left); - __throw_exception_again; - } - } - - void pop_front() - { - _RopeRep* __old = _M_tree_ptr; - _M_tree_ptr = _S_substring(_M_tree_ptr, 1, _M_tree_ptr->_M_size); - _S_unref(__old); - } - - _CharT front() const - { - return _S_fetch(_M_tree_ptr, 0); - } - - void balance() - { - _RopeRep* __old = _M_tree_ptr; - _M_tree_ptr = _S_balance(_M_tree_ptr); - _S_unref(__old); - } - - void copy(_CharT* __buffer) const { - _Destroy(__buffer, __buffer + size()); - _S_flatten(_M_tree_ptr, __buffer); - } - - // This is the copy function from the standard, but - // with the arguments reordered to make it consistent with the - // rest of the interface. - // Note that this guaranteed not to compile if the draft standard - // order is assumed. - size_type copy(size_type __pos, size_type __n, _CharT* __buffer) const - { - size_t __size = size(); - size_t __len = (__pos + __n > __size? __size - __pos : __n); - - _Destroy(__buffer, __buffer + __len); - _S_flatten(_M_tree_ptr, __pos, __len, __buffer); - return __len; - } - - // Print to stdout, exposing structure. May be useful for - // performance debugging. - void dump() { - _S_dump(_M_tree_ptr); - } - - // Convert to 0 terminated string in new allocated memory. - // Embedded 0s in the input do not terminate the copy. - const _CharT* c_str() const; - - // As above, but lso use the flattened representation as the - // the new rope representation. - const _CharT* replace_with_c_str(); - - // Reclaim memory for the c_str generated flattened string. - // Intentionally undocumented, since it's hard to say when this - // is safe for multiple threads. - void delete_c_str () { - if (0 == _M_tree_ptr) return; - if (_RopeRep::_S_leaf == _M_tree_ptr->_M_tag && - ((_RopeLeaf*)_M_tree_ptr)->_M_data == - _M_tree_ptr->_M_c_string) { - // Representation shared - return; - } -# ifndef __GC - _M_tree_ptr->_M_free_c_string(); -# endif - _M_tree_ptr->_M_c_string = 0; - } - - _CharT operator[] (size_type __pos) const { - return _S_fetch(_M_tree_ptr, __pos); - } - - _CharT at(size_type __pos) const { - // if (__pos >= size()) throw out_of_range; // XXX - return (*this)[__pos]; - } - - const_iterator begin() const { - return(const_iterator(_M_tree_ptr, 0)); - } - - // An easy way to get a const iterator from a non-const container. - const_iterator const_begin() const { - return(const_iterator(_M_tree_ptr, 0)); - } - - const_iterator end() const { - return(const_iterator(_M_tree_ptr, size())); - } - - const_iterator const_end() const { - return(const_iterator(_M_tree_ptr, size())); - } - - size_type size() const { - return(0 == _M_tree_ptr? 0 : _M_tree_ptr->_M_size); - } - - size_type length() const { - return size(); - } - - size_type max_size() const { - return _S_min_len[_RopeRep::_S_max_rope_depth-1] - 1; - // Guarantees that the result can be sufficirntly - // balanced. Longer ropes will probably still work, - // but it's harder to make guarantees. - } - - typedef reverse_iterator<const_iterator> const_reverse_iterator; - - const_reverse_iterator rbegin() const { - return const_reverse_iterator(end()); - } - - const_reverse_iterator const_rbegin() const { - return const_reverse_iterator(end()); - } - - const_reverse_iterator rend() const { - return const_reverse_iterator(begin()); - } - - const_reverse_iterator const_rend() const { - return const_reverse_iterator(begin()); - } - - template<class _CharT2, class _Alloc2> - friend rope<_CharT2,_Alloc2> - operator+ (const rope<_CharT2,_Alloc2>& __left, - const rope<_CharT2,_Alloc2>& __right); - - template<class _CharT2, class _Alloc2> - friend rope<_CharT2,_Alloc2> - operator+ (const rope<_CharT2,_Alloc2>& __left, - const _CharT2* __right); - - template<class _CharT2, class _Alloc2> - friend rope<_CharT2,_Alloc2> - operator+ (const rope<_CharT2,_Alloc2>& __left, _CharT2 __right); - // The symmetric cases are intentionally omitted, since they're presumed - // to be less common, and we don't handle them as well. - - // The following should really be templatized. - // The first argument should be an input iterator or - // forward iterator with value_type _CharT. - rope& append(const _CharT* __iter, size_t __n) { - _RopeRep* __result = - _S_destr_concat_char_iter(_M_tree_ptr, __iter, __n); - _S_unref(_M_tree_ptr); - _M_tree_ptr = __result; - return *this; - } - - rope& append(const _CharT* __c_string) { - size_t __len = _S_char_ptr_len(__c_string); - append(__c_string, __len); - return(*this); - } - - rope& append(const _CharT* __s, const _CharT* __e) { - _RopeRep* __result = - _S_destr_concat_char_iter(_M_tree_ptr, __s, __e - __s); - _S_unref(_M_tree_ptr); - _M_tree_ptr = __result; - return *this; - } - - rope& append(const_iterator __s, const_iterator __e) { - _Self_destruct_ptr __appendee(_S_substring( - __s._M_root, __s._M_current_pos, __e._M_current_pos)); - _RopeRep* __result = - _S_concat(_M_tree_ptr, (_RopeRep*)__appendee); - _S_unref(_M_tree_ptr); - _M_tree_ptr = __result; - return *this; - } - - rope& append(_CharT __c) { - _RopeRep* __result = - _S_destr_concat_char_iter(_M_tree_ptr, &__c, 1); - _S_unref(_M_tree_ptr); - _M_tree_ptr = __result; - return *this; - } - - rope& append() { return append(_CharT()); } // XXX why? - - rope& append(const rope& __y) { - _RopeRep* __result = _S_concat(_M_tree_ptr, __y._M_tree_ptr); - _S_unref(_M_tree_ptr); - _M_tree_ptr = __result; - return *this; - } - - rope& append(size_t __n, _CharT __c) { - rope<_CharT,_Alloc> __last(__n, __c); - return append(__last); - } - - void swap(rope& __b) { - _RopeRep* __tmp = _M_tree_ptr; - _M_tree_ptr = __b._M_tree_ptr; - __b._M_tree_ptr = __tmp; - } - - - protected: - // Result is included in refcount. - static _RopeRep* replace(_RopeRep* __old, size_t __pos1, - size_t __pos2, _RopeRep* __r) { - if (0 == __old) { _S_ref(__r); return __r; } - _Self_destruct_ptr __left( - _S_substring(__old, 0, __pos1)); - _Self_destruct_ptr __right( - _S_substring(__old, __pos2, __old->_M_size)); - _RopeRep* __result; - - if (0 == __r) { - __result = _S_concat(__left, __right); - } else { - _Self_destruct_ptr __left_result(_S_concat(__left, __r)); - __result = _S_concat(__left_result, __right); - } - return __result; - } - - public: - void insert(size_t __p, const rope& __r) { - _RopeRep* __result = - replace(_M_tree_ptr, __p, __p, __r._M_tree_ptr); - _S_unref(_M_tree_ptr); - _M_tree_ptr = __result; - } - - void insert(size_t __p, size_t __n, _CharT __c) { - rope<_CharT,_Alloc> __r(__n,__c); - insert(__p, __r); - } - - void insert(size_t __p, const _CharT* __i, size_t __n) { - _Self_destruct_ptr __left(_S_substring(_M_tree_ptr, 0, __p)); - _Self_destruct_ptr __right(_S_substring(_M_tree_ptr, __p, size())); - _Self_destruct_ptr __left_result( - _S_concat_char_iter(__left, __i, __n)); - // _S_ destr_concat_char_iter should be safe here. - // But as it stands it's probably not a win, since __left - // is likely to have additional references. - _RopeRep* __result = _S_concat(__left_result, __right); - _S_unref(_M_tree_ptr); - _M_tree_ptr = __result; - } - - void insert(size_t __p, const _CharT* __c_string) { - insert(__p, __c_string, _S_char_ptr_len(__c_string)); - } - - void insert(size_t __p, _CharT __c) { - insert(__p, &__c, 1); - } - - void insert(size_t __p) { - _CharT __c = _CharT(); - insert(__p, &__c, 1); - } - - void insert(size_t __p, const _CharT* __i, const _CharT* __j) { - rope __r(__i, __j); - insert(__p, __r); - } - - void insert(size_t __p, const const_iterator& __i, - const const_iterator& __j) { - rope __r(__i, __j); - insert(__p, __r); - } - - void insert(size_t __p, const iterator& __i, - const iterator& __j) { - rope __r(__i, __j); - insert(__p, __r); - } - - // (position, length) versions of replace operations: - - void replace(size_t __p, size_t __n, const rope& __r) { - _RopeRep* __result = - replace(_M_tree_ptr, __p, __p + __n, __r._M_tree_ptr); - _S_unref(_M_tree_ptr); - _M_tree_ptr = __result; - } - - void replace(size_t __p, size_t __n, - const _CharT* __i, size_t __i_len) { - rope __r(__i, __i_len); - replace(__p, __n, __r); - } - - void replace(size_t __p, size_t __n, _CharT __c) { - rope __r(__c); - replace(__p, __n, __r); - } - - void replace(size_t __p, size_t __n, const _CharT* __c_string) { - rope __r(__c_string); - replace(__p, __n, __r); - } - - void replace(size_t __p, size_t __n, - const _CharT* __i, const _CharT* __j) { - rope __r(__i, __j); - replace(__p, __n, __r); - } - - void replace(size_t __p, size_t __n, - const const_iterator& __i, const const_iterator& __j) { - rope __r(__i, __j); - replace(__p, __n, __r); - } - - void replace(size_t __p, size_t __n, - const iterator& __i, const iterator& __j) { - rope __r(__i, __j); - replace(__p, __n, __r); - } - - // Single character variants: - void replace(size_t __p, _CharT __c) { - iterator __i(this, __p); - *__i = __c; - } - - void replace(size_t __p, const rope& __r) { - replace(__p, 1, __r); - } - - void replace(size_t __p, const _CharT* __i, size_t __i_len) { - replace(__p, 1, __i, __i_len); - } - - void replace(size_t __p, const _CharT* __c_string) { - replace(__p, 1, __c_string); - } - - void replace(size_t __p, const _CharT* __i, const _CharT* __j) { - replace(__p, 1, __i, __j); - } - - void replace(size_t __p, const const_iterator& __i, - const const_iterator& __j) { - replace(__p, 1, __i, __j); - } - - void replace(size_t __p, const iterator& __i, - const iterator& __j) { - replace(__p, 1, __i, __j); - } - - // Erase, (position, size) variant. - void erase(size_t __p, size_t __n) { - _RopeRep* __result = replace(_M_tree_ptr, __p, __p + __n, 0); - _S_unref(_M_tree_ptr); - _M_tree_ptr = __result; - } - - // Erase, single character - void erase(size_t __p) { - erase(__p, __p + 1); - } - - // Insert, iterator variants. - iterator insert(const iterator& __p, const rope& __r) - { insert(__p.index(), __r); return __p; } - iterator insert(const iterator& __p, size_t __n, _CharT __c) - { insert(__p.index(), __n, __c); return __p; } - iterator insert(const iterator& __p, _CharT __c) - { insert(__p.index(), __c); return __p; } - iterator insert(const iterator& __p ) - { insert(__p.index()); return __p; } - iterator insert(const iterator& __p, const _CharT* c_string) - { insert(__p.index(), c_string); return __p; } - iterator insert(const iterator& __p, const _CharT* __i, size_t __n) - { insert(__p.index(), __i, __n); return __p; } - iterator insert(const iterator& __p, const _CharT* __i, - const _CharT* __j) - { insert(__p.index(), __i, __j); return __p; } - iterator insert(const iterator& __p, - const const_iterator& __i, const const_iterator& __j) - { insert(__p.index(), __i, __j); return __p; } - iterator insert(const iterator& __p, - const iterator& __i, const iterator& __j) - { insert(__p.index(), __i, __j); return __p; } - - // Replace, range variants. - void replace(const iterator& __p, const iterator& __q, - const rope& __r) - { replace(__p.index(), __q.index() - __p.index(), __r); } - void replace(const iterator& __p, const iterator& __q, _CharT __c) - { replace(__p.index(), __q.index() - __p.index(), __c); } - void replace(const iterator& __p, const iterator& __q, - const _CharT* __c_string) - { replace(__p.index(), __q.index() - __p.index(), __c_string); } - void replace(const iterator& __p, const iterator& __q, - const _CharT* __i, size_t __n) - { replace(__p.index(), __q.index() - __p.index(), __i, __n); } - void replace(const iterator& __p, const iterator& __q, - const _CharT* __i, const _CharT* __j) - { replace(__p.index(), __q.index() - __p.index(), __i, __j); } - void replace(const iterator& __p, const iterator& __q, - const const_iterator& __i, const const_iterator& __j) - { replace(__p.index(), __q.index() - __p.index(), __i, __j); } - void replace(const iterator& __p, const iterator& __q, - const iterator& __i, const iterator& __j) - { replace(__p.index(), __q.index() - __p.index(), __i, __j); } - - // Replace, iterator variants. - void replace(const iterator& __p, const rope& __r) - { replace(__p.index(), __r); } - void replace(const iterator& __p, _CharT __c) - { replace(__p.index(), __c); } - void replace(const iterator& __p, const _CharT* __c_string) - { replace(__p.index(), __c_string); } - void replace(const iterator& __p, const _CharT* __i, size_t __n) - { replace(__p.index(), __i, __n); } - void replace(const iterator& __p, const _CharT* __i, const _CharT* __j) - { replace(__p.index(), __i, __j); } - void replace(const iterator& __p, const_iterator __i, - const_iterator __j) - { replace(__p.index(), __i, __j); } - void replace(const iterator& __p, iterator __i, iterator __j) - { replace(__p.index(), __i, __j); } - - // Iterator and range variants of erase - iterator erase(const iterator& __p, const iterator& __q) { - size_t __p_index = __p.index(); - erase(__p_index, __q.index() - __p_index); - return iterator(this, __p_index); - } - iterator erase(const iterator& __p) { - size_t __p_index = __p.index(); - erase(__p_index, 1); - return iterator(this, __p_index); - } - - rope substr(size_t __start, size_t __len = 1) const { - return rope<_CharT,_Alloc>( - _S_substring(_M_tree_ptr, __start, __start + __len)); - } - - rope substr(iterator __start, iterator __end) const { - return rope<_CharT,_Alloc>( - _S_substring(_M_tree_ptr, __start.index(), __end.index())); - } - - rope substr(iterator __start) const { - size_t __pos = __start.index(); - return rope<_CharT,_Alloc>( - _S_substring(_M_tree_ptr, __pos, __pos + 1)); - } - - rope substr(const_iterator __start, const_iterator __end) const { - // This might eventually take advantage of the cache in the - // iterator. - return rope<_CharT,_Alloc>( - _S_substring(_M_tree_ptr, __start.index(), __end.index())); - } - - rope<_CharT,_Alloc> substr(const_iterator __start) { - size_t __pos = __start.index(); - return rope<_CharT,_Alloc>( - _S_substring(_M_tree_ptr, __pos, __pos + 1)); - } - - static const size_type npos; - - size_type find(_CharT __c, size_type __pos = 0) const; - size_type find(const _CharT* __s, size_type __pos = 0) const { - size_type __result_pos; - const_iterator __result = - std::search(const_begin() + __pos, const_end(), - __s, __s + _S_char_ptr_len(__s)); - __result_pos = __result.index(); -# ifndef __STL_OLD_ROPE_SEMANTICS - if (__result_pos == size()) __result_pos = npos; -# endif - return __result_pos; - } - - iterator mutable_begin() { - return(iterator(this, 0)); - } - - iterator mutable_end() { - return(iterator(this, size())); - } - - typedef reverse_iterator<iterator> reverse_iterator; - - reverse_iterator mutable_rbegin() { - return reverse_iterator(mutable_end()); - } - - reverse_iterator mutable_rend() { - return reverse_iterator(mutable_begin()); - } - - reference mutable_reference_at(size_type __pos) { - return reference(this, __pos); - } - -# ifdef __STD_STUFF - reference operator[] (size_type __pos) { - return _char_ref_proxy(this, __pos); - } - - reference at(size_type __pos) { - // if (__pos >= size()) throw out_of_range; // XXX - return (*this)[__pos]; - } - - void resize(size_type __n, _CharT __c) {} - void resize(size_type __n) {} - void reserve(size_type __res_arg = 0) {} - size_type capacity() const { - return max_size(); - } - - // Stuff below this line is dangerous because it's error prone. - // I would really like to get rid of it. - // copy function with funny arg ordering. - size_type copy(_CharT* __buffer, size_type __n, - size_type __pos = 0) const { - return copy(__pos, __n, __buffer); - } - - iterator end() { return mutable_end(); } - - iterator begin() { return mutable_begin(); } - - reverse_iterator rend() { return mutable_rend(); } - - reverse_iterator rbegin() { return mutable_rbegin(); } - -# else - - const_iterator end() { return const_end(); } - - const_iterator begin() { return const_begin(); } - - const_reverse_iterator rend() { return const_rend(); } - - const_reverse_iterator rbegin() { return const_rbegin(); } - -# endif - -}; - -template <class _CharT, class _Alloc> -const typename rope<_CharT, _Alloc>::size_type rope<_CharT, _Alloc>::npos = - (size_type)(-1); - -template <class _CharT, class _Alloc> -inline bool operator== (const _Rope_const_iterator<_CharT,_Alloc>& __x, - const _Rope_const_iterator<_CharT,_Alloc>& __y) { - return (__x._M_current_pos == __y._M_current_pos && - __x._M_root == __y._M_root); -} - -template <class _CharT, class _Alloc> -inline bool operator< (const _Rope_const_iterator<_CharT,_Alloc>& __x, - const _Rope_const_iterator<_CharT,_Alloc>& __y) { - return (__x._M_current_pos < __y._M_current_pos); -} - -template <class _CharT, class _Alloc> -inline bool operator!= (const _Rope_const_iterator<_CharT,_Alloc>& __x, - const _Rope_const_iterator<_CharT,_Alloc>& __y) { - return !(__x == __y); -} - -template <class _CharT, class _Alloc> -inline bool operator> (const _Rope_const_iterator<_CharT,_Alloc>& __x, - const _Rope_const_iterator<_CharT,_Alloc>& __y) { - return __y < __x; -} - -template <class _CharT, class _Alloc> -inline bool operator<= (const _Rope_const_iterator<_CharT,_Alloc>& __x, - const _Rope_const_iterator<_CharT,_Alloc>& __y) { - return !(__y < __x); -} - -template <class _CharT, class _Alloc> -inline bool operator>= (const _Rope_const_iterator<_CharT,_Alloc>& __x, - const _Rope_const_iterator<_CharT,_Alloc>& __y) { - return !(__x < __y); -} - -template <class _CharT, class _Alloc> -inline ptrdiff_t operator-(const _Rope_const_iterator<_CharT,_Alloc>& __x, - const _Rope_const_iterator<_CharT,_Alloc>& __y) { - return (ptrdiff_t)__x._M_current_pos - (ptrdiff_t)__y._M_current_pos; -} - -template <class _CharT, class _Alloc> -inline _Rope_const_iterator<_CharT,_Alloc> -operator-(const _Rope_const_iterator<_CharT,_Alloc>& __x, ptrdiff_t __n) { - return _Rope_const_iterator<_CharT,_Alloc>( - __x._M_root, __x._M_current_pos - __n); -} - -template <class _CharT, class _Alloc> -inline _Rope_const_iterator<_CharT,_Alloc> -operator+(const _Rope_const_iterator<_CharT,_Alloc>& __x, ptrdiff_t __n) { - return _Rope_const_iterator<_CharT,_Alloc>( - __x._M_root, __x._M_current_pos + __n); -} - -template <class _CharT, class _Alloc> -inline _Rope_const_iterator<_CharT,_Alloc> -operator+(ptrdiff_t __n, const _Rope_const_iterator<_CharT,_Alloc>& __x) { - return _Rope_const_iterator<_CharT,_Alloc>( - __x._M_root, __x._M_current_pos + __n); -} - -template <class _CharT, class _Alloc> -inline bool operator== (const _Rope_iterator<_CharT,_Alloc>& __x, - const _Rope_iterator<_CharT,_Alloc>& __y) { - return (__x._M_current_pos == __y._M_current_pos && - __x._M_root_rope == __y._M_root_rope); -} - -template <class _CharT, class _Alloc> -inline bool operator< (const _Rope_iterator<_CharT,_Alloc>& __x, - const _Rope_iterator<_CharT,_Alloc>& __y) { - return (__x._M_current_pos < __y._M_current_pos); -} - -template <class _CharT, class _Alloc> -inline bool operator!= (const _Rope_iterator<_CharT,_Alloc>& __x, - const _Rope_iterator<_CharT,_Alloc>& __y) { - return !(__x == __y); -} - -template <class _CharT, class _Alloc> -inline bool operator> (const _Rope_iterator<_CharT,_Alloc>& __x, - const _Rope_iterator<_CharT,_Alloc>& __y) { - return __y < __x; -} - -template <class _CharT, class _Alloc> -inline bool operator<= (const _Rope_iterator<_CharT,_Alloc>& __x, - const _Rope_iterator<_CharT,_Alloc>& __y) { - return !(__y < __x); -} - -template <class _CharT, class _Alloc> -inline bool operator>= (const _Rope_iterator<_CharT,_Alloc>& __x, - const _Rope_iterator<_CharT,_Alloc>& __y) { - return !(__x < __y); -} - -template <class _CharT, class _Alloc> -inline ptrdiff_t operator-(const _Rope_iterator<_CharT,_Alloc>& __x, - const _Rope_iterator<_CharT,_Alloc>& __y) { - return (ptrdiff_t)__x._M_current_pos - (ptrdiff_t)__y._M_current_pos; -} - -template <class _CharT, class _Alloc> -inline _Rope_iterator<_CharT,_Alloc> -operator-(const _Rope_iterator<_CharT,_Alloc>& __x, - ptrdiff_t __n) { - return _Rope_iterator<_CharT,_Alloc>( - __x._M_root_rope, __x._M_current_pos - __n); -} - -template <class _CharT, class _Alloc> -inline _Rope_iterator<_CharT,_Alloc> -operator+(const _Rope_iterator<_CharT,_Alloc>& __x, - ptrdiff_t __n) { - return _Rope_iterator<_CharT,_Alloc>( - __x._M_root_rope, __x._M_current_pos + __n); -} - -template <class _CharT, class _Alloc> -inline _Rope_iterator<_CharT,_Alloc> -operator+(ptrdiff_t __n, const _Rope_iterator<_CharT,_Alloc>& __x) { - return _Rope_iterator<_CharT,_Alloc>( - __x._M_root_rope, __x._M_current_pos + __n); -} - -template <class _CharT, class _Alloc> -inline -rope<_CharT,_Alloc> -operator+ (const rope<_CharT,_Alloc>& __left, - const rope<_CharT,_Alloc>& __right) -{ - return rope<_CharT,_Alloc>( - rope<_CharT,_Alloc>::_S_concat(__left._M_tree_ptr, __right._M_tree_ptr)); - // Inlining this should make it possible to keep __left and - // __right in registers. -} - -template <class _CharT, class _Alloc> -inline -rope<_CharT,_Alloc>& -operator+= (rope<_CharT,_Alloc>& __left, - const rope<_CharT,_Alloc>& __right) -{ - __left.append(__right); - return __left; -} - -template <class _CharT, class _Alloc> -inline -rope<_CharT,_Alloc> -operator+ (const rope<_CharT,_Alloc>& __left, - const _CharT* __right) { - size_t __rlen = rope<_CharT,_Alloc>::_S_char_ptr_len(__right); - return rope<_CharT,_Alloc>( - rope<_CharT,_Alloc>::_S_concat_char_iter( - __left._M_tree_ptr, __right, __rlen)); -} - -template <class _CharT, class _Alloc> -inline -rope<_CharT,_Alloc>& -operator+= (rope<_CharT,_Alloc>& __left, - const _CharT* __right) { - __left.append(__right); - return __left; -} - -template <class _CharT, class _Alloc> -inline -rope<_CharT,_Alloc> -operator+ (const rope<_CharT,_Alloc>& __left, _CharT __right) { - return rope<_CharT,_Alloc>( - rope<_CharT,_Alloc>::_S_concat_char_iter( - __left._M_tree_ptr, &__right, 1)); -} - -template <class _CharT, class _Alloc> -inline -rope<_CharT,_Alloc>& -operator+= (rope<_CharT,_Alloc>& __left, _CharT __right) { - __left.append(__right); - return __left; -} - -template <class _CharT, class _Alloc> -bool -operator< (const rope<_CharT,_Alloc>& __left, - const rope<_CharT,_Alloc>& __right) { - return __left.compare(__right) < 0; -} - -template <class _CharT, class _Alloc> -bool -operator== (const rope<_CharT,_Alloc>& __left, - const rope<_CharT,_Alloc>& __right) { - return __left.compare(__right) == 0; -} - -template <class _CharT, class _Alloc> -inline bool operator== (const _Rope_char_ptr_proxy<_CharT,_Alloc>& __x, - const _Rope_char_ptr_proxy<_CharT,_Alloc>& __y) { - return (__x._M_pos == __y._M_pos && __x._M_root == __y._M_root); -} - -template <class _CharT, class _Alloc> -inline bool -operator!= (const rope<_CharT,_Alloc>& __x, const rope<_CharT,_Alloc>& __y) { - return !(__x == __y); -} - -template <class _CharT, class _Alloc> -inline bool -operator> (const rope<_CharT,_Alloc>& __x, const rope<_CharT,_Alloc>& __y) { - return __y < __x; -} - -template <class _CharT, class _Alloc> -inline bool -operator<= (const rope<_CharT,_Alloc>& __x, const rope<_CharT,_Alloc>& __y) { - return !(__y < __x); -} - -template <class _CharT, class _Alloc> -inline bool -operator>= (const rope<_CharT,_Alloc>& __x, const rope<_CharT,_Alloc>& __y) { - return !(__x < __y); -} - -template <class _CharT, class _Alloc> -inline bool operator!= (const _Rope_char_ptr_proxy<_CharT,_Alloc>& __x, - const _Rope_char_ptr_proxy<_CharT,_Alloc>& __y) { - return !(__x == __y); -} - -template<class _CharT, class _Traits, class _Alloc> -std::basic_ostream<_CharT, _Traits>& operator<< - (std::basic_ostream<_CharT, _Traits>& __o, - const rope<_CharT, _Alloc>& __r); - -typedef rope<char> crope; -typedef rope<wchar_t> wrope; - -inline crope::reference __mutable_reference_at(crope& __c, size_t __i) -{ - return __c.mutable_reference_at(__i); -} - -inline wrope::reference __mutable_reference_at(wrope& __c, size_t __i) -{ - return __c.mutable_reference_at(__i); -} - -template <class _CharT, class _Alloc> -inline void swap(rope<_CharT,_Alloc>& __x, rope<_CharT,_Alloc>& __y) { - __x.swap(__y); -} - -// Hash functions should probably be revisited later: -template<> struct hash<crope> -{ - size_t operator()(const crope& __str) const - { - size_t __size = __str.size(); - - if (0 == __size) return 0; - return 13*__str[0] + 5*__str[__size - 1] + __size; - } -}; - - -template<> struct hash<wrope> -{ - size_t operator()(const wrope& __str) const - { - size_t __size = __str.size(); - - if (0 == __size) return 0; - return 13*__str[0] + 5*__str[__size - 1] + __size; - } -}; - -} // namespace __gnu_cxx - -# include <ext/ropeimpl.h> - -# endif /* __SGI_STL_INTERNAL_ROPE_H */ - -// Local Variables: -// mode:C++ -// End: diff --git a/contrib/libstdc++/libmath/nan.c b/contrib/libstdc++/libmath/nan.c deleted file mode 100644 index 1814b5d..0000000 --- a/contrib/libstdc++/libmath/nan.c +++ /dev/null @@ -1,36 +0,0 @@ -/* Return quiet nan. */ - -/* Copyright (C) 1997, 1998, 1999 Free Software Foundation, Inc. - - This file is part of the GNU ISO C++ Library. This library is free - software; you can redistribute it and/or modify it under the - terms of the GNU General Public License as published by the - Free Software Foundation; either version 2, or (at your option) - any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this library; see the file COPYING. If not, write to the Free - Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, - USA. - - As a special exception, you may use this file as part of a free software - library without restriction. Specifically, if other files instantiate - templates or use macros or inline functions from this file, or you compile - this file and link it with other files to produce an executable, this - file does not by itself cause the resulting executable to be covered by - the GNU General Public License. This exception does not however - invalidate any other reasons why the executable file might be covered by - the GNU General Public License. */ - - -#include <stdlib.h> -#include <string.h> - -double -nan () -{ return strtod ("nan", NULL); } diff --git a/contrib/libstdc++/mkcheck.in b/contrib/libstdc++/mkcheck.in deleted file mode 100755 index c856b05..0000000 --- a/contrib/libstdc++/mkcheck.in +++ /dev/null @@ -1,448 +0,0 @@ -#!/usr/bin/env bash - -# Script to do automated testing and data collection for various test -# files, so that we don't have to do this by hand on every test file. -# It attempts to collect some diagnostic info about size and speed that -# should be useful in the future as the library gets tuned for size -# and speed. In addition, it tests static and shared linkage, iff each -# has been enabled. - -# Invocation -# mkcheck [01] - -# 1: variables -# -# WHICH determines if you are -# (0) testing the build binary and headers, or -# (1) testing the installed binary and headers, or -WHICH=$1 -if [ "$WHICH"x = 0x ]; then - echo "running mkcheck" - echo "$0: testing the build directory" -elif [ "$WHICH"x = 1x ]; then - echo "running mkcheck" - echo "$0: testing the install directory" -else - echo 'Usage: mkcheck 0 /* test the build directory */' - echo ' mkcheck 1 /* test the install directory */' - exit 1; -fi - -# Now that we've successfully translated the numerical option into -# a symbolic one, we can safely ignore it. -shift - -# This has been true all along. Found out about it the hard way... -case $BASH_VERSION in - 1*) echo 'You need bash 2.x to run mkcheck. Exiting.'; exit 1 ;; - *) ;; # ?? -esac - -BUILD_DIR=@glibcpp_builddir@ -SRC_DIR=@glibcpp_srcdir@ -PREFIX_DIR=@glibcpp_prefixdir@ -if [ "$WHICH"x = 0x ]; then - CXX=`$BUILD_DIR/testsuite_flags --build-cxx` - INCLUDES=`$BUILD_DIR/testsuite_flags --build-includes` -else - CXX=`$BUILD_DIR/testsuite_flags --install-cxx` - INCLUDES=`$BUILD_DIR/testsuite_flags --install-includes` -fi -CXXFLAGS=`$BUILD_DIR/testsuite_flags --cxxflags` -LIBTOOL="$BUILD_DIR/libtool" -LTEXE="$LIBTOOL --mode=execute" -#LTCXX="$LIBTOOL --tag=CXX --mode=link $CXX $CXXFLAGS $INCLUDES" -LTCXX="$CXX $CXXFLAGS $INCLUDES" - -# specific libtool flag(s) to use shared libraries, if any -SH_FLAG="-Wl,--rpath -Wl,$BUILD_DIR/../../gcc -Wl,--rpath -Wl,$BUILD_DIR/src/.libs" - -# specific libtool flag(s) to use static libraries, if any -ST_FLAG="-static" -#ST_FLAG="-all-static" - -# Set up the testing directory, which should be in a directory called -# "testsuite" in the root level of the build directory. -TEST_DIR="$BUILD_DIR/testsuite" -# help libtool keep quiet -if [ ! -d ${TEST_DIR}/.libs ]; then - mkdir $TEST_DIR/.libs -fi - -# the name of the file that will collect and hold all this useful data: -RESULTS_FILE="$TEST_DIR/$(date +%Y%m%d)-mkcheck.txt" - -# the name of the log file that will append compiler diagnostics: -LOG_FILE="$TEST_DIR/$(date +%Y%m%d)-mkchecklog.txt" - -# the names of the specific test files to be run -TESTS_FILE="$TEST_DIR/$(date +%Y%m%d)-mkcheckfiles.txt" - - -# -# 2: clean, make files, append general test info -# - -# Remove old executables. -rm -rf "$TEST_DIR"/*exe -rm -rf "$TEST_DIR"/compile.out - -# Remove old core files (which now get left in cwd, not $TEST_DIR). -rm -rf ./*core* - -if [ -f $RESULTS_FILE ]; then - rm $RESULTS_FILE -fi -if [ -f $LOG_FILE ]; then - rm $LOG_FILE -fi - -# Make a list of the files we're going to run, or use an old one if it exists. -if [ ! -f "$TESTS_FILE" ]; then - echo "making file $TESTS_FILE" - for LONG_NAME in $SRC_DIR/testsuite/*/*.cc - do - DIR_NAME=$(dirname $LONG_NAME) - SHORT_NAME="`basename $DIR_NAME`/`basename $LONG_NAME`" - echo "$SHORT_NAME" >> $TESTS_FILE - done -fi - -# Nasty solution to replace GNU date(1)'s %s time_t output function. -TIMER_COMMAND=$TEST_DIR/printnow.exe -if [ ! -x "$TIMER_COMMAND" ]; then - echo "making utility $TIMER_COMMAND" - gcc -o "$TIMER_COMMAND" "$SRC_DIR/testsuite/printnow.c" - strip "$TIMER_COMMAND" -fi - -# Copy over the data files for filebufs -cp $SRC_DIR/testsuite/27_io/*.txt $TEST_DIR -cp $SRC_DIR/testsuite/27_io/*.tst $TEST_DIR -chmod u+w $TEST_DIR/*.txt -chmod u+w $TEST_DIR/*.tst - -# Emit useful info about compiler and platform -echo "host: $(uname -mrsv)" >> $RESULTS_FILE -echo "compiler: $($CXX -v 2>&1)" >> $RESULTS_FILE -echo "compiler flags: $CXXFLAGS" >> $RESULTS_FILE -echo "date: $(date +%Y%m%d)" >> $RESULTS_FILE -echo "" >> $RESULTS_FILE - -explanation='+: pass, -b: build failure, -r: run failure, x: disabled' -printf "%s\n %s\n" 'p == pass/fail execution test' "$explanation" \ - >> $RESULTS_FILE -echo "ctime == time to compile and link" >> $RESULTS_FILE -echo "etime == time for executable to run" >> $RESULTS_FILE -echo "text == size of the executable text section" >> $RESULTS_FILE -echo "data == size of the executable data section" >> $RESULTS_FILE -echo "total == size of the executable" >> $RESULTS_FILE -echo "" >> $RESULTS_FILE - -echo "p" | awk '{printf("%s ", $1)}' >> $RESULTS_FILE -echo "ctime" "etime" | awk '{printf("%s\t%s\t", $1, $2)}' >> $RESULTS_FILE -echo "text" "data" | awk '{printf("%s\t%s\t", $1, $2)}' >> $RESULTS_FILE -echo "total" "name" | awk '{printf("%s\t%s\t", $1, $2)}' >> $RESULTS_FILE -echo "" >> $RESULTS_FILE - -# Counters. These could be members of an array, but they'd all have to -# become individuals anyhow if we ever change this script to super-portable sh. -shared_pass=0 -shared_fail=0 -static_pass=0 -static_fail=0 - - -# -# 2.5: support functions -# - -# Figure out how to extract size information from binaries. We take -# the text of the value we want as an argument, and leave the size in -# the appropriate variable. -# -# We discover what kind of size(1) we are using *once* and build a shell -# function named 'size_command' to wrap it. (The "function" keyword is -# redundant here, but helps me read it, so there.) Previously we were -# re-discovering the size(1) arguments three times for each test; sloooow. -# -# It is VERY IMPORTANT not to compare these numbers across platforms. -# Different size(1)'s extract section information differently. For -# example, using the native Sun size(1) and GNU size(1) built for Suns -# on the exact same binary will give very different numbers, due to all -# the variance in command-line options and arbitrary names of ELF sections. -# -# and suddenly we go to 2-space indentations... -setup_size_command() -{ - if size --version 2> /dev/null | grep -c GNU > /dev/null; - then # Then we're using a GNU size(1) built for this platform. - # We lose .rodata and .data1 and who knows what else... kludge. - function size_command() - { - case $1 in - TEXT) TEXT=$(size -B $EXENAME | tail -1 | awk '{print $1}') ;; - DATA) DATA=$(size -B $EXENAME | tail -1 | awk '{print $2}') ;; - SIZE) SIZE=$(size -B $EXENAME | tail -1 | awk '{print $4}') ;; - esac - } - else - # Not using GNU size; check for platform. These numbers seem to match - # up to text/data/total, although their meanings seem to be different. - # THIS TABLE IS SORTED. KEEP IT THAT WAY. - case @host_os@ in - *aix*) - function size_command() - { - case $1 in - TEXT) TEXT=$(size -X32_64 $EXENAME | awk '{print $2}') ;; - DATA) DATA=$(size -X32_64 $EXENAME | awk '{print $4}') ;; - SIZE) SIZE=$(size -X32_64 $EXENAME | awk '{print $12}') ;; - esac - } - ;; - *hpux*) - function size_command() - { - case $1 in - TEXT) TEXT=$(size $EXENAME | awk '{print $1}') ;; - DATA) DATA=$(size $EXENAME | awk '{print $3}') ;; - SIZE) SIZE=$(size $EXENAME | awk '{print $7}') ;; - esac - } - ;; - *irix*) - function size_command() - { - case $1 in - TEXT) TEXT=$(size -4 $EXENAME | awk '{print $1}') ;; - DATA) DATA=$(size -4 $EXENAME | awk '{print $3}') ;; - SIZE) SIZE=$(size -4 $EXENAME | awk '{print $7}') ;; - esac - } - ;; - *solaris*) - function size_command() - { - case $1 in - TEXT) TEXT=$(size $EXENAME | awk '{print $1}') ;; - DATA) DATA=$(size $EXENAME | awk '{print $3}') ;; - SIZE) SIZE=$(size $EXENAME | awk '{print $7}') ;; - esac - } - ;; - *) - echo ' * Warning! Skipping section sizes!' 1>&2 - function size_command() - { - case $1 in - TEXT) TEXT=0 ;; - DATA) DATA=0 ;; - SIZE) SIZE=0 ;; - esac - } - ;; - esac - fi -} - -# Test for file output -test_for_output() -{ - # This checks for emitted output files, which is useful when - # testing file-related output. The rules for this working are as - # follows: the emitted file must have the ".txt" extension, and be - # based on the actual *.cc file's name. For example, 27/filbuf.cc - # currently outputs files named 27/filebuf-2.txt and 27/filebuf-3.txt. - # Also, the first emitted file must be in the form $NAME-1.txt. - # The control file must follow the same constraints, but have a - # ".tst" extension. Thus, you have 27/filebuf-2.tst, etc. - - # NAME contains the source name, like 27/filebuf.cc - # From that NAME, we want to generate some possible names, using - # ls on MATCH, a pattern description generated with sed. - - # this is the name of the resulting diff file, if any - DIFF_FILE="`echo $TEST_NAME | sed 's/cc$/diff/'`" - # construct wildcard names, ie for $NAME=filebuf.cc, makes "filebuf*.tst" - DATA_FILES="`echo $TEST_NAME | sed 's/\.cc/\*\.tst/g'`" - # make sure there is at least one, then go - ST_E="`echo $TEST_NAME | sed 's/\.cc/\-1\.tst/g'`" - if [ -f $ST_E ]; then - # list of actual files that match the wildcard above, ie - # "filebuf-1.tst" - ST_MATCH_LIST="`ls $DATA_FILES`" - for i in $ST_MATCH_LIST; do - # ST_OUT_FILE is generated in the build directory. - PRE_NAME2="$TEST_DIR/`basename $i`" - ST_OUT_FILE="`echo $PRE_NAME2 | sed 's/tst$/txt/'`" - diff $ST_OUT_FILE $i > $DIFF_FILE - if [ -s $DIFF_FILE ]; then - RESULT="-r" - else - RESULT="+" - fi - rm $DIFF_FILE - done - else - # the file does no output, and didn't abnormally - # terminate, so assume passed. - RESULT="+" - fi -} - - -# -# 3: compile, link, execute, time -# -# Abstract out the common code for compiling, linking, executing and printing. -test_file() -{ - # NB: S_FLAG has to be last argument because it may be null, and - # error checking hasn't been invented yet. - NAME=$1 - EXENAME=$2 - S_FLAG=$3 - - SRC_NAME="$SRC_DIR/testsuite/$1" - TEST_NAME="$TEST_DIR/`basename $NAME`" - - # This would be deliciously easy if GNU date's %s were always around. - # There are three ways to do this: 1) use the builtin 'time' like we - # do later; then getting compiler errors into LOG_FILE is a nightmare. - # 2) Grab the output of a formatted date(1) and do the math; harder - # and harder as we try compiling at, say, top of the hour; we would - # eventually have to calculate time_t anyhow. Or 3) just grab two - # time_t's (no more overhead than grabbing two date(1)'s). - our_libs="-L$TEST_DIR -lv3test" - compiler_invocation="$LTCXX $S_FLAG $SRC_NAME -o $EXENAME $our_libs" - echo $compiler_invocation >> compile.out 2>&1 - COMP_TIME_START=$($TIMER_COMMAND) - $compiler_invocation >> compile.out 2>&1 - COMP_TIME_END=$($TIMER_COMMAND) - - if [ $COMP_TIME_START -lt $COMP_TIME_END ]; then - C_TIME=$[ $COMP_TIME_END - $COMP_TIME_START ] - else - C_TIME="0" - fi - - if [ -f $EXENAME ]; then -# rm compile.out - size_command TEXT - size_command DATA - size_command SIZE - - # Actually run the executable and time it. Note that output - # printed by the executable will be lost and cannot be redirected, - # because we need to capture the output of 'time'. Bummer. - TIMEFORMAT='timemark %R' - E_TIME_TEXT="$(exec 2>&1; time $LTEXE $EXENAME)" - E_ABNORMAL_TERMINATION=$? - - if [ "$E_ABNORMAL_TERMINATION" -ne 0 ]; then - RESULT='-r' - E_TIME="0" - rm -f ./*core - # sometimes you want to save all core files for review: - #mv ./core $EXENAME.core - # sometimes the OS allows you to name core files yourself: - #mv ./*core $EXENAME.core - #mv ./core* $EXENAME.core - else - test_for_output - # XXX This doesn't always result in a number. - # E_TIME="$(echo $E_TIME_TEXT | awk '{print $2}')" - E_TIME="0" - fi - - # sometimes you want to save all failing exe files for review: - if [ "$RESULT" = '+' ]; then - rm "$EXENAME" - fi - else - # the file did not compile/link. - printf "\n" >> $LOG_FILE - `cat compile.out >> $LOG_FILE` - rm compile.out - RESULT="-b" - TEXT="0" - DATA="0" - SIZE="0" - fi - - # update the counters - if test "$RESULT" = "+" ; then - if test x"$S_FLAG" = x"$ST_FLAG"; then - static_pass=`expr $static_pass + 1` - else - shared_pass=`expr $shared_pass + 1` - fi - else - if test x"$S_FLAG" = x"$ST_FLAG"; then - static_fail=`expr $static_fail + 1` - else - shared_fail=`expr $shared_fail + 1` - fi - fi - - printf "%s\t" "$RESULT" - printf "%-2s %d\t%.3f\t%s\t%s\t%s\t%s %s\n" \ - "$RESULT" $C_TIME $E_TIME $TEXT $DATA $SIZE $NAME >> $RESULTS_FILE -} - -setup_size_command -echo "" -echo "Detailed test results in .${RESULTS_FILE/$BUILD_DIR}" -echo $explanation -echo "------------------------------------------------------------------------" -printf "static\tshared\ttest\n" -echo "------------------------------------------------------------------------" - -TEST_TIME_START=$($TIMER_COMMAND) -for NAME in `cat $TESTS_FILE` -do - PRE_NAME="$TEST_DIR/`basename $NAME`" - ST_NAME="`echo $PRE_NAME | sed 's/cc$/st-exe/'`" - SH_NAME="`echo $PRE_NAME | sed 's/cc$/sh-exe/'`" - - if test @enable_static@ = yes; then - test_file $NAME $ST_NAME "$ST_FLAG" - else - printf "x\t" - printf "static skipped\n" >> $RESULTS_FILE - fi - if test @enable_shared@ = yes; then - test_file $NAME $SH_NAME "$SH_FLAG" - else - printf "x\t" - printf "shared skipped\n" >> $RESULTS_FILE - fi - printf "%s\n" "$NAME" - - echo "" >> $RESULTS_FILE -done -TEST_TIME_END=$($TIMER_COMMAND) - - -# -# 4: summary -# -# grep can count faster than we can... -total_failures=`expr ${shared_fail} + ${static_fail}` -total_successes=`expr ${shared_pass} + ${static_pass}` -resultstext="pass/fail results: ${static_pass}/${static_fail} static + ${shared_pass}/${shared_fail} shared = ${total_successes}/${total_failures} total" -if [ $total_failures -eq 0 ]; then - resultstext="${resultstext}, WIN WIN" -fi -sed -e "/^date:/a\\ -$resultstext" $RESULTS_FILE > ${RESULTS_FILE}.tmp -mv ${RESULTS_FILE}.tmp $RESULTS_FILE - -if [ $TEST_TIME_START -lt $TEST_TIME_END ]; then - TEST_TIME=$[ $TEST_TIME_END - $TEST_TIME_START ] - echo "testrun == $TEST_TIME seconds" - echo "testrun == $TEST_TIME seconds" >> $RESULTS_FILE -fi - -exit 0 diff --git a/contrib/libstdc++/src/bitset.cc b/contrib/libstdc++/src/bitset.cc deleted file mode 100644 index 4849a6a..0000000 --- a/contrib/libstdc++/src/bitset.cc +++ /dev/null @@ -1,219 +0,0 @@ -// Bitset definitions -*- C++ -*- - -// Copyright (C) 2001, 2002 Free Software Foundation -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 2, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License along -// with this library; see the file COPYING. If not, write to the Free -// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, -// USA. - -// 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. - -/* - * Copyright (c) 1998 - * Silicon Graphics Computer Systems, Inc. - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Silicon Graphics makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - */ - -#include <bitset> - -// -// Definitions of non-inline functions from the single-word version of -// _Base_bitset. -// - -std::size_t -std::_Base_bitset<1>::_M_do_find_first(std::size_t __not_found) const -{ - _WordT __thisword = _M_w; - - if ( __thisword != static_cast<_WordT>(0) ) { - // find byte within word - for (std::size_t __j = 0; __j < sizeof(_WordT); __j++ ) { - unsigned char __this_byte - = static_cast<unsigned char>(__thisword & (~(unsigned char)0)); - if ( __this_byte ) - return __j * CHAR_BIT + _S_first_one[__this_byte]; - - __thisword >>= CHAR_BIT; - } - } - // not found, so return a value that indicates failure. - return __not_found; -} - -std::size_t -std::_Base_bitset<1>::_M_do_find_next(std::size_t __prev, - std::size_t __not_found) const -{ - // make bound inclusive - ++__prev; - - // check out of bounds - if ( __prev >= _GLIBCPP_BITSET_BITS_PER_WORD ) - return __not_found; - - // search first (and only) word - _WordT __thisword = _M_w; - - // mask off bits below bound - __thisword &= (~static_cast<_WordT>(0)) << _S_whichbit(__prev); - - if ( __thisword != static_cast<_WordT>(0) ) { - // find byte within word - // get first byte into place - __thisword >>= _S_whichbyte(__prev) * CHAR_BIT; - for ( std::size_t __j = _S_whichbyte(__prev); __j < sizeof(_WordT); __j++ ) { - unsigned char __this_byte - = static_cast<unsigned char>(__thisword & (~(unsigned char)0)); - if ( __this_byte ) - return __j * CHAR_BIT + _S_first_one[__this_byte]; - - __thisword >>= CHAR_BIT; - } - } - - // not found, so return a value that indicates failure. - return __not_found; -} // end _M_do_find_next - - -// Lookup tables for find and count operations. In _S_bit_count, the value -// *at* an index is the number of bits set *in* that index. -unsigned char std::_S_bit_count[256] = -{ - 0, /* 0 */ 1, /* 1 */ 1, /* 2 */ 2, /* 3 */ 1, /* 4 */ - 2, /* 5 */ 2, /* 6 */ 3, /* 7 */ 1, /* 8 */ 2, /* 9 */ - 2, /* 10 */ 3, /* 11 */ 2, /* 12 */ 3, /* 13 */ 3, /* 14 */ - 4, /* 15 */ 1, /* 16 */ 2, /* 17 */ 2, /* 18 */ 3, /* 19 */ - 2, /* 20 */ 3, /* 21 */ 3, /* 22 */ 4, /* 23 */ 2, /* 24 */ - 3, /* 25 */ 3, /* 26 */ 4, /* 27 */ 3, /* 28 */ 4, /* 29 */ - 4, /* 30 */ 5, /* 31 */ 1, /* 32 */ 2, /* 33 */ 2, /* 34 */ - 3, /* 35 */ 2, /* 36 */ 3, /* 37 */ 3, /* 38 */ 4, /* 39 */ - 2, /* 40 */ 3, /* 41 */ 3, /* 42 */ 4, /* 43 */ 3, /* 44 */ - 4, /* 45 */ 4, /* 46 */ 5, /* 47 */ 2, /* 48 */ 3, /* 49 */ - 3, /* 50 */ 4, /* 51 */ 3, /* 52 */ 4, /* 53 */ 4, /* 54 */ - 5, /* 55 */ 3, /* 56 */ 4, /* 57 */ 4, /* 58 */ 5, /* 59 */ - 4, /* 60 */ 5, /* 61 */ 5, /* 62 */ 6, /* 63 */ 1, /* 64 */ - 2, /* 65 */ 2, /* 66 */ 3, /* 67 */ 2, /* 68 */ 3, /* 69 */ - 3, /* 70 */ 4, /* 71 */ 2, /* 72 */ 3, /* 73 */ 3, /* 74 */ - 4, /* 75 */ 3, /* 76 */ 4, /* 77 */ 4, /* 78 */ 5, /* 79 */ - 2, /* 80 */ 3, /* 81 */ 3, /* 82 */ 4, /* 83 */ 3, /* 84 */ - 4, /* 85 */ 4, /* 86 */ 5, /* 87 */ 3, /* 88 */ 4, /* 89 */ - 4, /* 90 */ 5, /* 91 */ 4, /* 92 */ 5, /* 93 */ 5, /* 94 */ - 6, /* 95 */ 2, /* 96 */ 3, /* 97 */ 3, /* 98 */ 4, /* 99 */ - 3, /* 100 */ 4, /* 101 */ 4, /* 102 */ 5, /* 103 */ 3, /* 104 */ - 4, /* 105 */ 4, /* 106 */ 5, /* 107 */ 4, /* 108 */ 5, /* 109 */ - 5, /* 110 */ 6, /* 111 */ 3, /* 112 */ 4, /* 113 */ 4, /* 114 */ - 5, /* 115 */ 4, /* 116 */ 5, /* 117 */ 5, /* 118 */ 6, /* 119 */ - 4, /* 120 */ 5, /* 121 */ 5, /* 122 */ 6, /* 123 */ 5, /* 124 */ - 6, /* 125 */ 6, /* 126 */ 7, /* 127 */ 1, /* 128 */ 2, /* 129 */ - 2, /* 130 */ 3, /* 131 */ 2, /* 132 */ 3, /* 133 */ 3, /* 134 */ - 4, /* 135 */ 2, /* 136 */ 3, /* 137 */ 3, /* 138 */ 4, /* 139 */ - 3, /* 140 */ 4, /* 141 */ 4, /* 142 */ 5, /* 143 */ 2, /* 144 */ - 3, /* 145 */ 3, /* 146 */ 4, /* 147 */ 3, /* 148 */ 4, /* 149 */ - 4, /* 150 */ 5, /* 151 */ 3, /* 152 */ 4, /* 153 */ 4, /* 154 */ - 5, /* 155 */ 4, /* 156 */ 5, /* 157 */ 5, /* 158 */ 6, /* 159 */ - 2, /* 160 */ 3, /* 161 */ 3, /* 162 */ 4, /* 163 */ 3, /* 164 */ - 4, /* 165 */ 4, /* 166 */ 5, /* 167 */ 3, /* 168 */ 4, /* 169 */ - 4, /* 170 */ 5, /* 171 */ 4, /* 172 */ 5, /* 173 */ 5, /* 174 */ - 6, /* 175 */ 3, /* 176 */ 4, /* 177 */ 4, /* 178 */ 5, /* 179 */ - 4, /* 180 */ 5, /* 181 */ 5, /* 182 */ 6, /* 183 */ 4, /* 184 */ - 5, /* 185 */ 5, /* 186 */ 6, /* 187 */ 5, /* 188 */ 6, /* 189 */ - 6, /* 190 */ 7, /* 191 */ 2, /* 192 */ 3, /* 193 */ 3, /* 194 */ - 4, /* 195 */ 3, /* 196 */ 4, /* 197 */ 4, /* 198 */ 5, /* 199 */ - 3, /* 200 */ 4, /* 201 */ 4, /* 202 */ 5, /* 203 */ 4, /* 204 */ - 5, /* 205 */ 5, /* 206 */ 6, /* 207 */ 3, /* 208 */ 4, /* 209 */ - 4, /* 210 */ 5, /* 211 */ 4, /* 212 */ 5, /* 213 */ 5, /* 214 */ - 6, /* 215 */ 4, /* 216 */ 5, /* 217 */ 5, /* 218 */ 6, /* 219 */ - 5, /* 220 */ 6, /* 221 */ 6, /* 222 */ 7, /* 223 */ 3, /* 224 */ - 4, /* 225 */ 4, /* 226 */ 5, /* 227 */ 4, /* 228 */ 5, /* 229 */ - 5, /* 230 */ 6, /* 231 */ 4, /* 232 */ 5, /* 233 */ 5, /* 234 */ - 6, /* 235 */ 5, /* 236 */ 6, /* 237 */ 6, /* 238 */ 7, /* 239 */ - 4, /* 240 */ 5, /* 241 */ 5, /* 242 */ 6, /* 243 */ 5, /* 244 */ - 6, /* 245 */ 6, /* 246 */ 7, /* 247 */ 5, /* 248 */ 6, /* 249 */ - 6, /* 250 */ 7, /* 251 */ 6, /* 252 */ 7, /* 253 */ 7, /* 254 */ - 8 /* 255 */ -}; // end _S_bit_count - -unsigned char std::_S_first_one[256] = -{ - 0, /* 0 */ 0, /* 1 */ 1, /* 2 */ 0, /* 3 */ 2, /* 4 */ - 0, /* 5 */ 1, /* 6 */ 0, /* 7 */ 3, /* 8 */ 0, /* 9 */ - 1, /* 10 */ 0, /* 11 */ 2, /* 12 */ 0, /* 13 */ 1, /* 14 */ - 0, /* 15 */ 4, /* 16 */ 0, /* 17 */ 1, /* 18 */ 0, /* 19 */ - 2, /* 20 */ 0, /* 21 */ 1, /* 22 */ 0, /* 23 */ 3, /* 24 */ - 0, /* 25 */ 1, /* 26 */ 0, /* 27 */ 2, /* 28 */ 0, /* 29 */ - 1, /* 30 */ 0, /* 31 */ 5, /* 32 */ 0, /* 33 */ 1, /* 34 */ - 0, /* 35 */ 2, /* 36 */ 0, /* 37 */ 1, /* 38 */ 0, /* 39 */ - 3, /* 40 */ 0, /* 41 */ 1, /* 42 */ 0, /* 43 */ 2, /* 44 */ - 0, /* 45 */ 1, /* 46 */ 0, /* 47 */ 4, /* 48 */ 0, /* 49 */ - 1, /* 50 */ 0, /* 51 */ 2, /* 52 */ 0, /* 53 */ 1, /* 54 */ - 0, /* 55 */ 3, /* 56 */ 0, /* 57 */ 1, /* 58 */ 0, /* 59 */ - 2, /* 60 */ 0, /* 61 */ 1, /* 62 */ 0, /* 63 */ 6, /* 64 */ - 0, /* 65 */ 1, /* 66 */ 0, /* 67 */ 2, /* 68 */ 0, /* 69 */ - 1, /* 70 */ 0, /* 71 */ 3, /* 72 */ 0, /* 73 */ 1, /* 74 */ - 0, /* 75 */ 2, /* 76 */ 0, /* 77 */ 1, /* 78 */ 0, /* 79 */ - 4, /* 80 */ 0, /* 81 */ 1, /* 82 */ 0, /* 83 */ 2, /* 84 */ - 0, /* 85 */ 1, /* 86 */ 0, /* 87 */ 3, /* 88 */ 0, /* 89 */ - 1, /* 90 */ 0, /* 91 */ 2, /* 92 */ 0, /* 93 */ 1, /* 94 */ - 0, /* 95 */ 5, /* 96 */ 0, /* 97 */ 1, /* 98 */ 0, /* 99 */ - 2, /* 100 */ 0, /* 101 */ 1, /* 102 */ 0, /* 103 */ 3, /* 104 */ - 0, /* 105 */ 1, /* 106 */ 0, /* 107 */ 2, /* 108 */ 0, /* 109 */ - 1, /* 110 */ 0, /* 111 */ 4, /* 112 */ 0, /* 113 */ 1, /* 114 */ - 0, /* 115 */ 2, /* 116 */ 0, /* 117 */ 1, /* 118 */ 0, /* 119 */ - 3, /* 120 */ 0, /* 121 */ 1, /* 122 */ 0, /* 123 */ 2, /* 124 */ - 0, /* 125 */ 1, /* 126 */ 0, /* 127 */ 7, /* 128 */ 0, /* 129 */ - 1, /* 130 */ 0, /* 131 */ 2, /* 132 */ 0, /* 133 */ 1, /* 134 */ - 0, /* 135 */ 3, /* 136 */ 0, /* 137 */ 1, /* 138 */ 0, /* 139 */ - 2, /* 140 */ 0, /* 141 */ 1, /* 142 */ 0, /* 143 */ 4, /* 144 */ - 0, /* 145 */ 1, /* 146 */ 0, /* 147 */ 2, /* 148 */ 0, /* 149 */ - 1, /* 150 */ 0, /* 151 */ 3, /* 152 */ 0, /* 153 */ 1, /* 154 */ - 0, /* 155 */ 2, /* 156 */ 0, /* 157 */ 1, /* 158 */ 0, /* 159 */ - 5, /* 160 */ 0, /* 161 */ 1, /* 162 */ 0, /* 163 */ 2, /* 164 */ - 0, /* 165 */ 1, /* 166 */ 0, /* 167 */ 3, /* 168 */ 0, /* 169 */ - 1, /* 170 */ 0, /* 171 */ 2, /* 172 */ 0, /* 173 */ 1, /* 174 */ - 0, /* 175 */ 4, /* 176 */ 0, /* 177 */ 1, /* 178 */ 0, /* 179 */ - 2, /* 180 */ 0, /* 181 */ 1, /* 182 */ 0, /* 183 */ 3, /* 184 */ - 0, /* 185 */ 1, /* 186 */ 0, /* 187 */ 2, /* 188 */ 0, /* 189 */ - 1, /* 190 */ 0, /* 191 */ 6, /* 192 */ 0, /* 193 */ 1, /* 194 */ - 0, /* 195 */ 2, /* 196 */ 0, /* 197 */ 1, /* 198 */ 0, /* 199 */ - 3, /* 200 */ 0, /* 201 */ 1, /* 202 */ 0, /* 203 */ 2, /* 204 */ - 0, /* 205 */ 1, /* 206 */ 0, /* 207 */ 4, /* 208 */ 0, /* 209 */ - 1, /* 210 */ 0, /* 211 */ 2, /* 212 */ 0, /* 213 */ 1, /* 214 */ - 0, /* 215 */ 3, /* 216 */ 0, /* 217 */ 1, /* 218 */ 0, /* 219 */ - 2, /* 220 */ 0, /* 221 */ 1, /* 222 */ 0, /* 223 */ 5, /* 224 */ - 0, /* 225 */ 1, /* 226 */ 0, /* 227 */ 2, /* 228 */ 0, /* 229 */ - 1, /* 230 */ 0, /* 231 */ 3, /* 232 */ 0, /* 233 */ 1, /* 234 */ - 0, /* 235 */ 2, /* 236 */ 0, /* 237 */ 1, /* 238 */ 0, /* 239 */ - 4, /* 240 */ 0, /* 241 */ 1, /* 242 */ 0, /* 243 */ 2, /* 244 */ - 0, /* 245 */ 1, /* 246 */ 0, /* 247 */ 3, /* 248 */ 0, /* 249 */ - 1, /* 250 */ 0, /* 251 */ 2, /* 252 */ 0, /* 253 */ 1, /* 254 */ - 0, /* 255 */ -}; // end _S_first_one - diff --git a/contrib/libstdc++/src/fstream.cc b/contrib/libstdc++/src/fstream.cc deleted file mode 100644 index 2a099d6..0000000 --- a/contrib/libstdc++/src/fstream.cc +++ /dev/null @@ -1,202 +0,0 @@ -// File based streams -*- C++ -*- - -// 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. - -// -// ISO C++ 14882: 27.8 File-based streams -// - -#include <fstream> - -namespace std -{ - template<> - basic_filebuf<char>::int_type - basic_filebuf<char>::_M_underflow_common(bool __bump) - { - int_type __ret = traits_type::eof(); - bool __testin = _M_mode & ios_base::in; - bool __testout = _M_mode & ios_base::out; - - if (__testin) - { - // Check for pback madness, and if so swich back to the - // normal buffers and jet outta here before expensive - // fileops happen... - if (_M_pback_init) - _M_pback_destroy(); - - if (_M_in_cur && _M_in_cur < _M_in_end) - { - __ret = traits_type::to_int_type(*_M_in_cur); - if (__bump) - _M_in_cur_move(1); - return __ret; - } - - // Sync internal and external buffers. - // NB: __testget -> __testput as _M_buf_unified here. - bool __testget = _M_in_cur && _M_in_beg < _M_in_cur; - bool __testinit = _M_is_indeterminate(); - if (__testget) - { - if (__testout) - _M_really_overflow(); - else if (_M_in_cur != _M_filepos) - _M_file.seekoff(_M_in_cur - _M_filepos, - ios_base::cur, ios_base::in); - } - - if (__testinit || __testget) - { - streamsize __elen = 0; - streamsize __ilen = 0; - __elen = _M_file.xsgetn(reinterpret_cast<char*>(_M_in_beg), - _M_buf_size); - __ilen = __elen; - - if (0 < __ilen) - { - _M_set_determinate(__ilen); - if (__testout) - _M_out_cur = _M_in_cur; - __ret = traits_type::to_int_type(*_M_in_cur); - if (__bump) - _M_in_cur_move(1); - else if (_M_buf_size == 1) - { - // If we are synced with stdio, we have to unget the - // character we just read so that the file pointer - // doesn't move. - _M_file.sys_ungetc(traits_type::to_int_type(*_M_in_cur)); - _M_set_indeterminate(); - } - } - } - } - _M_last_overflowed = false; - return __ret; - } - -#ifdef _GLIBCPP_USE_WCHAR_T - template<> - basic_filebuf<wchar_t>::int_type - basic_filebuf<wchar_t>::_M_underflow_common(bool __bump) - { - int_type __ret = traits_type::eof(); - bool __testin = _M_mode & ios_base::in; - bool __testout = _M_mode & ios_base::out; - - if (__testin) - { - // Check for pback madness, and if so swich back to the - // normal buffers and jet outta here before expensive - // fileops happen... - if (_M_pback_init) - _M_pback_destroy(); - - if (_M_in_cur && _M_in_cur < _M_in_end) - { - __ret = traits_type::to_int_type(*_M_in_cur); - if (__bump) - _M_in_cur_move(1); - return __ret; - } - - // Sync internal and external buffers. - // NB: __testget -> __testput as _M_buf_unified here. - bool __testget = _M_in_cur && _M_in_beg < _M_in_cur; - bool __testinit = _M_is_indeterminate(); - if (__testget) - { - if (__testout) - _M_really_overflow(); - else if (_M_in_cur != _M_filepos) - _M_file.seekoff(_M_in_cur - _M_filepos, - ios_base::cur, ios_base::in); - } - - if (__testinit || __testget) - { - const locale __loc = this->getloc(); - const __codecvt_type& __cvt = use_facet<__codecvt_type>(__loc); - - streamsize __elen = 0; - streamsize __ilen = 0; - if (__cvt.always_noconv()) - { - __elen = _M_file.xsgetn(reinterpret_cast<char*>(_M_in_beg), - _M_buf_size); - __ilen = __elen; - } - else - { - char* __buf = static_cast<char*>(__builtin_alloca(_M_buf_size)); - __elen = _M_file.xsgetn(__buf, _M_buf_size); - - const char* __eend; - char_type* __iend; - codecvt_base::result __r; - __r = __cvt.in(_M_state_cur, __buf, - __buf + __elen, __eend, _M_in_beg, - _M_in_beg + _M_buf_size, __iend); - if (__r == codecvt_base::ok) - __ilen = __iend - _M_in_beg; - else - { - // Unwind. - __ilen = 0; - _M_file.seekoff(-__elen, ios_base::cur, ios_base::in); - } - } - - if (0 < __ilen) - { - _M_set_determinate(__ilen); - if (__testout) - _M_out_cur = _M_in_cur; - __ret = traits_type::to_int_type(*_M_in_cur); - if (__bump) - _M_in_cur_move(1); - else if (_M_buf_size == 1) - { - // If we are synced with stdio, we have to unget the - // character we just read so that the file pointer - // doesn't move. - _M_file.sys_ungetc(traits_type::to_int_type(*_M_in_cur)); - _M_set_indeterminate(); - } - } - } - } - _M_last_overflowed = false; - return __ret; - } -#endif -} // namespace std diff --git a/contrib/libstdc++/src/globals.cc b/contrib/libstdc++/src/globals.cc deleted file mode 100644 index efbfdbe..0000000 --- a/contrib/libstdc++/src/globals.cc +++ /dev/null @@ -1,317 +0,0 @@ -// Copyright (C) 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 -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 2, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License along -// with this library; see the file COPYING. If not, write to the Free -// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, -// USA. - -// As a special exception, you may use this file as part of a free software -// library without restriction. Specifically, if other files instantiate -// templates or use macros or inline functions from this file, or you compile -// this file and link it with other files to produce an executable, this -// file does not by itself cause the resulting executable to be covered by -// the GNU General Public License. This exception does not however -// invalidate any other reasons why the executable file might be covered by -// the GNU General Public License. - -#include "bits/c++config.h" -#include "bits/gthr.h" -#include <fstream> -#include <istream> -#include <ostream> -#include <locale> -#include <ext/stdio_filebuf.h> - -// On AIX, and perhaps other systems, library initialization order is -// not guaranteed. For example, the static initializers for the main -// program might run before the static initializers for this library. -// That means that we cannot rely on static initialization in the -// library; there is no guarantee that things will get initialized in -// time. This file contains definitions of all global variables that -// require initialization as arrays of characters. - -// Because <iostream> declares the standard streams to be [io]stream -// types instead of say [io]fstream types, it is also necessary to -// allocate the actual file buffers in this file. -namespace __gnu_cxx -{ - using namespace std; - - typedef char fake_facet_name[sizeof(char*)] - __attribute__ ((aligned(__alignof__(char*)))); - fake_facet_name facet_name[6 + _GLIBCPP_NUM_CATEGORIES]; - - typedef char fake_locale_Impl[sizeof(locale::_Impl)] - __attribute__ ((aligned(__alignof__(locale::_Impl)))); - fake_locale_Impl c_locale_impl; - - - // NB: The asm directives renames these non-exported, namespace - // __gnu_cxx symbols into the mistakenly exported, namespace std - // symbols in GLIBCPP_3.2. - // The rename syntax is - // asm (".symver currentname,oldname@@GLIBCPP_3.2") - // At the same time, these new __gnu_cxx symbols are not exported. - // In the future, GLIBCXX_ABI > 5 should remove all uses of - // _GLIBCPP_ASM_SYMVER in this file. - typedef char fake_locale[sizeof(locale)] - __attribute__ ((aligned(__alignof__(locale)))); - fake_locale c_locale; - _GLIBCPP_ASM_SYMVER(_ZN9__gnu_cxx8c_localeE, _ZSt8c_locale, GLIBCPP_3.2) - - // GLIBCXX_ABI > 5 will not need this symbol at all. - // It's here just as a placeholder, as the size of this exported - // object changed. The new symbol is not exported. - const int o = sizeof(locale::_Impl) - sizeof(char*[_GLIBCPP_NUM_CATEGORIES]); - typedef char fake_locale_Impl_compat[o] - __attribute__ ((aligned(__alignof__(o)))); - fake_locale_Impl_compat c_locale_impl_compat; - _GLIBCPP_ASM_SYMVER(_ZN9__gnu_cxx20c_locale_impl_compatE, _ZSt13c_locale_impl, GLIBCPP_3.2) - - typedef char fake_facet_vec[sizeof(locale::facet*)] - __attribute__ ((aligned(__alignof__(locale::facet*)))); - fake_facet_vec facet_vec[_GLIBCPP_NUM_FACETS]; - _GLIBCPP_ASM_SYMVER(_ZN9__gnu_cxx9facet_vecE, _ZSt9facet_vec, GLIBCPP_3.2) - - // To support combined facets and caches in facet array - typedef char fake_facet_cache_vec[sizeof(locale::facet*)] - __attribute__ ((aligned(__alignof__(locale::facet*)))); - fake_facet_cache_vec facet_cache_vec[2 * _GLIBCPP_NUM_FACETS]; - - typedef char fake_ctype_c[sizeof(std::ctype<char>)] - __attribute__ ((aligned(__alignof__(std::ctype<char>)))); - fake_ctype_c ctype_c; - _GLIBCPP_ASM_SYMVER(_ZN9__gnu_cxx7ctype_cE, _ZSt7ctype_c, GLIBCPP_3.2) - - typedef char fake_collate_c[sizeof(std::collate<char>)] - __attribute__ ((aligned(__alignof__(std::collate<char>)))); - fake_collate_c collate_c; - _GLIBCPP_ASM_SYMVER(_ZN9__gnu_cxx9collate_cE, _ZSt9collate_c, GLIBCPP_3.2) - - typedef char fake_numpunct_c[sizeof(numpunct<char>)] - __attribute__ ((aligned(__alignof__(numpunct<char>)))); - fake_numpunct_c numpunct_c; - _GLIBCPP_ASM_SYMVER(_ZN9__gnu_cxx10numpunct_cE, _ZSt10numpunct_c, GLIBCPP_3.2) - - typedef char fake_num_get_c[sizeof(num_get<char>)] - __attribute__ ((aligned(__alignof__(num_get<char>)))); - fake_num_get_c num_get_c; - _GLIBCPP_ASM_SYMVER(_ZN9__gnu_cxx9num_get_cE, _ZSt9num_get_c, GLIBCPP_3.2) - - typedef char fake_num_put_c[sizeof(num_put<char>)] - __attribute__ ((aligned(__alignof__(num_put<char>)))); - fake_num_put_c num_put_c; - _GLIBCPP_ASM_SYMVER(_ZN9__gnu_cxx9num_put_cE, _ZSt9num_put_c, GLIBCPP_3.2) - - typedef char fake_codecvt_c[sizeof(codecvt<char, char, mbstate_t>)] - __attribute__ ((aligned(__alignof__(codecvt<char, char, mbstate_t>)))); - fake_codecvt_c codecvt_c; - _GLIBCPP_ASM_SYMVER(_ZN9__gnu_cxx9codecvt_cE, _ZSt9codecvt_c, GLIBCPP_3.2) - - typedef char fake_moneypunct_c[sizeof(moneypunct<char, true>)] - __attribute__ ((aligned(__alignof__(moneypunct<char, true>)))); - fake_moneypunct_c moneypunct_tc; - fake_moneypunct_c moneypunct_fc; - _GLIBCPP_ASM_SYMVER(_ZN9__gnu_cxx13moneypunct_tcE,\ - _ZSt13moneypunct_tc, GLIBCPP_3.2) - _GLIBCPP_ASM_SYMVER(_ZN9__gnu_cxx13moneypunct_fcE,\ - _ZSt13moneypunct_fc, GLIBCPP_3.2) - - typedef char fake_money_get_c[sizeof(money_get<char>)] - __attribute__ ((aligned(__alignof__(money_get<char>)))); - fake_money_get_c money_get_c; - _GLIBCPP_ASM_SYMVER(_ZN9__gnu_cxx11money_get_cE, _ZSt11money_get_c, GLIBCPP_3.2) - - typedef char fake_money_put_c[sizeof(money_put<char>)] - __attribute__ ((aligned(__alignof__(money_put<char>)))); - fake_money_put_c money_put_c; - _GLIBCPP_ASM_SYMVER(_ZN9__gnu_cxx11money_put_cE, _ZSt11money_put_c, GLIBCPP_3.2) - - typedef char fake_timepunct_c[sizeof(__timepunct<char>)] - __attribute__ ((aligned(__alignof__(__timepunct<char>)))); - fake_timepunct_c timepunct_c; - _GLIBCPP_ASM_SYMVER(_ZN9__gnu_cxx11timepunct_cE, _ZSt11timepunct_c, GLIBCPP_3.2) - - typedef char fake_time_get_c[sizeof(time_get<char>)] - __attribute__ ((aligned(__alignof__(time_get<char>)))); - fake_time_get_c time_get_c; - _GLIBCPP_ASM_SYMVER(_ZN9__gnu_cxx10time_get_cE, _ZSt10time_get_c, GLIBCPP_3.2) - - typedef char fake_time_put_c[sizeof(time_put<char>)] - __attribute__ ((aligned(__alignof__(time_put<char>)))); - fake_time_put_c time_put_c; - _GLIBCPP_ASM_SYMVER(_ZN9__gnu_cxx10time_put_cE, _ZSt10time_put_c, GLIBCPP_3.2) - - typedef char fake_messages_c[sizeof(messages<char>)] - __attribute__ ((aligned(__alignof__(messages<char>)))); - fake_messages_c messages_c; - _GLIBCPP_ASM_SYMVER(_ZN9__gnu_cxx10messages_cE, _ZSt10messages_c, GLIBCPP_3.2) - -#ifdef _GLIBCPP_USE_WCHAR_T - typedef char fake_wtype_w[sizeof(std::ctype<wchar_t>)] - __attribute__ ((aligned(__alignof__(std::ctype<wchar_t>)))); - fake_wtype_w ctype_w; - _GLIBCPP_ASM_SYMVER(_ZN9__gnu_cxx7ctype_wE, _ZSt7ctype_w, GLIBCPP_3.2) - - typedef char fake_wollate_w[sizeof(std::collate<wchar_t>)] - __attribute__ ((aligned(__alignof__(std::collate<wchar_t>)))); - fake_wollate_w collate_w; - _GLIBCPP_ASM_SYMVER(_ZN9__gnu_cxx9collate_wE, _ZSt9collate_w, GLIBCPP_3.2) - - typedef char fake_numpunct_w[sizeof(numpunct<wchar_t>)] - __attribute__ ((aligned(__alignof__(numpunct<wchar_t>)))); - fake_numpunct_w numpunct_w; - _GLIBCPP_ASM_SYMVER(_ZN9__gnu_cxx10numpunct_wE, _ZSt10numpunct_w, GLIBCPP_3.2) - - typedef char fake_num_get_w[sizeof(num_get<wchar_t>)] - __attribute__ ((aligned(__alignof__(num_get<wchar_t>)))); - fake_num_get_w num_get_w; - _GLIBCPP_ASM_SYMVER(_ZN9__gnu_cxx9num_get_wE, _ZSt9num_get_w, GLIBCPP_3.2) - - typedef char fake_num_put_w[sizeof(num_put<wchar_t>)] - __attribute__ ((aligned(__alignof__(num_put<wchar_t>)))); - fake_num_put_w num_put_w; - _GLIBCPP_ASM_SYMVER(_ZN9__gnu_cxx9num_put_wE, _ZSt9num_put_w, GLIBCPP_3.2) - - typedef char fake_wodecvt_w[sizeof(codecvt<wchar_t, char, mbstate_t>)] - __attribute__ ((aligned(__alignof__(codecvt<wchar_t, char, mbstate_t>)))); - fake_wodecvt_w codecvt_w; - _GLIBCPP_ASM_SYMVER(_ZN9__gnu_cxx9codecvt_wE, _ZSt9codecvt_w, GLIBCPP_3.2) - - typedef char fake_moneypunct_w[sizeof(moneypunct<wchar_t, true>)] - __attribute__ ((aligned(__alignof__(moneypunct<wchar_t, true>)))); - fake_moneypunct_w moneypunct_tw; - fake_moneypunct_w moneypunct_fw; - _GLIBCPP_ASM_SYMVER(_ZN9__gnu_cxx13moneypunct_twE,\ - _ZSt13moneypunct_tw, GLIBCPP_3.2) - _GLIBCPP_ASM_SYMVER(_ZN9__gnu_cxx13moneypunct_fwE,\ - _ZSt13moneypunct_fw, GLIBCPP_3.2) - - typedef char fake_money_get_w[sizeof(money_get<wchar_t>)] - __attribute__ ((aligned(__alignof__(money_get<wchar_t>)))); - fake_money_get_w money_get_w; - _GLIBCPP_ASM_SYMVER(_ZN9__gnu_cxx11money_get_wE, _ZSt11money_get_w, GLIBCPP_3.2) - - typedef char fake_money_put_w[sizeof(money_put<wchar_t>)] - __attribute__ ((aligned(__alignof__(money_put<wchar_t>)))); - fake_money_put_w money_put_w; - _GLIBCPP_ASM_SYMVER(_ZN9__gnu_cxx11money_put_wE, _ZSt11money_put_w, GLIBCPP_3.2) - - typedef char fake_timepunct_w[sizeof(__timepunct<wchar_t>)] - __attribute__ ((aligned(__alignof__(__timepunct<wchar_t>)))); - fake_timepunct_w timepunct_w; - _GLIBCPP_ASM_SYMVER(_ZN9__gnu_cxx11timepunct_wE, _ZSt11timepunct_w, GLIBCPP_3.2) - - typedef char fake_time_get_w[sizeof(time_get<wchar_t>)] - __attribute__ ((aligned(__alignof__(time_get<wchar_t>)))); - fake_time_get_w time_get_w; - _GLIBCPP_ASM_SYMVER(_ZN9__gnu_cxx10time_get_wE, _ZSt10time_get_w, GLIBCPP_3.2) - - typedef char fake_time_put_w[sizeof(time_put<wchar_t>)] - __attribute__ ((aligned(__alignof__(time_put<wchar_t>)))); - fake_time_put_w time_put_w; - _GLIBCPP_ASM_SYMVER(_ZN9__gnu_cxx10time_put_wE, _ZSt10time_put_w, GLIBCPP_3.2) - - typedef char fake_messages_w[sizeof(messages<wchar_t>)] - __attribute__ ((aligned(__alignof__(messages<wchar_t>)))); - fake_messages_w messages_w; - _GLIBCPP_ASM_SYMVER(_ZN9__gnu_cxx10messages_wE, _ZSt10messages_w, GLIBCPP_3.2) -#endif - - // Storage for static C locale caches - typedef char fake_locale_cache_np_c[sizeof(std::__locale_cache<numpunct<char> >)] - __attribute__ ((aligned(__alignof__(std::__locale_cache<numpunct<char> >)))); - fake_locale_cache_np_c locale_cache_np_c; - -#ifdef _GLIBCPP_USE_WCHAR_T - typedef char fake_locale_cache_np_w[sizeof(std::__locale_cache<numpunct<wchar_t> >)] - __attribute__ ((aligned(__alignof__(std::__locale_cache<numpunct<wchar_t> >)))); - fake_locale_cache_np_w locale_cache_np_w; -#endif - - typedef char fake_filebuf[sizeof(stdio_filebuf<char>)] - __attribute__ ((aligned(__alignof__(stdio_filebuf<char>)))); - fake_filebuf buf_cout; - fake_filebuf buf_cin; - fake_filebuf buf_cerr; - _GLIBCPP_ASM_SYMVER(_ZN9__gnu_cxx8buf_coutE, _ZSt8buf_cout, GLIBCPP_3.2) - _GLIBCPP_ASM_SYMVER(_ZN9__gnu_cxx7buf_cinE, _ZSt7buf_cin, GLIBCPP_3.2) - _GLIBCPP_ASM_SYMVER(_ZN9__gnu_cxx8buf_cerrE, _ZSt8buf_cerr, GLIBCPP_3.2) - -#ifdef _GLIBCPP_USE_WCHAR_T - typedef char fake_wfilebuf[sizeof(stdio_filebuf<wchar_t>)] - __attribute__ ((aligned(__alignof__(stdio_filebuf<wchar_t>)))); - fake_wfilebuf buf_wcout; - fake_wfilebuf buf_wcin; - fake_wfilebuf buf_wcerr; - _GLIBCPP_ASM_SYMVER(_ZN9__gnu_cxx9buf_wcoutE, _ZSt9buf_wcout, GLIBCPP_3.2) - _GLIBCPP_ASM_SYMVER(_ZN9__gnu_cxx8buf_wcinE, _ZSt8buf_wcin, GLIBCPP_3.2) - _GLIBCPP_ASM_SYMVER(_ZN9__gnu_cxx9buf_wcerrE, _ZSt9buf_wcerr, GLIBCPP_3.2) -#endif - - // Globals for once-only runtime initialization of mutex objects. This - // allows static initialization of these objects on systems that need a - // function call to initialize a mutex. For example, see stl_threads.h. -#ifdef __GTHREAD_MUTEX_INIT - // Need to provide explicit instantiations of static data for - // systems with broken weak linkage support. - template __gthread_mutex_t _Swap_lock_struct<0>::_S_swap_lock; -#elif defined(__GTHREAD_MUTEX_INIT_FUNCTION) - __gthread_once_t _GLIBCPP_once = __GTHREAD_ONCE_INIT; - __gthread_mutex_t _GLIBCPP_mutex; - __gthread_mutex_t *_GLIBCPP_mutex_address; - - // Once-only initializer function for _GLIBCPP_mutex. - void - _GLIBCPP_mutex_init () - { __GTHREAD_MUTEX_INIT_FUNCTION (&_GLIBCPP_mutex); } - - // Once-only initializer function for _GLIBCPP_mutex_address. - void - _GLIBCPP_mutex_address_init () - { __GTHREAD_MUTEX_INIT_FUNCTION (_GLIBCPP_mutex_address); } -#endif - - // GLIBCXX_ABI. - struct __compat - { - static const char _S_atoms[]; - }; - const char __compat::_S_atoms[] = "0123456789eEabcdfABCDF"; - _GLIBCPP_ASM_SYMVER(_ZN9__gnu_cxx8__compat8_S_atomsE, _ZNSt10__num_base8_S_atomsE, GLIBCPP_3.2) -} // namespace __gnu_cxx - -namespace std -{ - // Standard stream objects. - typedef char fake_istream[sizeof(istream)] - __attribute__ ((aligned(__alignof__(istream)))); - typedef char fake_ostream[sizeof(ostream)] - __attribute__ ((aligned(__alignof__(ostream)))); - fake_istream cin; - fake_ostream cout; - fake_ostream cerr; - fake_ostream clog; - -#ifdef _GLIBCPP_USE_WCHAR_T - typedef char fake_wistream[sizeof(wistream)] - __attribute__ ((aligned(__alignof__(wistream)))); - typedef char fake_wostream[sizeof(wostream)] - __attribute__ ((aligned(__alignof__(wostream)))); - fake_wistream wcin; - fake_wostream wcout; - fake_wostream wcerr; - fake_wostream wclog; -#endif -} // namespace std diff --git a/contrib/libstdc++/src/stl-inst.cc b/contrib/libstdc++/src/stl-inst.cc deleted file mode 100644 index d80a718..0000000 --- a/contrib/libstdc++/src/stl-inst.cc +++ /dev/null @@ -1,43 +0,0 @@ -// Explicit instantiation file. - -// Copyright (C) 1999, 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 -// 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. - -// -// ISO C++ 14882: -// - -#include <bits/c++config.h> -#include <memory> - -namespace std -{ - template class allocator<char>; - template class allocator<wchar_t>; - - template class __default_alloc_template<true, 0>; -} // namespace std diff --git a/contrib/libstdc++/src/vterminate.cc b/contrib/libstdc++/src/vterminate.cc deleted file mode 100644 index 26e09d1..0000000 --- a/contrib/libstdc++/src/vterminate.cc +++ /dev/null @@ -1,82 +0,0 @@ -// Verbose terminate_handler -*- C++ -*- - -// Copyright (C) 2001, 2002 Free Software Foundation -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 2, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License along -// with this library; see the file COPYING. If not, write to the Free -// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, -// USA. - -// As a special exception, you may use this file as part of a free software -// library without restriction. Specifically, if other files instantiate -// templates or use macros or inline functions from this file, or you compile -// this file and link it with other files to produce an executable, this -// file does not by itself cause the resulting executable to be covered by -// the GNU General Public License. This exception does not however -// invalidate any other reasons why the executable file might be covered by -// the GNU General Public License. - -#include <cstdlib> -#include <cstdio> -#include <exception> -#include <exception_defines.h> -#include <cxxabi.h> - -using namespace std; -using namespace abi; - -namespace __gnu_cxx -{ - /* A replacement for the standard terminate_handler which prints - more information about the terminating exception (if any) on - stderr. */ - void __verbose_terminate_handler() - { - // Make sure there was an exception; terminate is also called for an - // attempt to rethrow when there is no suitable exception. - type_info *t = __cxa_current_exception_type(); - if (t) - { - char const *name = t->name(); - // Note that "name" is the mangled name. - - { - int status = -1; - char *dem = 0; - - // Disabled until __cxa_demangle gets the runtime GPL exception. - dem = __cxa_demangle(name, 0, 0, &status); - - printf("terminate called after throwing a `%s'\n", - status == 0 ? dem : name); - - if (status == 0) - free(dem); - } - - // If the exception is derived from std::exception, we can give more - // information. - try { __throw_exception_again; } -#ifdef __EXCEPTIONS - catch (exception &exc) - { fprintf(stderr, " what(): %s\n", exc.what()); } -#endif - catch (...) { } - } - else - fprintf(stderr, "terminate called without an active exception\n"); - - abort(); - } -} // namespace __gnu_cxx |