diff options
author | no-author <no-author@gcc.gnu.org> | 1999-03-27 17:33:36 +0000 |
---|---|---|
committer | no-author <no-author@gcc.gnu.org> | 1999-03-27 17:33:36 +0000 |
commit | 39afd5f60ec2fbd0c7b54a02190496d0d8ddf1a3 (patch) | |
tree | 6334557b4720da0ed086baaaa7673961de015cbe | |
parent | 988a45aa5452e434199d8e5f761ed7173e9c5862 (diff) |
This commit was manufactured by cvs2svn to create branch
'egcs_gc_branch'.
git-svn-id: https://gcc.gnu.org/svn/gcc/branches/egcs_gc_branch@26021 138bc75d-0d04-0410-961f-82ee72b054a4
353 files changed, 28235 insertions, 0 deletions
diff --git a/gcc/collect2.h b/gcc/collect2.h new file mode 100644 index 00000000000..04844bcd362 --- /dev/null +++ b/gcc/collect2.h @@ -0,0 +1,36 @@ +/* Header file for collect/tlink routines. + 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. */ + +#ifndef __COLLECT2_H__ +#define __COLLECT2_H__ + +extern void do_tlink PARAMS ((char **, char **)); + +extern void collect_execute PARAMS ((char *, char **, char *)); + +extern void collect_exit PARAMS ((int)) ATTRIBUTE_NORETURN; + +extern int collect_wait PARAMS ((char *)); + +extern void dump_file PARAMS ((char *)); + +extern int file_exists PARAMS ((char *)); + +#endif /* ! __COLLECT2_H__ */ diff --git a/gcc/config/alpha/openbsd.h b/gcc/config/alpha/openbsd.h new file mode 100644 index 00000000000..60591d554f5 --- /dev/null +++ b/gcc/config/alpha/openbsd.h @@ -0,0 +1,126 @@ +/* Configuration file for an alpha OpenBSD target. + Copyright (C) 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. */ + +/* We settle for little endian for now. */ +#define TARGET_ENDIAN_DEFAULT 0 + +#include <alpha/alpha.h> + +#define OBSD_NO_DYNAMIC_LIBRARIES +#define OBSD_HAS_DECLARE_FUNCTION_NAME +#define OBSD_HAS_DECLARE_FUNCTION_SIZE +#define OBSD_HAS_DECLARE_OBJECT + +/* alpha ecoff supports only weak aliases, see below. */ +#define ASM_WEAKEN_LABEL(FILE,NAME) ASM_OUTPUT_WEAK_ALIAS (FILE,NAME,0) + +#include <openbsd.h> + +/* Controlling the compilation driver. */ + +/* alpha needs __start. */ +#undef LINK_SPEC +#define LINK_SPEC \ + "%{!nostdlib:%{!r*:%{!e*:-e __start}}} -dc -dp %{assert*}" + +/* run-time target specifications */ +#define CPP_PREDEFINES "-D__unix__ -D__ANSI_COMPAT -Asystem(unix) \ +-D__OpenBSD__ -D__alpha__ -D__alpha" + +/* Layout of source language data types. */ + +/* This must agree with <machine/ansi.h> */ +#undef SIZE_TYPE +#define SIZE_TYPE "long unsigned int" + +#undef PTRDIFF_TYPE +#define PTRDIFF_TYPE "long int" + +#undef WCHAR_TYPE +#define WCHAR_TYPE "int" + +#undef WCHAR_TYPE_SIZE +#define WCHAR_TYPE_SIZE 32 + + +#undef PREFERRED_DEBUGGING_TYPE +#define PREFERRED_DEBUGGING_TYPE DBX_DEBUG + +#define LOCAL_LABEL_PREFIX "." + +/* We don't have an init section yet. */ +#undef HAS_INIT_SECTION + +/* collect2 support (assembler format: macros for initialization). */ + +/* Don't tell collect2 we use COFF as we don't have (yet ?) a dynamic ld + library with the proper functions to handle this -> collect2 will + default to using nm. */ +#undef OBJECT_FORMAT_COFF +#undef EXTENDED_COFF + +/* Assembler format: exception region output. */ + +/* All configurations that don't use elf must be explicit about not using + dwarf unwind information. egcs doesn't try too hard to check internal + configuration files... */ +#ifdef INCOMING_RETURN_ADDR_RTX +#undef DWARF2_UNWIND_INFO +#define DWARF2_UNWIND_INFO 0 +#endif + +/* Assembler format: file framework. */ + +/* Taken from alpha/osf.h. This used to be common to all alpha + configurations, but elf has departed from it. + Check alpha/alpha.h, alpha/osf.h for it when egcs is upgraded. */ +#ifndef 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"); \ + if (TARGET_SUPPORT_ARCH) \ + fprintf (FILE, "\t.arch %s\n", \ + alpha_cpu == PROCESSOR_EV6 ? "ev6" \ + : (alpha_cpu == PROCESSOR_EV5 \ + ? (TARGET_MAX ? "pca56" : TARGET_BWX ? "ev56" : "ev5") \ + : "ev4")); \ + \ + ASM_OUTPUT_SOURCE_FILENAME (FILE, main_input_filename); \ +} +#endif + +/* Assembler format: label output. */ + +#define ASM_OUTPUT_WEAK_ALIAS(FILE,NAME,VALUE) \ + do { \ + fputs ("\t.weakext\t", FILE); \ + assemble_name (FILE, NAME); \ + if (VALUE) \ + { \ + fputs (" , ", FILE); \ + assemble_name (FILE, VALUE); \ + } \ + fputc ('\n', FILE); \ + } while (0) + + diff --git a/gcc/config/alpha/xm-openbsd.h b/gcc/config/alpha/xm-openbsd.h new file mode 100644 index 00000000000..50f436695a7 --- /dev/null +++ b/gcc/config/alpha/xm-openbsd.h @@ -0,0 +1,23 @@ +/* Configuration file for an host running alpha OpenBSD. + Copyright (C) 1999 Free Software Foundation, Inc. + +This file is part of GNU CC. + +GNU CC is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU CC is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU CC; see the file COPYING. If not, write to +the Free Software Foundation, 59 Temple Place - Suite 330, +Boston, MA 02111-1307, USA. */ + +#include <xm-openbsd.h> +#include <alpha/xm-alpha.h> + diff --git a/gcc/config/arm/ecos-elf.h b/gcc/config/arm/ecos-elf.h new file mode 100644 index 00000000000..9fdc64ae6cd --- /dev/null +++ b/gcc/config/arm/ecos-elf.h @@ -0,0 +1,29 @@ +/* Definitions for ecos based ARM systems using ELF + 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 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. */ +#define TARGET_VERSION fputs (" (ARM/ELF Ecos)", stderr); + +#define HAS_INIT_SECTION + +#include "unknown-elf.h" + +#undef INVOKE_main + diff --git a/gcc/config/arm/elf.h b/gcc/config/arm/elf.h new file mode 100644 index 00000000000..c887ba2e85f --- /dev/null +++ b/gcc/config/arm/elf.h @@ -0,0 +1,334 @@ +/* Definitions of target machine for GNU compiler, + for ARM with ELF obj format. + Copyright (C) 1995, 1996, 1997, 1998, 1999 Free Software Foundation, Inc. + Contributed by Philip Blundell <philb@gnu.org> and + 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 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 OBJECT_FORMAT_ELF + +#ifndef LOCAL_LABEL_PREFIX +#define LOCAL_LABEL_PREFIX "." +#endif + +#ifndef USER_LABEL_PREFIX +#define USER_LABEL_PREFIX "" +#endif + +#ifndef CPP_PREDEFINES +#define CPP_PREDEFINES "-Darm -Darm_elf -Acpu(arm) -Amachine(arm) -D__ELF__" +#endif + +/* The following macro defines the format used to output the second + operand of the .type assembler directive. Different svr4 assemblers + expect various different forms for this operand. The one given here + is just a default. You may need to override it in your machine- + specific tm.h file (depending upon the particulars of your assembler). */ +#define TYPE_OPERAND_FMT "%s" + +/* Write the extra assembler code needed to declare a function's result. + Most svr4 assemblers don't require any special declaration of the + result value, but there are exceptions. */ +#ifndef ASM_DECLARE_RESULT +#define ASM_DECLARE_RESULT(FILE, RESULT) +#endif + +/* These macros generate the special .type and .size directives which + are used to set the corresponding fields of the linker symbol table + entries in an ELF object file under SVR4. These macros also output + the starting labels for the relevant functions/objects. */ +#define TYPE_ASM_OP ".type" +#define SIZE_ASM_OP ".size" + +/* Write the extra assembler code needed to declare a function properly. + Some svr4 assemblers need to also have something extra said about the + function's return value. We allow for that here. */ +#define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL) \ + do { \ + fprintf (FILE, "\t%s\t ", TYPE_ASM_OP); \ + assemble_name (FILE, NAME); \ + putc (',', FILE); \ + fprintf (FILE, TYPE_OPERAND_FMT, "function"); \ + putc ('\n', FILE); \ + ASM_DECLARE_RESULT (FILE, DECL_RESULT (DECL)); \ + ASM_OUTPUT_LABEL(FILE, NAME); \ + } while (0) + +/* Write the extra assembler code needed to declare an object properly. */ +#define ASM_DECLARE_OBJECT_NAME(FILE, NAME, DECL) \ + do { \ + fprintf (FILE, "\t%s\t ", TYPE_ASM_OP); \ + assemble_name (FILE, NAME); \ + putc (',', FILE); \ + fprintf (FILE, TYPE_OPERAND_FMT, "object"); \ + putc ('\n', FILE); \ + size_directive_output = 0; \ + if (!flag_inhibit_size_directive && DECL_SIZE (DECL)) \ + { \ + size_directive_output = 1; \ + fprintf (FILE, "\t%s\t ", SIZE_ASM_OP); \ + assemble_name (FILE, NAME); \ + putc (',', FILE); \ + fprintf (FILE, HOST_WIDE_INT_PRINT_DEC, \ + int_size_in_bytes (TREE_TYPE (DECL))); \ + fputc ('\n', FILE); \ + } \ + ASM_OUTPUT_LABEL(FILE, NAME); \ + } while (0) + +/* Output the size directive for a decl in rest_of_decl_compilation + in the case where we did not do so before the initializer. + Once we find the error_mark_node, we know that the value of + size_directive_output was set + by ASM_DECLARE_OBJECT_NAME when it was run for the same decl. */ +#define ASM_FINISH_DECLARE_OBJECT(FILE, DECL, TOP_LEVEL, AT_END) \ +do { \ + char * name = XSTR (XEXP (DECL_RTL (DECL), 0), 0); \ + if (!flag_inhibit_size_directive && DECL_SIZE (DECL) \ + && ! AT_END && TOP_LEVEL \ + && DECL_INITIAL (DECL) == error_mark_node \ + && !size_directive_output) \ + { \ + size_directive_output = 1; \ + fprintf (FILE, "\t%s\t ", SIZE_ASM_OP); \ + assemble_name (FILE, name); \ + putc (',', FILE); \ + fprintf (FILE, HOST_WIDE_INT_PRINT_DEC, \ + int_size_in_bytes (TREE_TYPE (DECL))); \ + fputc ('\n', FILE); \ + } \ + } while (0) + +/* This is how to declare the size of a function. */ +#define ASM_DECLARE_FUNCTION_SIZE(FILE, FNAME, DECL) \ + do { \ + if (!flag_inhibit_size_directive) \ + { \ + char label[256]; \ + static int labelno; \ + labelno ++; \ + ASM_GENERATE_INTERNAL_LABEL (label, "Lfe", labelno); \ + ASM_OUTPUT_INTERNAL_LABEL (FILE, "Lfe", labelno); \ + fprintf (FILE, "\t%s\t ", SIZE_ASM_OP); \ + assemble_name (FILE, (FNAME)); \ + fprintf (FILE, ","); \ + assemble_name (FILE, label); \ + fprintf (FILE, "-"); \ + assemble_name (FILE, (FNAME)); \ + putc ('\n', FILE); \ + } \ + } while (0) + +/* Define this macro if jump tables (for `tablejump' insns) should be + output in the text section, along with the assembler instructions. + Otherwise, the readonly data section is used. */ +#define JUMP_TABLES_IN_TEXT_SECTION 1 + +#ifndef ASM_SPEC +#define ASM_SPEC "%{mbig-endian:-EB} %{mcpu=*:-m%*} %{march=*:-m%*} \ + %{mapcs-*:-mapcs-%*} %{mthumb-interwork:-mthumb-interwork} %{mapcs-float:mfloat}" +#endif + +#ifndef LINK_SPEC +#define LINK_SPEC "%{mbig-endian:-EB} -X" +#endif + +/* Run-time Target Specification. */ +#ifndef TARGET_VERSION +#define TARGET_VERSION fputs (" (ARM/elf)", stderr) +#endif + +#ifndef TARGET_DEFAULT +#define TARGET_DEFAULT (ARM_FLAG_SOFT_FLOAT | ARM_FLAG_APCS_32) +#endif + +#ifndef MULTILIB_DEFAULTS +#define MULTILIB_DEFAULTS { "mlittle-endian", "msoft-float", "mapcs-32", "mno-thumb-interwork" } +#endif + +/* Setting this to 32 produces more efficient code, but the value set in previous + versions of this toolchain was 8, which produces more compact structures. The + command line option -mstructure_size_boundary=<n> can be used to change this + value. */ +#undef STRUCTURE_SIZE_BOUNDARY +#define STRUCTURE_SIZE_BOUNDARY arm_structure_size_boundary + +extern int arm_structure_size_boundary; + +/* A C expression whose value is nonzero if IDENTIFIER with arguments ARGS + is a valid machine specific attribute for DECL. + The attributes in ATTRIBUTES have previously been assigned to DECL. */ +#define VALID_MACHINE_DECL_ATTRIBUTE(DECL, ATTRIBUTES, IDENTIFIER, ARGS) \ +arm_valid_machine_decl_attribute (DECL, IDENTIFIER, ARGS) + + +/* A C statement to output assembler commands which will identify the + object file as having been compiled with GNU CC (or another GNU + compiler). */ +/* Define this to NULL so we don't get anything. + We have ASM_IDENTIFY_LANGUAGE. + Also, when using stabs, gcc2_compiled must be a stabs entry, not an + ordinary symbol, or gdb won't see it. The stabs entry must be + before the N_SO in order for gdb to find it. */ +#ifndef ASM_IDENTIFY_GCC +#define ASM_IDENTIFY_GCC(STREAM) \ + fprintf (STREAM, "%sgcc2_compiled.:\n", LOCAL_LABEL_PREFIX ) +#endif + +/* This outputs a lot of .req's to define alias for various registers. + Let's try to avoid this. */ +#ifndef ASM_FILE_START +#define ASM_FILE_START(STREAM) \ +do { \ + extern char * version_string; \ + fprintf (STREAM, "%s Generated by gcc %s for ARM/elf\n", \ + ASM_COMMENT_START, version_string); \ + output_file_directive ((STREAM), main_input_filename); \ +} while (0) +#endif + +/* Output an internal label definition. */ +#ifndef ASM_OUTPUT_INTERNAL_LABEL +#define ASM_OUTPUT_INTERNAL_LABEL(STREAM, PREFIX, NUM) \ + do \ + { \ + char * s = (char *) alloca (40 + strlen (PREFIX)); \ + extern int arm_target_label, arm_ccfsm_state; \ + extern rtx arm_target_insn; \ + \ + if (arm_ccfsm_state == 3 && arm_target_label == (NUM) \ + && !strcmp (PREFIX, "L")) \ + { \ + arm_ccfsm_state = 0; \ + arm_target_insn = NULL; \ + } \ + ASM_GENERATE_INTERNAL_LABEL (s, (PREFIX), (NUM)); \ + ASM_OUTPUT_LABEL (STREAM, s); \ + } while (0) +#endif + +/* Support the ctors/dtors and other sections. */ + +/* 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.) */ +#ifndef CTORS_SECTION_ASM_OP +#define CTORS_SECTION_ASM_OP "\t.section\t.ctors,\"aw\"" +#endif + +#ifndef DTORS_SECTION_ASM_OP +#define DTORS_SECTION_ASM_OP "\t.section\t.dtors,\"aw\"" +#endif + +/* A list of other sections which the compiler might be "in" at any + given time. */ +#ifndef SUBTARGET_EXTRA_SECTIONS +#define SUBTARGET_EXTRA_SECTIONS +#endif + +#ifndef EXTRA_SECTIONS +#define EXTRA_SECTIONS SUBTARGET_EXTRA_SECTIONS in_ctors, in_dtors +#endif + +/* A list of extra section function definitions. */ +#ifndef SUBTARGET_EXTRA_SECTION_FUNCTIONS +#define SUBTARGET_EXTRA_SECTION_FUNCTIONS +#endif + +#ifndef EXTRA_SECTION_FUNCTIONS +#define EXTRA_SECTION_FUNCTIONS \ + SUBTARGET_EXTRA_SECTION_FUNCTIONS \ + CTORS_SECTION_FUNCTION \ + DTORS_SECTION_FUNCTION +#endif + +#ifndef CTORS_SECTION_FUNCTION +#define CTORS_SECTION_FUNCTION \ +void \ +ctors_section () \ +{ \ + if (in_section != in_ctors) \ + { \ + fprintf (asm_out_file, "%s\n", CTORS_SECTION_ASM_OP); \ + in_section = in_ctors; \ + } \ +} +#endif + +#ifndef DTORS_SECTION_FUNCTION +#define DTORS_SECTION_FUNCTION \ +void \ +dtors_section () \ +{ \ + if (in_section != in_dtors) \ + { \ + fprintf (asm_out_file, "%s\n", DTORS_SECTION_ASM_OP); \ + in_section = in_dtors; \ + } \ +} +#endif + +/* Support the ctors/dtors sections for g++. */ +#ifndef INT_ASM_OP +#define INT_ASM_OP ".word" +#endif + +/* A C statement (sans semicolon) to output an element in the table of + global constructors. */ +#ifndef ASM_OUTPUT_CONSTRUCTOR +#define ASM_OUTPUT_CONSTRUCTOR(STREAM,NAME) \ +do { \ + ctors_section (); \ + fprintf (STREAM, "\t%s\t ", INT_ASM_OP); \ + assemble_name (STREAM, NAME); \ + fprintf (STREAM, "\n"); \ +} while (0) +#endif + +/* A C statement (sans semicolon) to output an element in the table of + global destructors. */ +#ifndef ASM_OUTPUT_DESTRUCTOR +#define ASM_OUTPUT_DESTRUCTOR(STREAM,NAME) \ +do { \ + dtors_section (); \ + fprintf (STREAM, "\t%s\t ", INT_ASM_OP); \ + assemble_name (STREAM, NAME); \ + fprintf (STREAM, "\n"); \ +} while (0) +#endif + +/* 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) + +#include "arm/aout.h" diff --git a/gcc/config/arm/linux-aout.h b/gcc/config/arm/linux-aout.h new file mode 100644 index 00000000000..3a853bd9d9e --- /dev/null +++ b/gcc/config/arm/linux-aout.h @@ -0,0 +1,58 @@ +/* Definitions for ARM running Linux-based GNU systems using a.out. + Copyright (C) 1993, 1994, 1997, 1998 Free Software Foundation, Inc. + Contributed by Russell King <rmk92@ecs.soton.ac.uk>. + +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. */ + +#include <linux-aout.h> + +/* these are different... */ +#undef STARTFILE_SPEC +#define STARTFILE_SPEC \ +"%{pg:gcrt0.o%s} %{!pg:%{p:gcrt0.o%s} %{!p:crt0.o%s}} %{static:-static}" + +#undef ASM_APP_ON +#undef ASM_APP_OFF +#undef COMMENT_BEGIN + +/* We default to ARM3. */ +#define SUBTARGET_CPU_DEFAULT TARGET_CPU_arm3 + +#undef CPP_PREDEFINES +#define CPP_PREDEFINES \ +"-Dunix -Darm -Dlinux -Asystem(unix) -Asystem(posix) -Acpu(arm) -Amachine(arm)" + +#undef LIB_SPEC +#define LIB_SPEC \ + "%{mieee-fp:-lieee} %{p:-lgmon} %{pg:-lgmon} %{!ggdb:-lc} %{ggdb:-lg}" + +#define HANDLE_SYSV_PRAGMA + +/* Run-time Target Specification. */ +#define TARGET_VERSION fputs (" (ARM GNU/Linux with a.out)", stderr); + +/* + * Maths operation domain error number, EDOM + * We don't really want this for libc6. However, taking it out would be + * too much of a pain for now and it doesn't hurt much. + */ +#define TARGET_EDOM 33 + +#include "arm/aout.h" + +#include "arm/linux-gas.h" diff --git a/gcc/config/arm/linux-elf.h b/gcc/config/arm/linux-elf.h new file mode 100644 index 00000000000..254b6fd506c --- /dev/null +++ b/gcc/config/arm/linux-elf.h @@ -0,0 +1,242 @@ +/* Definitions for ARM running Linux-based GNU systems using ELF + Copyright (C) 1993, 1994, 1997, 1998, 1999 Free Software Foundation, Inc. + Contributed by Philip Blundell <philb@gnu.org> + +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. */ +#define TARGET_VERSION fputs (" (ARM GNU/Linux with ELF)", stderr); + +/* We have libgcc2. */ +#define HAVE_ATEXIT + +/* Default is to use APCS-32 mode. */ +#ifndef SUBTARGET_DEFAULT_APCS26 +#define TARGET_DEFAULT (ARM_FLAG_APCS_32 | ARM_FLAG_SHORT_BYTE) +#define SUBTARGET_EXTRA_LINK_SPEC \ + " %{mapcs-26:-m elf32arm26} %{!mapcs-26:-m elf32arm}" +#define SUBTARGET_EXTRA_ASM_SPEC \ + " %{mapcs-26:-mapcs-26} %(!mapcs-26:-mapcs-32}" +#endif + +/* This was defined in linux.h. Define it here also. */ +#undef DEFAULT_VTABLE_THUNKS +#define DEFAULT_VTABLE_THUNKS 1 + +/* Handle #pragma weak and #pragma pack. */ +#define HANDLE_SYSV_PRAGMA + +/* Now we define the strings used to build the spec file. */ +#define LIB_SPEC \ + "%{shared: -lc} \ + %{!shared: %{pthread:-lpthread} \ + %{profile:-lc_p} %{!profile: -lc}}" + +#define LIBGCC_SPEC "%{msoft-float:-lfloat} -lgcc" + +/* Provide a STARTFILE_SPEC appropriate for GNU/Linux. Here we add + the GNU/Linux magical crtbegin.o file (see crtstuff.c) which + provides part of the support for getting C++ file-scope static + object constructed before entering `main'. */ + +#define STARTFILE_SPEC \ + "%{!shared: \ + %{pg:gcrt1.o%s} %{!pg:%{p:gcrt1.o%s} \ + %{!p:%{profile:gcrt1.o%s} \ + %{!profile:crt1.o%s}}}} \ + crti.o%s %{!shared:crtbegin.o%s} %{shared:crtbeginS.o%s}" + +/* Provide a ENDFILE_SPEC appropriate for GNU/Linux. Here we tack on + the GNU/Linux magical crtend.o file (see crtstuff.c) which + provides part of the support for getting C++ file-scope static + object constructed before entering `main', followed by a normal + GNU/Linux "finalizer" file, `crtn.o'. */ + +#define ENDFILE_SPEC \ + "%{!shared:crtend.o%s} %{shared:crtendS.o%s} crtn.o%s" + +#define LINK_SPEC "%{h*} %{version:-v} \ + %{b} %{Wl,*:%*} \ + %{static:-Bstatic} \ + %{shared:-shared} \ + %{symbolic:-Bsymbolic} \ + %{rdynamic:-export-dynamic} \ + %{!dynamic-linker:-dynamic-linker /lib/ld-linux.so.2} \ + -X \ + %{mbig-endian:-EB}" \ + SUBTARGET_EXTRA_LINK_SPEC + +#undef CPP_PREDEFINES +#define CPP_PREDEFINES \ +"-Dunix -Darm -Dlinux -Asystem(unix) -Asystem(posix) -Acpu(arm) \ +-Amachine(arm) -D__ELF__ -Darm_elf" + +#ifndef SUBTARGET_DEFAULT_APCS26 +#undef CPP_APCS_PC_DEFAULT_SPEC +#define CPP_APCS_PC_DEFAULT_SPEC "-D__APCS_32__" +/* On 32-bit machine it is always safe to assume we have the "new" + floating point system. */ +#undef FP_DEFAULT +#define FP_DEFAULT FP_SOFT3 +#endif + +/* Allow #sccs in preprocessor. */ +#define SCCS_DIRECTIVE + +#define USER_LABEL_PREFIX "" /* For ELF the default is no underscores */ +#define LOCAL_LABEL_PREFIX "." + +/* Attach a special .ident directive to the end of the file to identify + the version of GCC which compiled this code. */ +#define IDENT_ASM_OP ".ident" + +/* Output #ident as a .ident. */ +#define ASM_OUTPUT_IDENT(FILE, NAME) \ + fprintf (FILE, "\t%s\t\"%s\"\n", IDENT_ASM_OP, NAME); + +#ifdef IDENTIFY_WITH_IDENT +#define ASM_IDENTIFY_GCC(FILE) /* nothing */ +#define ASM_IDENTIFY_LANGUAGE(FILE) \ + fprintf (FILE, "\t%s \"GCC (%s) %s\"\n", IDENT_ASM_OP, \ + lang_identify (), version_string) +#else +#define ASM_FILE_END(FILE) \ +do { \ + if (!flag_no_ident) \ + fprintf ((FILE), "\t%s\t\"GCC: (GNU) %s\"\n", \ + IDENT_ASM_OP, version_string); \ + } while (0) +#endif + +/* Support const sections and the ctors and dtors sections for g++. + Note that there appears to be two different ways to support const + sections at the moment. You can either #define the symbol + READONLY_DATA_SECTION (giving it some code which switches to the + readonly data section) or else you can #define the symbols + EXTRA_SECTIONS, EXTRA_SECTION_FUNCTIONS, SELECT_SECTION, and + SELECT_RTX_SECTION. We do both here just to be on the safe side. */ +#define USE_CONST_SECTION 1 + +/* Support for Constructors and Destructors. */ +#define READONLY_DATA_SECTION() const_section () + +/* A default list of other sections which we might be "in" at any given + time. For targets that use additional sections (e.g. .tdesc) you + should override this definition in the target-specific file which + includes this file. */ +#define SUBTARGET_EXTRA_SECTIONS in_const, + +/* A default list of extra section function definitions. For targets + that use additional sections (e.g. .tdesc) you should override this + definition in the target-specific file which includes this file. */ +#define SUBTARGET_EXTRA_SECTION_FUNCTIONS CONST_SECTION_FUNCTION + +extern void text_section (); + +#define CONST_SECTION_ASM_OP ".section\t.rodata" + +#define CONST_SECTION_FUNCTION \ +void \ +const_section () \ +{ \ + if (!USE_CONST_SECTION) \ + text_section (); \ + else if (in_section != in_const) \ + { \ + fprintf (asm_out_file, "%s\n", CONST_SECTION_ASM_OP); \ + in_section = in_const; \ + } \ +} + +/* Switch into a generic section. + This is currently only used to support section attributes. + + We make the section read-only and executable for a function decl, + read-only for a const data decl, and writable for a non-const data decl. */ +#define ASM_OUTPUT_SECTION_NAME(FILE, DECL, NAME, RELOC) \ + fprintf (FILE, ".section\t%s,\"%s\",%%progbits\n", NAME, \ + (DECL) && TREE_CODE (DECL) == FUNCTION_DECL ? "ax" : \ + (DECL) && DECL_READONLY_SECTION (DECL, RELOC) ? "a" : "aw") + +/* A C statement or statements to switch to the appropriate + section for output of DECL. DECL is either a `VAR_DECL' node + or a constant of some sort. RELOC indicates whether forming + the initial value of DECL requires link-time relocations. */ +#define SELECT_SECTION(DECL,RELOC) \ +{ \ + if (TREE_CODE (DECL) == STRING_CST) \ + { \ + if (! flag_writable_strings) \ + const_section (); \ + else \ + data_section (); \ + } \ + else if (TREE_CODE (DECL) == VAR_DECL) \ + { \ + if ((flag_pic && RELOC) \ + || !TREE_READONLY (DECL) || TREE_SIDE_EFFECTS (DECL) \ + || !DECL_INITIAL (DECL) \ + || (DECL_INITIAL (DECL) != error_mark_node \ + && !TREE_CONSTANT (DECL_INITIAL (DECL)))) \ + data_section (); \ + else \ + const_section (); \ + } \ + else \ + const_section (); \ +} + +/* A C statement or statements to switch to the appropriate + section for output of RTX in mode MODE. RTX is some kind + of constant in RTL. The argument MODE is redundant except + in the case of a `const_int' rtx. Currently, these always + go into the const section. */ +#define SELECT_RTX_SECTION(MODE,RTX) const_section () + +/* On svr4, we *do* have support for the .init and .fini sections, and we + can put stuff in there to be executed before and after `main'. We let + crtstuff.c and other files know this by defining the following symbols. + The definitions say how to change sections to the .init and .fini + sections. This is the same for all known svr4 assemblers. */ +#define INIT_SECTION_ASM_OP ".section\t.init" +#define FINI_SECTION_ASM_OP ".section\t.fini" + + +/* 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) + +/* This is how we tell the assembler that two symbols have the same value. */ + +#define ASM_OUTPUT_DEF(FILE,NAME1,NAME2) \ + do { assemble_name (FILE, NAME1); \ + fputs (" = ", FILE); \ + assemble_name (FILE, NAME2); \ + fputc ('\n', FILE); } while (0) + +/* Make DWARF2 an option, but keep DBX as the default for now. + Use -gdwarf-2 to turn on DWARF2. */ +#define DWARF2_DEBUGGING_INFO +#define PREFERRED_DEBUGGING_TYPE DBX_DEBUG + +/* Get the standard ELF stabs definitions. */ +#include "dbxelf.h" + +#include "arm/elf.h" +#include "arm/linux-gas.h" diff --git a/gcc/config/arm/linux-elf26.h b/gcc/config/arm/linux-elf26.h new file mode 100644 index 00000000000..aa65ae7f750 --- /dev/null +++ b/gcc/config/arm/linux-elf26.h @@ -0,0 +1,32 @@ +/* Definitions for 26-bit ARM running Linux-based GNU systems using ELF + Copyright (C) 1998 Free Software Foundation, Inc. + Contributed by Philip Blundell <philb@gnu.org> + +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. */ + +#define SUBTARGET_DEFAULT_APCS26 + +#define SUBTARGET_LINK_SPEC \ + " %{mapcs-32:-m elf32arm} %{!mapcs-32:-m elf32arm26}" + +#define SUBTARGET_EXTRA_ASM_SPEC \ + " %{mapcs-32:-mapcs-32} %(!mapcs-32:-mapcs-26}" + +#define TARGET_DEFAULT (ARM_FLAG_SHORT_BYTE) + +#include "arm/linux-elf.h" diff --git a/gcc/config/arm/t-arm-elf b/gcc/config/arm/t-arm-elf new file mode 100644 index 00000000000..ee727fe3842 --- /dev/null +++ b/gcc/config/arm/t-arm-elf @@ -0,0 +1,35 @@ +CROSS_LIBGCC1 = libgcc1-asm.a +LIB1ASMSRC = arm/lib1funcs.asm +LIB1ASMFUNCS = _udivsi3 _divsi3 _umodsi3 _modsi3 _dvmd_tls + +# These are really part of libgcc1, but this will cause them to be +# built correctly, so... + +LIB2FUNCS_EXTRA = fp-bit.c 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 mapcs-32/mapcs-26 fno-leading-underscore/fleading-underscore +# MULTILIB_DIRNAMES = le be fpu soft 32bit 26bit elf under +# MULTILIB_EXCEPTIONS = +# MULTILIB_MATCHES = +# EXTRA_MULTILIB_PARTS = crtbegin.o crtend.o +# LIBGCC = stmp-multilib +# INSTALL_LIBGCC = install-multilib + +# If EXTRA_MULTILIB_PARTS is not defined above then define EXTRA_PARTS here +EXTRA_PARTS = crtbegin.o crtend.o + +TARGET_LIBGCC2_CFLAGS = -Dinhibit_libc diff --git a/gcc/config/arm/unknown-elf-oabi.h b/gcc/config/arm/unknown-elf-oabi.h new file mode 100644 index 00000000000..22aacf60031 --- /dev/null +++ b/gcc/config/arm/unknown-elf-oabi.h @@ -0,0 +1,36 @@ +/* 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. */ +#ifndef TARGET_VERSION +#define TARGET_VERSION fputs (" (ARM/ELF non-Linux old abi)", stderr); +#endif + +#define CPP_PREDEFINES "-Darm_oabi -Darm -Darm_elf -Acpu(arm) -Amachine(arm) -D__ELF__" + +#ifndef ASM_SPEC +#define ASM_SPEC "-moabi %{mbig-endian:-EB} %{mcpu=*:-m%*} %{march=*:-m%*} \ + %{mapcs-*:-mapcs-%*} %{mthumb-interwork:-mthumb-interwork}" +#endif + +/* Now get the routine arm-elf definitions. */ +#include "arm/unknown-elf.h" +#include "arm/elf.h" diff --git a/gcc/config/arm/unknown-elf.h b/gcc/config/arm/unknown-elf.h new file mode 100644 index 00000000000..5fa5d726b10 --- /dev/null +++ b/gcc/config/arm/unknown-elf.h @@ -0,0 +1,164 @@ +/* Definitions for non-Linux based ARM systems using ELF + Copyright (C) 1998 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. */ +#ifndef TARGET_VERSION +#define TARGET_VERSION fputs (" (ARM/ELF non-Linux)", stderr); +#endif + +/* If you don't define HAVE_ATEXIT, and the object file format/OS/whatever + does not support constructors/destructors, then gcc implements destructors + by defining its own exit function, which calls the destructors. This gcc + exit function overrides the C library's exit function, and this can cause + all kinds of havoc if the C library has a non-trivial exit function. You + really don't want to use the exit function in libgcc2.c. */ +#define HAVE_ATEXIT + +/* Default to using APCS-32 and software floating point. */ +#define TARGET_DEFAULT (ARM_FLAG_SOFT_FLOAT | ARM_FLAG_APCS_32) + +/* Now we define the strings used to build the spec file. */ +#define STARTFILE_SPEC "crtbegin%O%s crt0%O%s" + +#define ENDFILE_SPEC "crtend%O%s" + +#define USER_LABEL_PREFIX "" +#define LOCAL_LABEL_PREFIX "." + +#define TEXT_SECTION " .text" + +#define INVOKE__main + +/* Debugging */ +#define DWARF_DEBUGGING_INFO +#define DWARF2_DEBUGGING_INFO +#define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG + +/* Support for Constructors and Destrcutors . */ +#define READONLY_DATA_SECTION rdata_section + +/* A list of other sections which the compiler might be "in" at any + given time. */ +#define SUBTARGET_EXTRA_SECTIONS in_rdata, + +/* A list of extra section function definitions. */ +#define SUBTARGET_EXTRA_SECTION_FUNCTIONS RDATA_SECTION_FUNCTION + +#define RDATA_SECTION_ASM_OP "\t.section .rodata" + +#define RDATA_SECTION_FUNCTION \ +void \ +rdata_section () \ +{ \ + if (in_section != in_rdata) \ + { \ + fprintf (asm_out_file, "%s\n", RDATA_SECTION_ASM_OP); \ + in_section = in_rdata; \ + } \ +} + +#define CTOR_LIST_BEGIN \ +asm (CTORS_SECTION_ASM_OP); \ +func_ptr __CTOR_LIST__[1] = { (func_ptr) (-1) } + +#define CTOR_LIST_END \ +asm (CTORS_SECTION_ASM_OP); \ +func_ptr __CTOR_END__[1] = { (func_ptr) 0 }; + +#define DTOR_LIST_BEGIN \ +asm (DTORS_SECTION_ASM_OP); \ +func_ptr __DTOR_LIST__[1] = { (func_ptr) (-1) } + +#define DTOR_LIST_END \ +asm (DTORS_SECTION_ASM_OP); \ +func_ptr __DTOR_END__[1] = { (func_ptr) 0 }; + +/* A C statement to output something to the assembler file to switch to section + NAME for object DECL which is either a FUNCTION_DECL, a VAR_DECL or + NULL_TREE. Some target formats do not support arbitrary sections. Do not + define this macro in such cases. */ +#define ASM_OUTPUT_SECTION_NAME(STREAM, DECL, NAME, RELOC) \ +do { \ + if ((DECL) && TREE_CODE (DECL) == FUNCTION_DECL) \ + fprintf (STREAM, "\t.section %s,\"ax\",@progbits\n", (NAME)); \ + else if ((DECL) && DECL_READONLY_SECTION (DECL, RELOC)) \ + fprintf (STREAM, "\t.section %s,\"a\"\n", (NAME)); \ + else \ + fprintf (STREAM, "\t.section %s,\"aw\"\n", (NAME)); \ +} while (0) + +/* Don't know how to order these. UNALIGNED_WORD_ASM_OP is in + dwarf2.out. */ +#define UNALIGNED_WORD_ASM_OP ".4byte" + +#define ASM_OUTPUT_DWARF2_ADDR_CONST(FILE,ADDR) \ + fprintf ((FILE), "\t%s\t%s", UNALIGNED_WORD_ASM_OP, ADDR) + +#define ASM_OUTPUT_DWARF_ADDR_CONST(FILE,RTX) \ +do { \ + fprintf ((FILE), "\t%s\t", UNALIGNED_WORD_ASM_OP); \ + output_addr_const ((FILE), (RTX)); \ + fputc ('\n', (FILE)); \ +} while (0) + + +/* The ARM development system defines __main. */ +#define NAME__MAIN "__gccmain" +#define SYMBOL__MAIN __gccmain + +#define MAKE_DECL_ONE_ONLY(DECL) (DECL_WEAK (DECL) = 1) +#define UNIQUE_SECTION_P(DECL) (DECL_ONE_ONLY (DECL)) +#define UNIQUE_SECTION(DECL,RELOC) \ +do { \ + int len; \ + char * name, * string, * prefix; \ + \ + name = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (DECL)); \ + \ + if (! DECL_ONE_ONLY (DECL)) \ + { \ + prefix = "."; \ + if (TREE_CODE (DECL) == FUNCTION_DECL) \ + prefix = ".text."; \ + else if (DECL_READONLY_SECTION (DECL, RELOC)) \ + prefix = ".rodata."; \ + else \ + prefix = ".data."; \ + } \ + else if (TREE_CODE (DECL) == FUNCTION_DECL) \ + prefix = ".gnu.linkonce.t."; \ + else if (DECL_READONLY_SECTION (DECL, RELOC)) \ + prefix = ".gnu.linkonce.r."; \ + else \ + prefix = ".gnu.linkonce.d."; \ + \ + len = strlen (name) + strlen (prefix); \ + string = alloca (len + 1); \ + sprintf (string, "%s%s", prefix, name); \ + \ + DECL_SECTION_NAME (DECL) = build_string (len, string); \ +} while (0) + +#define CPP_APCS_PC_DEFAULT_SPEC "-D__APCS_32__" +#define SUBTARGET_CPU_DEFAULT TARGET_CPU_arm7tdmi + +/* Now get the routine arm-elf definitions. */ +#include "arm/elf.h" diff --git a/gcc/config/arm/vxarm.h b/gcc/config/arm/vxarm.h new file mode 100644 index 00000000000..b42bbbec00c --- /dev/null +++ b/gcc/config/arm/vxarm.h @@ -0,0 +1,73 @@ +/* Definitions of target machine for GNU compiler, + for ARM with targetting the VXWorks run time environment. + Copyright (C) 1999 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 + +#include "arm/coff.h" + +#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}} \ +" +#undef CPP_PREDEFINES +#define CPP_PREDEFINES "-D__vxworks -D__arm__ -Acpu(arm) -Amachine(arm)" + +/* 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 \ +{ \ + extern char * version_string; \ + fprintf (STREAM, "%s Generated by gcc %s for ARM/VxWorks\n", \ + ASM_COMMENT_START, version_string); \ +} while (0) diff --git a/gcc/config/dbxelf.h b/gcc/config/dbxelf.h new file mode 100644 index 00000000000..9472887cc52 --- /dev/null +++ b/gcc/config/dbxelf.h @@ -0,0 +1,105 @@ +/* Definitions needed when using stabs embedded in ELF sections. + Copyright (C) 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. */ + +/* This file may be included by any ELF target which wishes to + support -gstabs generating stabs in sections, as produced by gas + and understood by gdb. */ + +#ifndef __DBX_ELF_H +#define __DBX_ELF_H + +/* Output DBX (stabs) debugging information if doing -gstabs. */ + +#undef DBX_DEBUGGING_INFO +#define DBX_DEBUGGING_INFO + +/* Make LBRAC and RBRAC addresses relative to the start of the + function. The native Solaris stabs debugging format works this + way, gdb expects it, and it reduces the number of relocation + entries... */ + +#undef DBX_BLOCKS_FUNCTION_RELATIVE +#define DBX_BLOCKS_FUNCTION_RELATIVE 1 + +/* ... but, to make this work, functions must appear prior to line info. */ + +#undef DBX_FUNCTION_FIRST +#define DBX_FUNCTION_FIRST + +/* When generating stabs debugging, use N_BINCL entries. */ + +#undef DBX_USE_BINCL +#define DBX_USE_BINCL + +/* There is no limit to the length of stabs strings. */ + +#ifndef DBX_CONTIN_LENGTH +#define DBX_CONTIN_LENGTH 0 +#endif + +/* When using stabs, gcc2_compiled must be a stabs entry, not an + ordinary symbol, or gdb won't see it. Furthermore, since gdb reads + the input piecemeal, starting with each N_SO, it's a lot easier if + the gcc2 flag symbol is *after* the N_SO rather than before it. So + we emit an N_OPT stab there. */ + +#define ASM_IDENTIFY_GCC(FILE) \ +do \ + { \ + if (write_symbols != DBX_DEBUG) \ + fputs ("gcc2_compiled.:\n", FILE); \ + } \ +while (0) + +#define ASM_IDENTIFY_GCC_AFTER_SOURCE(FILE) \ +do \ + { \ + if (write_symbols == DBX_DEBUG) \ + fputs ("\t.stabs\t\"gcc2_compiled.\", 0x3c, 0, 0, 0\n", FILE); \ + } \ +while (0) + +/* Like block addresses, stabs line numbers are relative to the + current function. */ + +#undef ASM_OUTPUT_SOURCE_LINE +#define ASM_OUTPUT_SOURCE_LINE(file, line) \ +do \ + { \ + static int sym_lineno = 1; \ + fprintf (file, ".stabn 68,0,%d,.LM%d-", \ + line, sym_lineno); \ + assemble_name (file, \ + XSTR (XEXP (DECL_RTL (current_function_decl), 0), 0));\ + fprintf (file, "\n.LM%d:\n", sym_lineno); \ + sym_lineno += 1; \ + } \ +while (0) + +/* Generate a blank trailing N_SO to mark the end of the .o file, since + we can't depend upon the linker to mark .o file boundaries with + embedded stabs. */ + +#undef DBX_OUTPUT_MAIN_SOURCE_FILE_END +#define DBX_OUTPUT_MAIN_SOURCE_FILE_END(FILE, FILENAME) \ + fprintf (FILE, \ + "\t.text\n\t.stabs \"\",%d,0,0,Letext\nLetext:\n", N_SO) + +#endif /* __DBX_ELF_H */ diff --git a/gcc/config/elfos.h b/gcc/config/elfos.h new file mode 100644 index 00000000000..6c107311fd7 --- /dev/null +++ b/gcc/config/elfos.h @@ -0,0 +1,704 @@ +/* elfos.h -- operating system specific defines to be used when + targeting GCC for some generic ELF system + Copyright (C) 1991, 1994, 1995, 1999 Free Software Foundation, Inc. + Based on svr4.h contributed 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. */ + +/* For the sake of libgcc2.c, indicate target supports atexit. */ +#define HAVE_ATEXIT + +#undef ENDFILE_SPEC +#define ENDFILE_SPEC "crtend.o%s" + +#undef STARTFILE_SPEC +#define STARTFILE_SPEC "%{!shared: \ + %{!symbolic: \ + %{pg:gcrt0.o%s}%{!pg:%{p:mcrt0.o%s}%{!p:crt0.o%s}}}}\ + crtbegin.o%s" + +/* Attach a special .ident directive to the end of the file to identify + the version of GCC which compiled this code. The format of the + .ident string is patterned after the ones produced by native svr4 + C compilers. */ + +#define IDENT_ASM_OP ".ident" + +#define ASM_FILE_END(FILE) \ +do { \ + if (!flag_no_ident) \ + fprintf ((FILE), "\t%s\t\"GCC: (GNU) %s\"\n", \ + IDENT_ASM_OP, version_string); \ + } while (0) + +/* Output #ident as a .ident. */ + +#define ASM_OUTPUT_IDENT(FILE, NAME) \ + fprintf (FILE, "\t%s\t\"%s\"\n", IDENT_ASM_OP, NAME); + +/* Use periods rather than dollar signs in special g++ assembler names. */ + +#define NO_DOLLAR_IN_LABEL + +/* Writing `int' for a bitfield forces int alignment for the structure. */ + +#define PCC_BITFIELD_TYPE_MATTERS 1 + +/* Implicit library calls should use memcpy, not bcopy, etc. */ + +#define TARGET_MEM_FUNCTIONS + +/* Handle #pragma weak and #pragma pack. */ + +#define HANDLE_SYSV_PRAGMA + +/* System V Release 4 uses DWARF debugging info. */ + +#define DWARF_DEBUGGING_INFO + +/* All ELF targets can support DWARF-2. */ + +#define DWARF2_DEBUGGING_INFO + +/* Also allow them to support STABS debugging. */ + +#include "dbxelf.h" + +/* The GNU tools operate better with stabs. Since we don't have + any native tools to be compatible with, default to stabs. */ + +#ifndef PREFERRED_DEBUGGING_TYPE +#define PREFERRED_DEBUGGING_TYPE DBX_DEBUG +#endif + +#undef ASM_BYTE_OP +#define ASM_BYTE_OP ".byte" + +#undef SET_ASM_OP +#define SET_ASM_OP ".set" + +/* This is how to begin an assembly language file. Most svr4 assemblers want + at least a .file directive to come first, and some want to see a .version + directive come right after that. Here we just establish a default + which generates only the .file directive. If you need a .version + directive for any specific target, you should override this definition + in the target-specific file which includes this one. */ + +#undef ASM_FILE_START +#define ASM_FILE_START(FILE) \ + output_file_directive ((FILE), main_input_filename) + +/* This is how to allocate empty space in some section. The .zero + pseudo-op is used for this on most svr4 assemblers. */ + +#define SKIP_ASM_OP ".zero" + +#undef ASM_OUTPUT_SKIP +#define ASM_OUTPUT_SKIP(FILE,SIZE) \ + fprintf (FILE, "\t%s\t%u\n", SKIP_ASM_OP, (SIZE)) + +/* This is how to output a reference to a user-level label named NAME. + `assemble_name' uses this. + + For System V Release 4 the convention is *not* to prepend a leading + underscore onto user-level symbol names. */ + +#undef ASM_OUTPUT_LABELREF +#define ASM_OUTPUT_LABELREF(FILE,NAME) fprintf (FILE, "%s", NAME) + +/* This is how to output an internal numbered label where + PREFIX is the class of label and NUM is the number within the class. + + For most svr4 systems, the convention is that any symbol which begins + with a period is not put into the linker symbol table by the assembler. */ + +#undef ASM_OUTPUT_INTERNAL_LABEL +#define ASM_OUTPUT_INTERNAL_LABEL(FILE, PREFIX, NUM) \ +do { \ + fprintf (FILE, ".%s%d:\n", PREFIX, NUM); \ +} while (0) + +/* 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'. + + For most svr4 systems, the convention is that any symbol which begins + with a period is not put into the linker symbol table by the assembler. */ + +#undef ASM_GENERATE_INTERNAL_LABEL +#define ASM_GENERATE_INTERNAL_LABEL(LABEL, PREFIX, NUM) \ +do { \ + sprintf (LABEL, "*.%s%d", PREFIX, NUM); \ +} while (0) + +/* Output the label which precedes a jumptable. Note that for all svr4 + systems where we actually generate jumptables (which is to say every + svr4 target except i386, where we use casesi instead) we put the jump- + tables into the .rodata section and since other stuff could have been + put into the .rodata section prior to any given jumptable, we have to + make sure that the location counter for the .rodata section gets pro- + perly re-aligned prior to the actual beginning of the jump table. */ + +#define ALIGN_ASM_OP ".align" + +#ifndef ASM_OUTPUT_BEFORE_CASE_LABEL +#define ASM_OUTPUT_BEFORE_CASE_LABEL(FILE,PREFIX,NUM,TABLE) \ + ASM_OUTPUT_ALIGN ((FILE), 2); +#endif + +#undef ASM_OUTPUT_CASE_LABEL +#define ASM_OUTPUT_CASE_LABEL(FILE,PREFIX,NUM,JUMPTABLE) \ + do { \ + ASM_OUTPUT_BEFORE_CASE_LABEL (FILE, PREFIX, NUM, JUMPTABLE) \ + ASM_OUTPUT_INTERNAL_LABEL (FILE, PREFIX, NUM); \ + } while (0) + +/* The standard SVR4 assembler seems to require that certain builtin + library routines (e.g. .udiv) be explicitly declared as .globl + in each assembly file where they are referenced. */ + +#define ASM_OUTPUT_EXTERNAL_LIBCALL(FILE, FUN) \ + ASM_GLOBALIZE_LABEL (FILE, XSTR (FUN, 0)) + +/* This says how to output assembler code to declare an + uninitialized external linkage data object. Under SVR4, + the linker seems to want the alignment of data objects + to depend on their types. We do exactly that here. */ + +#define COMMON_ASM_OP ".comm" + +#undef ASM_OUTPUT_ALIGNED_COMMON +#define ASM_OUTPUT_ALIGNED_COMMON(FILE, NAME, SIZE, ALIGN) \ +do { \ + fprintf ((FILE), "\t%s\t", COMMON_ASM_OP); \ + assemble_name ((FILE), (NAME)); \ + fprintf ((FILE), ",%u,%u\n", (SIZE), (ALIGN) / BITS_PER_UNIT); \ +} while (0) + +/* This says how to output assembler code to declare an + uninitialized internal linkage data object. Under SVR4, + the linker seems to want the alignment of data objects + to depend on their types. We do exactly that here. */ + +#define LOCAL_ASM_OP ".local" + +#undef ASM_OUTPUT_ALIGNED_LOCAL +#define ASM_OUTPUT_ALIGNED_LOCAL(FILE, NAME, SIZE, ALIGN) \ +do { \ + fprintf ((FILE), "\t%s\t", LOCAL_ASM_OP); \ + assemble_name ((FILE), (NAME)); \ + fprintf ((FILE), "\n"); \ + ASM_OUTPUT_ALIGNED_COMMON (FILE, NAME, SIZE, ALIGN); \ +} while (0) + +/* This is the pseudo-op used to generate a 32-bit word of data with a + specific value in some section. This is the same for all known svr4 + assemblers. */ + +#define INT_ASM_OP ".long" + +/* This is the pseudo-op used to generate a contiguous sequence of byte + values from a double-quoted string WITHOUT HAVING A TERMINATING NUL + AUTOMATICALLY APPENDED. This is the same for most svr4 assemblers. */ + +#undef ASCII_DATA_ASM_OP +#define ASCII_DATA_ASM_OP ".ascii" + +/* Support const sections and the ctors and dtors sections for g++. + Note that there appears to be two different ways to support const + sections at the moment. You can either #define the symbol + READONLY_DATA_SECTION (giving it some code which switches to the + readonly data section) or else you can #define the symbols + EXTRA_SECTIONS, EXTRA_SECTION_FUNCTIONS, SELECT_SECTION, and + SELECT_RTX_SECTION. We do both here just to be on the safe side. */ + +#define USE_CONST_SECTION 1 + +#define CONST_SECTION_ASM_OP ".section\t.rodata" + +/* 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 ".section\t.ctors,\"aw\"" +#define DTORS_SECTION_ASM_OP ".section\t.dtors,\"aw\"" + +/* On svr4, we *do* have support for the .init and .fini sections, and we + can put stuff in there to be executed before and after `main'. We let + crtstuff.c and other files know this by defining the following symbols. + The definitions say how to change sections to the .init and .fini + sections. This is the same for all known svr4 assemblers. */ + +#define INIT_SECTION_ASM_OP ".section\t.init" +#define FINI_SECTION_ASM_OP ".section\t.fini" + +/* A default list of other sections which we might be "in" at any given + time. For targets that use additional sections (e.g. .tdesc) you + should override this definition in the target-specific file which + includes this file. */ + +#undef EXTRA_SECTIONS +#define EXTRA_SECTIONS in_const, in_ctors, in_dtors + +/* A default list of extra section function definitions. For targets + that use additional sections (e.g. .tdesc) you should override this + definition in the target-specific file which includes this file. */ + +#undef EXTRA_SECTION_FUNCTIONS +#define EXTRA_SECTION_FUNCTIONS \ + CONST_SECTION_FUNCTION \ + CTORS_SECTION_FUNCTION \ + DTORS_SECTION_FUNCTION + +#define READONLY_DATA_SECTION() const_section () + +extern void text_section (); + +#define CONST_SECTION_FUNCTION \ +void \ +const_section () \ +{ \ + if (!USE_CONST_SECTION) \ + text_section(); \ + else if (in_section != in_const) \ + { \ + fprintf (asm_out_file, "%s\n", CONST_SECTION_ASM_OP); \ + in_section = in_const; \ + } \ +} + +#define CTORS_SECTION_FUNCTION \ +void \ +ctors_section () \ +{ \ + if (in_section != in_ctors) \ + { \ + fprintf (asm_out_file, "%s\n", CTORS_SECTION_ASM_OP); \ + in_section = in_ctors; \ + } \ +} + +#define DTORS_SECTION_FUNCTION \ +void \ +dtors_section () \ +{ \ + if (in_section != in_dtors) \ + { \ + fprintf (asm_out_file, "%s\n", DTORS_SECTION_ASM_OP); \ + in_section = in_dtors; \ + } \ +} + +/* Switch into a generic section. + This is currently only used to support section attributes. */ + +#define ASM_OUTPUT_SECTION_NAME(FILE, DECL, NAME, RELOC) \ +do { \ + static struct section_info \ + { \ + struct section_info *next; \ + char *name; \ + enum sect_enum {SECT_RW, SECT_RO, SECT_EXEC} type; \ + } *sections; \ + struct section_info *s; \ + char *mode; \ + enum sect_enum type; \ + \ + for (s = sections; s; s = s->next) \ + if (!strcmp (NAME, s->name)) \ + break; \ + \ + if (DECL && TREE_CODE (DECL) == FUNCTION_DECL) \ + type = SECT_EXEC, mode = "ax"; \ + else if (DECL && DECL_READONLY_SECTION (DECL, RELOC)) \ + type = SECT_RO, mode = "a"; \ + else \ + type = SECT_RW, mode = "aw"; \ + \ + if (s == 0) \ + { \ + s = (struct section_info *) xmalloc (sizeof (struct section_info)); \ + s->name = xmalloc ((strlen (NAME) + 1) * sizeof (*NAME)); \ + strcpy (s->name, NAME); \ + s->type = type; \ + s->next = sections; \ + sections = s; \ + fprintf (FILE, ".section\t%s,\"%s\",@progbits\n", NAME, mode); \ + } \ + else \ + { \ + if (DECL && s->type != type) \ + error_with_decl (DECL, "%s causes a section type conflict"); \ + \ + fprintf (FILE, ".section\t%s\n", NAME); \ + } \ +} while (0) + +#define MAKE_DECL_ONE_ONLY(DECL) (DECL_WEAK (DECL) = 1) +#define UNIQUE_SECTION_P(DECL) (DECL_ONE_ONLY (DECL)) +#define UNIQUE_SECTION(DECL,RELOC) \ +do { \ + int len; \ + char *name, *string, *prefix; \ + \ + name = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (DECL)); \ + \ + if (! DECL_ONE_ONLY (DECL)) \ + { \ + if (TREE_CODE (DECL) == FUNCTION_DECL) \ + prefix = ".text."; \ + else if (DECL_READONLY_SECTION (DECL, RELOC)) \ + prefix = ".rodata."; \ + else \ + prefix = ".data."; \ + } \ + else if (TREE_CODE (DECL) == FUNCTION_DECL) \ + prefix = ".gnu.linkonce.t."; \ + else if (DECL_READONLY_SECTION (DECL, RELOC)) \ + prefix = ".gnu.linkonce.r."; \ + else \ + prefix = ".gnu.linkonce.d."; \ + \ + len = strlen (name) + strlen (prefix); \ + string = alloca (len + 1); \ + sprintf (string, "%s%s", prefix, name); \ + \ + DECL_SECTION_NAME (DECL) = build_string (len, string); \ +} while (0) +/* A C statement (sans semicolon) to output an element in the table of + global constructors. */ +#define ASM_OUTPUT_CONSTRUCTOR(FILE,NAME) \ + do { \ + ctors_section (); \ + fprintf (FILE, "\t%s\t ", INT_ASM_OP); \ + assemble_name (FILE, NAME); \ + fprintf (FILE, "\n"); \ + } while (0) + +/* A C statement (sans semicolon) to output an element in the table of + global destructors. */ +#define ASM_OUTPUT_DESTRUCTOR(FILE,NAME) \ + do { \ + dtors_section (); \ + fprintf (FILE, "\t%s\t ", INT_ASM_OP); \ + assemble_name (FILE, NAME); \ + fprintf (FILE, "\n"); \ + } while (0) + +/* A C statement or statements to switch to the appropriate + section for output of DECL. DECL is either a `VAR_DECL' node + or a constant of some sort. RELOC indicates whether forming + the initial value of DECL requires link-time relocations. */ + +#define SELECT_SECTION(DECL,RELOC) \ +{ \ + if (TREE_CODE (DECL) == STRING_CST) \ + { \ + if (! flag_writable_strings) \ + const_section (); \ + else \ + data_section (); \ + } \ + else if (TREE_CODE (DECL) == VAR_DECL) \ + { \ + if ((flag_pic && RELOC) \ + || !TREE_READONLY (DECL) || TREE_SIDE_EFFECTS (DECL) \ + || !DECL_INITIAL (DECL) \ + || (DECL_INITIAL (DECL) != error_mark_node \ + && !TREE_CONSTANT (DECL_INITIAL (DECL)))) \ + data_section (); \ + else \ + const_section (); \ + } \ + else \ + const_section (); \ +} + +/* A C statement or statements to switch to the appropriate + section for output of RTX in mode MODE. RTX is some kind + of constant in RTL. The argument MODE is redundant except + in the case of a `const_int' rtx. Currently, these always + go into the const section. */ + +#undef SELECT_RTX_SECTION +#define SELECT_RTX_SECTION(MODE,RTX) const_section() + +/* Define the strings used for the special svr4 .type and .size directives. + These strings generally do not vary from one system running svr4 to + another, but if a given system (e.g. m88k running svr) needs to use + different pseudo-op names for these, they may be overridden in the + file which includes this one. */ + +#define TYPE_ASM_OP ".type" +#define SIZE_ASM_OP ".size" + +/* 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) + +/* The following macro defines the format used to output the second + operand of the .type assembler directive. Different svr4 assemblers + expect various different forms for this operand. The one given here + is just a default. You may need to override it in your machine- + specific tm.h file (depending upon the particulars of your assembler). */ + +#define TYPE_OPERAND_FMT "@%s" + +/* Write the extra assembler code needed to declare a function's result. + Most svr4 assemblers don't require any special declaration of the + result value, but there are exceptions. */ + +#ifndef ASM_DECLARE_RESULT +#define ASM_DECLARE_RESULT(FILE, RESULT) +#endif + +/* These macros generate the special .type and .size directives which + are used to set the corresponding fields of the linker symbol table + entries in an ELF object file under SVR4. These macros also output + the starting labels for the relevant functions/objects. */ + +/* Write the extra assembler code needed to declare a function properly. + Some svr4 assemblers need to also have something extra said about the + function's return value. We allow for that here. */ + +#define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL) \ + do { \ + fprintf (FILE, "\t%s\t ", TYPE_ASM_OP); \ + assemble_name (FILE, NAME); \ + putc (',', FILE); \ + fprintf (FILE, TYPE_OPERAND_FMT, "function"); \ + putc ('\n', FILE); \ + ASM_DECLARE_RESULT (FILE, DECL_RESULT (DECL)); \ + ASM_OUTPUT_LABEL(FILE, NAME); \ + } while (0) + +/* Write the extra assembler code needed to declare an object properly. */ + +#define ASM_DECLARE_OBJECT_NAME(FILE, NAME, DECL) \ + do { \ + fprintf (FILE, "\t%s\t ", TYPE_ASM_OP); \ + assemble_name (FILE, NAME); \ + putc (',', FILE); \ + fprintf (FILE, TYPE_OPERAND_FMT, "object"); \ + putc ('\n', FILE); \ + size_directive_output = 0; \ + if (!flag_inhibit_size_directive && DECL_SIZE (DECL)) \ + { \ + size_directive_output = 1; \ + fprintf (FILE, "\t%s\t ", SIZE_ASM_OP); \ + assemble_name (FILE, NAME); \ + fprintf (FILE, ",%d\n", int_size_in_bytes (TREE_TYPE (DECL))); \ + } \ + ASM_OUTPUT_LABEL(FILE, NAME); \ + } while (0) + +/* Output the size directive for a decl in rest_of_decl_compilation + in the case where we did not do so before the initializer. + Once we find the error_mark_node, we know that the value of + size_directive_output was set + by ASM_DECLARE_OBJECT_NAME when it was run for the same decl. */ + +#define ASM_FINISH_DECLARE_OBJECT(FILE, DECL, TOP_LEVEL, AT_END) \ +do { \ + char *name = XSTR (XEXP (DECL_RTL (DECL), 0), 0); \ + if (!flag_inhibit_size_directive && DECL_SIZE (DECL) \ + && ! AT_END && TOP_LEVEL \ + && DECL_INITIAL (DECL) == error_mark_node \ + && !size_directive_output) \ + { \ + size_directive_output = 1; \ + fprintf (FILE, "\t%s\t ", SIZE_ASM_OP); \ + assemble_name (FILE, name); \ + fprintf (FILE, ",%d\n", int_size_in_bytes (TREE_TYPE (DECL))); \ + } \ + } while (0) + +/* This is how to declare the size of a function. */ + +#define ASM_DECLARE_FUNCTION_SIZE(FILE, FNAME, DECL) \ + do { \ + if (!flag_inhibit_size_directive) \ + { \ + char label[256]; \ + static int labelno; \ + labelno++; \ + ASM_GENERATE_INTERNAL_LABEL (label, "Lfe", labelno); \ + ASM_OUTPUT_INTERNAL_LABEL (FILE, "Lfe", labelno); \ + fprintf (FILE, "\t%s\t ", SIZE_ASM_OP); \ + assemble_name (FILE, (FNAME)); \ + fprintf (FILE, ","); \ + assemble_name (FILE, label); \ + fprintf (FILE, "-"); \ + assemble_name (FILE, (FNAME)); \ + putc ('\n', FILE); \ + } \ + } while (0) + +/* A table of bytes codes used by the ASM_OUTPUT_ASCII and + ASM_OUTPUT_LIMITED_STRING macros. Each byte in the table + corresponds to a particular byte value [0..255]. For any + given byte value, if the value in the corresponding table + position is zero, the given character can be output directly. + If the table value is 1, the byte must be output as a \ooo + octal escape. If the tables value is anything else, then the + byte value should be output as a \ followed by the value + in the table. Note that we can use standard UN*X escape + sequences for many control characters, but we don't use + \a to represent BEL because some svr4 assemblers (e.g. on + the i386) don't know about that. Also, we don't use \v + since some versions of gas, such as 2.2 did not accept it. */ + +#define ESCAPES \ +"\1\1\1\1\1\1\1\1btn\1fr\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\ +\0\0\"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\ +\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\\\0\0\0\ +\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\1\ +\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\ +\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\ +\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\ +\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1" + +/* Some svr4 assemblers have a limit on the number of characters which + can appear in the operand of a .string directive. If your assembler + has such a limitation, you should define STRING_LIMIT to reflect that + limit. Note that at least some svr4 assemblers have a limit on the + actual number of bytes in the double-quoted string, and that they + count each character in an escape sequence as one byte. Thus, an + escape sequence like \377 would count as four bytes. + + If your target assembler doesn't support the .string directive, you + should define this to zero. +*/ + +#define STRING_LIMIT ((unsigned) 256) + +#define STRING_ASM_OP ".string" + +/* The routine used to output NUL terminated strings. We use a special + version of this for most svr4 targets because doing so makes the + generated assembly code more compact (and thus faster to assemble) + as well as more readable, especially for targets like the i386 + (where the only alternative is to output character sequences as + comma separated lists of numbers). */ + +#define ASM_OUTPUT_LIMITED_STRING(FILE, STR) \ + do \ + { \ + register unsigned char *_limited_str = (unsigned char *) (STR); \ + register unsigned ch; \ + fprintf ((FILE), "\t%s\t\"", STRING_ASM_OP); \ + for (; ch = *_limited_str; _limited_str++) \ + { \ + register int escape; \ + switch (escape = ESCAPES[ch]) \ + { \ + case 0: \ + putc (ch, (FILE)); \ + break; \ + case 1: \ + fprintf ((FILE), "\\%03o", ch); \ + break; \ + default: \ + putc ('\\', (FILE)); \ + putc (escape, (FILE)); \ + break; \ + } \ + } \ + fprintf ((FILE), "\"\n"); \ + } \ + while (0) + +/* The routine used to output sequences of byte values. We use a special + version of this for most svr4 targets because doing so makes the + generated assembly code more compact (and thus faster to assemble) + as well as more readable. Note that if we find subparts of the + character sequence which end with NUL (and which are shorter than + STRING_LIMIT) we output those using ASM_OUTPUT_LIMITED_STRING. */ + +#undef ASM_OUTPUT_ASCII +#define ASM_OUTPUT_ASCII(FILE, STR, LENGTH) \ + do \ + { \ + register unsigned char *_ascii_bytes = (unsigned char *) (STR); \ + register unsigned char *limit = _ascii_bytes + (LENGTH); \ + register unsigned bytes_in_chunk = 0; \ + for (; _ascii_bytes < limit; _ascii_bytes++) \ + { \ + register unsigned char *p; \ + if (bytes_in_chunk >= 60) \ + { \ + fprintf ((FILE), "\"\n"); \ + bytes_in_chunk = 0; \ + } \ + for (p = _ascii_bytes; p < limit && *p != '\0'; p++) \ + continue; \ + if (p < limit && (p - _ascii_bytes) <= STRING_LIMIT) \ + { \ + if (bytes_in_chunk > 0) \ + { \ + fprintf ((FILE), "\"\n"); \ + bytes_in_chunk = 0; \ + } \ + ASM_OUTPUT_LIMITED_STRING ((FILE), _ascii_bytes); \ + _ascii_bytes = p; \ + } \ + else \ + { \ + register int escape; \ + register unsigned ch; \ + if (bytes_in_chunk == 0) \ + fprintf ((FILE), "\t%s\t\"", ASCII_DATA_ASM_OP); \ + switch (escape = ESCAPES[ch = *_ascii_bytes]) \ + { \ + case 0: \ + putc (ch, (FILE)); \ + bytes_in_chunk++; \ + break; \ + case 1: \ + fprintf ((FILE), "\\%03o", ch); \ + bytes_in_chunk += 4; \ + break; \ + default: \ + putc ('\\', (FILE)); \ + putc (escape, (FILE)); \ + bytes_in_chunk += 2; \ + break; \ + } \ + } \ + } \ + if (bytes_in_chunk > 0) \ + fprintf ((FILE), "\"\n"); \ + } \ + while (0) + +/* All SVR4 targets use the ELF object file format. */ +#define OBJECT_FORMAT_ELF diff --git a/gcc/config/i386/cygwin.asm b/gcc/config/i386/cygwin.asm new file mode 100644 index 00000000000..4ac4c91a3b1 --- /dev/null +++ b/gcc/config/i386/cygwin.asm @@ -0,0 +1,32 @@ +/* stuff needed for libgcc1 on win32. */ + +#ifdef L_chkstk + + .global ___chkstk + .global __alloca +___chkstk: +__alloca: + pushl %ecx /* save temp */ + movl %esp,%ecx /* get sp */ + addl $0x8,%ecx /* and point to return addr */ + +probe: cmpl $0x1000,%eax /* > 4k ?*/ + jb done + + subl $0x1000,%ecx /* yes, move pointer down 4k*/ + orl $0x0,(%ecx) /* probe there */ + subl $0x1000,%eax /* decrement count */ + jmp probe /* and do it again */ + +done: subl %eax,%ecx + orl $0x0,(%ecx) /* less that 4k, just peek here */ + + movl %esp,%eax + movl %ecx,%esp /* decrement stack */ + + movl (%eax),%ecx /* recover saved temp */ + movl 4(%eax),%eax /* get return address */ + jmp *%eax + + +#endif diff --git a/gcc/config/i386/cygwin.h b/gcc/config/i386/cygwin.h new file mode 100644 index 00000000000..1c235358cbf --- /dev/null +++ b/gcc/config/i386/cygwin.h @@ -0,0 +1,518 @@ +/* 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 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 YES_UNDERSCORES + +#define DBX_DEBUGGING_INFO +#define SDB_DEBUGGING_INFO +#define PREFERRED_DEBUGGING_TYPE DBX_DEBUG + +#include "i386/gas.h" +#include "dbxcoff.h" + +/* Augment TARGET_SWITCHES with the cygwin/no-cygwin 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 \ +{ "no-cygwin", MASK_WIN32 }, \ +{ "cygwin", MASK_CYGWIN }, \ +{ "windows", MASK_WINDOWS }, \ +{ "dll", MASK_DLL }, \ +{ "nop-fun-dllimport", MASK_NOP_FUN_DLLIMPORT }, \ +{ "no-nop-fun-dllimport", MASK_NOP_FUN_DLLIMPORT }, + + +/* Support the __declspec keyword by turning them into attributes. + We currently only support: dllimport and dllexport. + Note that the current way we do this may result in a collision with + predefined attributes later on. This can be solved by using one attribute, + say __declspec__, and passing args to it. The problem with that approach + is that args are not accumulated: each new appearance would clobber any + existing args. */ + +#ifdef CPP_PREDEFINES +#undef CPP_PREDEFINES +#endif + +#define CPP_PREDEFINES "-Di386 -D_WIN32 \ + -DWINNT -D_X86_=1 -D__STDC__=1\ + -D__stdcall=__attribute__((__stdcall__)) \ + -D__cdecl=__attribute__((__cdecl__)) \ + -D__declspec(x)=__attribute__((x)) \ + -Asystem(winnt) -Acpu(i386) -Amachine(i386)" + +/* Normally, -lgcc is not needed since everything in it is in the DLL, but we + want to allow things to be added to it when installing new versions of + GCC without making a new CYGWIN.DLL, so we leave it. Profiling is handled + by calling the init function from the prologue. */ + +#undef STARTFILE_SPEC +#define STARTFILE_SPEC "%{mdll: %{!mno-cygwin:dllcrt0%O%s} \ + %{mno-cygwin:dllcrt1%O%s}} \ + %{!mdll: %{!mno-cygwin:crt0%O%s} \ + %{mno-cygwin:crt1%O%s} %{pg:gcrt0%O%s}}" + +#undef CPP_SPEC +#define CPP_SPEC "-remap %(cpp_cpu) %{posix:-D_POSIX_SOURCE} \ + %{!mno-cygwin:-D__CYGWIN32__ -D__CYGWIN__} \ + %{mno-cygwin:-iwithprefixbefore include/mingw32 -D__MINGW32__=0.2}" + +/* 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} \ + %{!mno-cygwin:-lcygwin} \ + %{mno-cygwin:-lmingw32 -lmoldname -lcrtdll} \ + %{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_UNSIGNED 1 +#define WCHAR_TYPE_SIZE 16 +#define WCHAR_TYPE "short unsigned int" + +#define HAVE_ATEXIT 1 + + +/* Enable parsing of #pragma pack(push,<n>) and #pragma pack(pop). */ +#define HANDLE_PRAGMA_PACK_PUSH_POP 1 + +/* A C expression whose value is nonzero if IDENTIFIER with arguments ARGS + is a valid machine specific attribute for DECL. + The attributes in ATTRIBUTES have previously been assigned to DECL. */ +extern int i386_pe_valid_decl_attribute_p (); + +#undef VALID_MACHINE_DECL_ATTRIBUTE +#define VALID_MACHINE_DECL_ATTRIBUTE(DECL, ATTRIBUTES, IDENTIFIER, ARGS) \ + i386_pe_valid_decl_attribute_p (DECL, ATTRIBUTES, IDENTIFIER, ARGS) + +/* A C expression whose value is nonzero if IDENTIFIER with arguments ARGS + is a valid machine specific attribute for TYPE. + The attributes in ATTRIBUTES have previously been assigned to TYPE. */ + +#undef VALID_MACHINE_TYPE_ATTRIBUTE +#define VALID_MACHINE_TYPE_ATTRIBUTE(TYPE, ATTRIBUTES, IDENTIFIER, ARGS) \ + i386_pe_valid_type_attribute_p (TYPE, ATTRIBUTES, IDENTIFIER, ARGS) +extern int i386_pe_valid_type_attribute_p (); + +extern union tree_node *i386_pe_merge_decl_attributes (); +#define MERGE_MACHINE_DECL_ATTRIBUTES(OLD, NEW) \ + i386_pe_merge_decl_attributes ((OLD), (NEW)) + +/* Used to implement dllexport overriding dllimport semantics. It's also used + to handle vtables - the first pass won't do anything because + DECL_CONTEXT (DECL) will be 0 so i386_pe_dll{ex,im}port_p will return 0. + It's also used to handle dllimport override semantics. */ +#if 0 +#define REDO_SECTION_INFO_P(DECL) \ + ((DECL_MACHINE_ATTRIBUTES (DECL) != NULL_TREE) \ + || (TREE_CODE (DECL) == VAR_DECL && DECL_VIRTUAL_P (DECL))) +#else +#define REDO_SECTION_INFO_P(DECL) 1 +#endif + + +#undef EXTRA_SECTIONS +#define EXTRA_SECTIONS in_ctor, in_dtor, in_drectve + +#undef EXTRA_SECTION_FUNCTIONS +#define EXTRA_SECTION_FUNCTIONS \ + CTOR_SECTION_FUNCTION \ + DTOR_SECTION_FUNCTION \ + DRECTVE_SECTION_FUNCTION \ + SWITCH_TO_SECTION_FUNCTION + +#define CTOR_SECTION_FUNCTION \ +void \ +ctor_section () \ +{ \ + if (in_section != in_ctor) \ + { \ + fprintf (asm_out_file, "\t.section .ctor\n"); \ + in_section = in_ctor; \ + } \ +} + +#define DTOR_SECTION_FUNCTION \ +void \ +dtor_section () \ +{ \ + if (in_section != in_dtor) \ + { \ + fprintf (asm_out_file, "\t.section .dtor\n"); \ + in_section = in_dtor; \ + } \ +} + +#define DRECTVE_SECTION_FUNCTION \ +void \ +drectve_section () \ +{ \ + if (in_section != in_drectve) \ + { \ + fprintf (asm_out_file, "%s\n", "\t.section .drectve\n"); \ + in_section = in_drectve; \ + } \ +} + +/* Switch to SECTION (an `enum in_section'). + + ??? This facility should be provided by GCC proper. + The problem is that we want to temporarily switch sections in + ASM_DECLARE_OBJECT_NAME and then switch back to the original section + afterwards. */ +#define SWITCH_TO_SECTION_FUNCTION \ +void \ +switch_to_section (section, decl) \ + enum in_section section; \ + tree decl; \ +{ \ + switch (section) \ + { \ + case in_text: text_section (); break; \ + case in_data: data_section (); break; \ + case in_named: named_section (decl, NULL, 0); break; \ + case in_ctor: ctor_section (); break; \ + case in_dtor: dtor_section (); break; \ + case in_drectve: drectve_section (); break; \ + default: abort (); break; \ + } \ +} + +#define ASM_OUTPUT_CONSTRUCTOR(FILE,NAME) \ + do { \ + ctor_section (); \ + fprintf (FILE, "%s\t", ASM_LONG); \ + assemble_name (FILE, NAME); \ + fprintf (FILE, "\n"); \ + } while (0) + +#define ASM_OUTPUT_DESTRUCTOR(FILE,NAME) \ + do { \ + dtor_section (); \ + fprintf (FILE, "%s\t", ASM_LONG); \ + assemble_name (FILE, NAME); \ + fprintf (FILE, "\n"); \ + } while (0) + +/* Don't allow flag_pic to propagate since gas may produce invalid code + otherwise. */ + +#undef SUBTARGET_OVERRIDE_OPTIONS +#define SUBTARGET_OVERRIDE_OPTIONS \ +do { \ + if (flag_pic) \ + { \ + warning ("-f%s ignored for target (all code is position independent)",\ + (flag_pic > 1) ? "PIC" : "pic"); \ + flag_pic = 0; \ + } \ +} while (0) \ + +/* Define this macro if references to a symbol must be treated + differently depending on something about the variable or + function named by the symbol (such as what section it is in). + + On i386 running Windows NT, modify the assembler name with a suffix + consisting of an atsign (@) followed by string of digits that represents + the number of bytes of arguments passed to the function, if it has the + attribute STDCALL. + + In addition, we must mark dll symbols specially. Definitions of + dllexport'd objects install some info in the .drectve section. + References to dllimport'd objects are fetched indirectly via + _imp__. If both are declared, dllexport overrides. This is also + needed to implement one-only vtables: they go into their own + section and we need to set DECL_SECTION_NAME so we do that here. + Note that we can be called twice on the same decl. */ + +extern void i386_pe_encode_section_info (); + +#ifdef ENCODE_SECTION_INFO +#undef ENCODE_SECTION_INFO +#endif +#define ENCODE_SECTION_INFO(DECL) i386_pe_encode_section_info (DECL) + +/* Utility used only in this file. */ +#define I386_PE_STRIP_ENCODING(SYM_NAME) \ + ((SYM_NAME) + ((SYM_NAME)[0] == '@' ? 3 : 0)) + +/* This macro gets just the user-specified name + out of the string in a SYMBOL_REF. Discard + trailing @[NUM] encoded by ENCODE_SECTION_INFO. */ +#undef STRIP_NAME_ENCODING +#define STRIP_NAME_ENCODING(VAR,SYMBOL_NAME) \ +do { \ + char *_p; \ + char *_name = I386_PE_STRIP_ENCODING (SYMBOL_NAME); \ + for (_p = _name; *_p && *_p != '@'; ++_p) \ + ; \ + if (*_p == '@') \ + { \ + int _len = _p - _name; \ + (VAR) = (char *) alloca (_len + 1); \ + strncpy ((VAR), _name, _len); \ + (VAR)[_len] = '\0'; \ + } \ + else \ + (VAR) = _name; \ +} while (0) + + +/* Output a reference to a label. */ +#undef ASM_OUTPUT_LABELREF +#define ASM_OUTPUT_LABELREF(STREAM, NAME) \ + fprintf (STREAM, "%s%s", USER_LABEL_PREFIX, \ + I386_PE_STRIP_ENCODING (NAME)) \ + +/* Output a common block. */ +#undef ASM_OUTPUT_COMMON +#define ASM_OUTPUT_COMMON(STREAM, NAME, SIZE, ROUNDED) \ +do { \ + if (i386_pe_dllexport_name_p (NAME)) \ + { \ + drectve_section (); \ + fprintf ((STREAM), "\t.ascii \" -export:%s\"\n", \ + I386_PE_STRIP_ENCODING (NAME)); \ + } \ + if (! i386_pe_dllimport_name_p (NAME)) \ + { \ + fprintf ((STREAM), "\t.comm\t"); \ + assemble_name ((STREAM), (NAME)); \ + fprintf ((STREAM), ", %d\t%s %d\n", \ + (ROUNDED), ASM_COMMENT_START, (SIZE)); \ + } \ +} while (0) + +/* Output the label for an initialized variable. */ +#undef ASM_DECLARE_OBJECT_NAME +#define ASM_DECLARE_OBJECT_NAME(STREAM, NAME, DECL) \ +do { \ + if (i386_pe_dllexport_name_p (NAME)) \ + { \ + enum in_section save_section = in_section; \ + drectve_section (); \ + fprintf ((STREAM), "\t.ascii \" -export:%s\"\n", \ + I386_PE_STRIP_ENCODING (NAME)); \ + switch_to_section (save_section, (DECL)); \ + } \ + ASM_OUTPUT_LABEL ((STREAM), (NAME)); \ +} while (0) + + +/* 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_DEFAULT + +#define TARGET_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 + +#define UNIQUE_SECTION_P(DECL) DECL_ONE_ONLY (DECL) +extern void i386_pe_unique_section (); +#define UNIQUE_SECTION(DECL,RELOC) i386_pe_unique_section (DECL, RELOC) + +#define SUPPORTS_ONE_ONLY 1 + +/* A C statement to output something to the assembler file to switch to section + NAME for object DECL which is either a FUNCTION_DECL, a VAR_DECL or + NULL_TREE. Some target formats do not support arbitrary sections. Do not + define this macro in such cases. */ +#undef ASM_OUTPUT_SECTION_NAME +#define ASM_OUTPUT_SECTION_NAME(STREAM, DECL, NAME, RELOC) \ +do { \ + static struct section_info \ + { \ + struct section_info *next; \ + char *name; \ + enum sect_enum {SECT_RW, SECT_RO, SECT_EXEC} type; \ + } *sections; \ + struct section_info *s; \ + char *mode; \ + enum sect_enum type; \ + \ + for (s = sections; s; s = s->next) \ + if (!strcmp (NAME, s->name)) \ + break; \ + \ + if (DECL && TREE_CODE (DECL) == FUNCTION_DECL) \ + type = SECT_EXEC, mode = "x"; \ + else if (DECL && DECL_READONLY_SECTION (DECL, RELOC)) \ + type = SECT_RO, mode = ""; \ + else \ + type = SECT_RW, mode = "w"; \ + \ + if (s == 0) \ + { \ + s = (struct section_info *) xmalloc (sizeof (struct section_info)); \ + s->name = xmalloc ((strlen (NAME) + 1) * sizeof (*NAME)); \ + strcpy (s->name, NAME); \ + s->type = type; \ + s->next = sections; \ + sections = s; \ + fprintf (STREAM, ".section\t%s,\"%s\"\n", NAME, mode); \ + /* Functions may have been compiled at various levels of \ + optimization so we can't use `same_size' here. Instead, \ + have the linker pick one. */ \ + if ((DECL) && DECL_ONE_ONLY (DECL)) \ + fprintf (STREAM, "\t.linkonce %s\n", \ + TREE_CODE (DECL) == FUNCTION_DECL \ + ? "discard" : "same_size"); \ + } \ + else \ + { \ + fprintf (STREAM, ".section\t%s,\"%s\"\n", NAME, mode); \ + } \ +} while (0) + +/* Write the extra assembler code needed to declare a function + properly. If we are generating SDB debugging information, this + will happen automatically, so we only need to handle other cases. */ +#undef ASM_DECLARE_FUNCTION_NAME +#define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL) \ + do \ + { \ + if (i386_pe_dllexport_name_p (NAME)) \ + { \ + drectve_section (); \ + fprintf ((FILE), "\t.ascii \" -export:%s\"\n", \ + I386_PE_STRIP_ENCODING (NAME)); \ + function_section (DECL); \ + } \ + if (write_symbols != SDB_DEBUG) \ + i386_pe_declare_function_type (FILE, NAME, TREE_PUBLIC (DECL)); \ + ASM_OUTPUT_LABEL (FILE, NAME); \ + } \ + while (0) + +/* Add an external function to the list of functions to be declared at + the end of the file. */ +#define ASM_OUTPUT_EXTERNAL(FILE, DECL, NAME) \ + do \ + { \ + if (TREE_CODE (DECL) == FUNCTION_DECL) \ + i386_pe_record_external_function (NAME); \ + } \ + while (0) + +/* Declare the type properly for any external libcall. */ +#define ASM_OUTPUT_EXTERNAL_LIBCALL(FILE, FUN) \ + i386_pe_declare_function_type (FILE, XSTR (FUN, 0), 1) + +/* Output function declarations at the end of the file. */ +#define ASM_FILE_END(FILE) \ + i386_pe_asm_file_end (FILE) + +#undef ASM_COMMENT_START +#define ASM_COMMENT_START " #" + +/* DWARF2 Unwinding doesn't work with exception handling yet. */ +#define DWARF2_UNWIND_INFO 0 + +/* Don't assume anything about the header files. */ +#define NO_IMPLICIT_EXTERN_C + +#define SUBTARGET_PROLOGUE \ + if (profile_flag \ + && strcmp (IDENTIFIER_POINTER (DECL_NAME (current_function_decl)),\ + "main") == 0) \ + { \ + rtx xops[1]; \ + xops[0] = gen_rtx_MEM (FUNCTION_MODE, \ + gen_rtx (SYMBOL_REF, Pmode, "_monstartup")); \ + if (do_rtl) \ + emit_call_insn (gen_rtx (CALL, VOIDmode, xops[0], const0_rtx)); \ + else \ + output_asm_insn (AS1 (call,%P1), xops); \ + } + +/* External function declarations. */ + +#ifndef PROTO +#if defined (USE_PROTOTYPES) ? USE_PROTOTYPES : defined (__STDC__) +#define PROTO(ARGS) ARGS +#else +#define PROTO(ARGS) () +#endif +#endif + +#ifdef BUFSIZ /* stdio.h has been included, ok to use FILE * */ +#define STDIO_PROTO(ARGS) PROTO(ARGS) +#else +#define STDIO_PROTO(ARGS) () +#endif + +extern void i386_pe_record_external_function PROTO((char *)); +extern void i386_pe_declare_function_type STDIO_PROTO((FILE *, char *, int)); +extern void i386_pe_asm_file_end STDIO_PROTO((FILE *)); + +/* For Win32 ABI compatibility */ +#undef DEFAULT_PCC_STRUCT_RETURN +#define DEFAULT_PCC_STRUCT_RETURN 0 + +/* No data type wants to be aligned rounder than this. */ +#undef BIGGEST_ALIGNMENT +#define BIGGEST_ALIGNMENT 128 + +/* A bitfield declared as `int' forces `int' alignment for the struct. */ +#undef PCC_BITFIELDS_TYPE_MATTERS +#define PCC_BITFIELDS_TYPE_MATTERS 0 + diff --git a/gcc/config/i386/djgpp-rtems.h b/gcc/config/i386/djgpp-rtems.h new file mode 100644 index 00000000000..b355cc5796a --- /dev/null +++ b/gcc/config/i386/djgpp-rtems.h @@ -0,0 +1,41 @@ +/* Configuration for an i386 running RTEMS on top of MS-DOS with + DJGPP v2.x. + + Copyright (C) 1996,1999 Free Software Foundation, Inc. + Contributed by Joel Sherrill (joel@OARcorp.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 "i386/djgpp.h" + +/* Specify predefined symbols in preprocessor. */ + +#ifdef CPP_PREDEFINES +#undef CPP_PREDEFINES +#endif +#define CPP_PREDEFINES "-Dunix -Di386 -DGO32 -DDJGPP=2 -DMSDOS \ + -Asystem(unix) -Asystem(msdos) -Acpu(i386) -Amachine(i386) \ + -Asystem(rtems)" + +/* Generate calls to memcpy, memcmp and memset. */ +#ifndef TARGET_MEM_FUNCTIONS +#define TARGET_MEM_FUNCTIONS +#endif + +/* end of i386/djgpp-rtems.h */ + diff --git a/gcc/config/i386/djgpp.h b/gcc/config/i386/djgpp.h new file mode 100644 index 00000000000..2c238bc689c --- /dev/null +++ b/gcc/config/i386/djgpp.h @@ -0,0 +1,148 @@ +/* Configuration for an i386 running MS-DOS with DJGPP. + Copyright (C) 1997, 1998, 1999 Free Software Foundation, Inc. + +This file is part of GNU CC. + +GNU CC is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU CC is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU CC; see the file COPYING. If not, write to +the Free Software Foundation, 59 Temple Place - Suite 330, +Boston, MA 02111-1307, USA. */ + + +#include "dbxcoff.h" + +/* Don't assume anything about the header files. */ +#define NO_IMPLICIT_EXTERN_C + +#define HANDLE_SYSV_PRAGMA + +/* Enable parsing of #pragma pack(push,<n>) and #pragma pack(pop). */ +#define HANDLE_PRAGMA_PACK_PUSH_POP 1 + +#define YES_UNDERSCORES + +#include "i386/gas.h" + +/* Search for as.exe and ld.exe in DJGPP's binary directory. */ +#define MD_EXEC_PREFIX "$DJDIR/bin/" + +/* Correctly handle absolute filename detection in cp/xref.c */ +#define FILE_NAME_ABSOLUTE_P(NAME) \ + (((NAME)[0] == '/') || ((NAME)[0] == '\\') || \ + (((NAME)[0] >= 'A') && ((NAME)[0] <= 'z') && ((NAME)[1] == ':'))) + +#ifdef CPP_PREDEFINES +#undef CPP_PREDEFINES +#endif +#define CPP_PREDEFINES "-Dunix -Di386 -DGO32 -DDJGPP=2 -DMSDOS \ + -Asystem(unix) -Asystem(msdos) -Acpu(i386) -Amachine(i386)" + +/* We need to override link_command_spec in gcc.c so support -Tdjgpp.djl. + This cannot be done in LINK_SPECS as that LINK_SPECS is processed + before library search directories are known by the linker. + This avoids problems when specs file is not available. An alternate way, + suggested by Robert Hoehne, is to use SUBTARGET_EXTRA_SPECS instead. +*/ + +#undef LINK_COMMAND_SPEC +#define LINK_COMMAND_SPEC \ +"%{!fsyntax-only: \ +%{!c:%{!M:%{!MM:%{!E:%{!S:%(linker) %l %X %{o*} %{A} %{d} %{e*} %{m} %{N} %{n} \ +\t%{r} %{s} %{t} %{u*} %{x} %{z} %{Z}\ +\t%{!A:%{!nostdlib:%{!nostartfiles:%S}}}\ +\t%{static:} %{L*} %D %o\ +\t%{!nostdlib:%{!nodefaultlibs:%G %L %G}}\ +\t%{!A:%{!nostdlib:%{!nostartfiles:%E}}}\ +\t-Tdjgpp.djl %{T*}}}}}}}\n\ +%{!c:%{!M:%{!MM:%{!E:%{!S:stubify %{v} %{o*:%*} %{!o*:a.out} }}}}}" + +/* Make sure that gcc will not look for .h files in /usr/local/include + unless user explicitly requests it. */ +#undef LOCAL_INCLUDE_DIR + +#undef EXTRA_SECTIONS +#define EXTRA_SECTIONS in_ctor, in_dtor + +#undef EXTRA_SECTION_FUNCTIONS +#define EXTRA_SECTION_FUNCTIONS \ + CTOR_SECTION_FUNCTION \ + DTOR_SECTION_FUNCTION + +#define CTOR_SECTION_FUNCTION \ +void \ +ctor_section () \ +{ \ + if (in_section != in_ctor) \ + { \ + fprintf (asm_out_file, "\t.section .ctor\n"); \ + in_section = in_ctor; \ + } \ +} + +#define DTOR_SECTION_FUNCTION \ +void \ +dtor_section () \ +{ \ + if (in_section != in_dtor) \ + { \ + fprintf (asm_out_file, "\t.section .dtor\n"); \ + in_section = in_dtor; \ + } \ +} + +#define ASM_OUTPUT_CONSTRUCTOR(FILE,NAME) \ + do { \ + ctor_section (); \ + fprintf (FILE, "%s\t", ASM_LONG); \ + assemble_name (FILE, NAME); \ + fprintf (FILE, "\n"); \ + } while (0) + +/* Allow (eg) __attribute__((section "locked")) to work */ +#define ASM_OUTPUT_SECTION_NAME(FILE, DECL, NAME, RELOC)\ + do { \ + fprintf (FILE, "\t.section %s\n", NAME); \ + } while (0) + +#define ASM_OUTPUT_DESTRUCTOR(FILE,NAME) \ + do { \ + dtor_section (); \ + fprintf (FILE, "%s\t", ASM_LONG); \ + assemble_name (FILE, NAME); \ + fprintf (FILE, "\n"); \ + } while (0) + +/* 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); \ + } while (0) + +/* 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.p2align %d\n", LOG) + +/* djgpp has atexit (). */ +#undef HAVE_ATEXIT +#define HAVE_ATEXIT + +/* djgpp automatically calls its own version of __main, so don't define one + in libgcc, nor call one in main(). */ +#define HAS_INIT_SECTION diff --git a/gcc/config/i386/interix.c b/gcc/config/i386/interix.c new file mode 100644 index 00000000000..40062c70e15 --- /dev/null +++ b/gcc/config/i386/interix.c @@ -0,0 +1,110 @@ +/* Subroutines for insn-output.c for Windows NT. + Copyright (C) 1998, 1999 Free Software Foundation, Inc. + +This file is part of GNU CC. + +GNU CC is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU CC is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU CC; see the file COPYING. If not, write to +the Free Software Foundation, 59 Temple Place - Suite 330, +Boston, MA 02111-1307, USA. */ + +#include "config.h" +#include "system.h" +#include "rtl.h" +#include "regs.h" +#include "hard-reg-set.h" +#include "output.h" +#include "tree.h" +#include "flags.h" + +/* Return string which is the former assembler name modified with a + suffix consisting of an atsign (@) followed by the number of bytes of + arguments */ + +char * +gen_stdcall_suffix (decl) + tree decl; +{ + int total = 0; + /* ??? This probably should use XSTR (XEXP (DECL_RTL (decl), 0), 0) instead + of DECL_ASSEMBLER_NAME. */ + char *asmname = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl)); + char *newsym; + + if (TYPE_ARG_TYPES (TREE_TYPE (decl))) + if (TREE_VALUE (tree_last (TYPE_ARG_TYPES (TREE_TYPE (decl)))) + == void_type_node) + { + tree formal_type = TYPE_ARG_TYPES (TREE_TYPE (decl)); + + while (TREE_VALUE (formal_type) != void_type_node) + { + int parm_size + = TREE_INT_CST_LOW (TYPE_SIZE (TREE_VALUE (formal_type))); + /* Must round up to include padding. This is done the same + way as in store_one_arg. */ + parm_size = ((parm_size + PARM_BOUNDARY - 1) + / PARM_BOUNDARY * PARM_BOUNDARY); + total += parm_size; + formal_type = TREE_CHAIN (formal_type); + } + } + + newsym = xmalloc (strlen (asmname) + 10); + sprintf (newsym, "%s@%d", asmname, total/BITS_PER_UNIT); + return IDENTIFIER_POINTER (get_identifier (newsym)); +} + +#if 0 +/* Turn this back on when the linker is updated to handle grouped + .data$ sections correctly. See corresponding note in i386/interix.h. + MK. */ + +/* Cover function for UNIQUE_SECTION. */ + +void +i386_pe_unique_section (decl, reloc) + tree decl; + int reloc; +{ + int len; + char *name,*string,*prefix; + + name = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl)); + /* Strip off any encoding in fnname. */ + STRIP_NAME_ENCODING (name, name); + + /* The object is put in, for example, section .text$foo. + The linker will then ultimately place them in .text + (everything from the $ on is stripped). Don't put + read-only data in .rdata section to avoid a PE linker + bug when .rdata$* grouped sections are used in code + without a .rdata section. */ + if (TREE_CODE (decl) == FUNCTION_DECL) + prefix = ".text$"; + else if (DECL_READONLY_SECTION (decl, reloc)) +#ifdef READONLY_DATA_SECTION + prefix = ".rdata$"; +#else + prefix = ".text$"; +#endif + else + prefix = ".data$"; + len = strlen (name) + strlen (prefix); + string = alloca (len + 1); + sprintf (string, "%s%s", prefix, name); + + DECL_SECTION_NAME (decl) = build_string (len, string); +} + +#endif /* 0 */ diff --git a/gcc/config/i386/interix.h b/gcc/config/i386/interix.h new file mode 100644 index 00000000000..ea2227533d5 --- /dev/null +++ b/gcc/config/i386/interix.h @@ -0,0 +1,574 @@ +/* Target definitions for GNU compiler for Intel 80386 running Interix + Parts Copyright (C) 1991, 1999 Free Software Foundation, Inc. + + Parts: + by Douglas B. Rupp (drupp@cs.washington.edu). + by Ron Guilmette (rfg@netcom.com). + by Donn Terry (donn@softway.com). + by Mumit Khan (khan@xraylith.wisc.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 YES_UNDERSCORES + +#define DBX_DEBUGGING_INFO +#define SDB_DEBUGGING_INFO +#define PREFERRED_DEBUGGING_TYPE DBX_DEBUG + +#include <interix.h> +#include <i386/gas.h> /* we're close enough ... */ + +#define HANDLE_SYSV_PRAGMA +#undef HANDLE_PRAGMA_WEAK /* until the link format can handle it */ + +/* By default, target has a 80387, uses IEEE compatible arithmetic, + and returns float values in the 387 and needs stack probes + We also align doubles to 64-bits for MSVC default compatability */ +#undef TARGET_DEFAULT +#define TARGET_DEFAULT \ + (MASK_80387 | MASK_IEEE_FP | MASK_FLOAT_RETURNS | MASK_STACK_PROBE | \ + MASK_ALIGN_DOUBLE) + +#undef TARGET_CPU_DEFAULT +#define TARGET_CPU_DEFAULT 2 /* 486 */ + +#define WCHAR_UNSIGNED 1 +#define WCHAR_TYPE_SIZE 16 +#define WCHAR_TYPE "short unsigned int" + +/* WinNT (and thus Interix) use unsigned int */ +#define SIZE_TYPE "unsigned int" + +#define ASM_LOAD_ADDR(loc, reg) " leal " #loc "," #reg "\n" + +/* For the sake of libgcc2.c, indicate target supports atexit. */ +#define HAVE_ATEXIT + +/* cpp handles __STDC__ */ +#undef CPP_PREDEFINES +#define CPP_PREDEFINES " \ + -D__INTERIX \ + -D__OPENNT \ + -D_M_IX86=300 -D_X86_=1 \ + -D__stdcall=__attribute__((__stdcall__)) \ + -D__cdecl=__attribute__((__cdecl__)) \ + -Asystem(unix) -Asystem(interix) -Asystem(interix) -Acpu(i386) -Amachine(i386)" + +#undef CPP_SPEC +/* Write out the correct language type definition for the header files. + Unless we have assembler language, write out the symbols for C. + cpp_cpu is an Intel specific variant. See i386.h + mieee is an Alpha specific variant. Cross polination a bad idea. + */ +#define CPP_SPEC "\ +%{!.S: -D__LANGUAGE_C__ -D__LANGUAGE_C %{!ansi:-DLANGUAGE_C}} \ +%{.S: -D__LANGUAGE_ASSEMBLY__ -D__LANGUAGE_ASSEMBLY %{!ansi:-DLANGUAGE_ASSEMBLY}} \ +%{.cc: -D__LANGUAGE_C_PLUS_PLUS__ -D__LANGUAGE_C_PLUS_PLUS -D__cplusplus} \ +%{.cxx: -D__LANGUAGE_C_PLUS_PLUS__ -D__LANGUAGE_C_PLUS_PLUS -D__cplusplus} \ +%{.C: -D__LANGUAGE_C_PLUS_PLUS__ -D__LANGUAGE_C_PLUS_PLUS -D__cplusplus} \ +%{.m: -D__LANGUAGE_OBJECTIVE_C__ -D__LANGUAGE_OBJECTIVE_C} \ +-remap \ +%(cpp_cpu) \ +%{posix:-D_POSIX_SOURCE} \ +-idirafter %$INTERIX_ROOT/usr/include" + +#undef TARGET_VERSION +#define TARGET_VERSION fprintf (stderr, " (i386 Interix)"); + +/* The global __fltused is necessary to cause the printf/scanf routines + for outputting/inputting floating point numbers to be loaded. Since this + is kind of hard to detect, we just do it all the time. */ + +#ifdef ASM_FILE_START +#undef ASM_FILE_START +#endif +#define ASM_FILE_START(FILE) \ + do { fprintf (FILE, "\t.file\t"); \ + output_quoted_string (FILE, dump_base_name); \ + fprintf (FILE, "\n"); \ + fprintf (FILE, ".global\t__fltused\n"); \ + } while (0) + +/* A table of bytes codes used by the ASM_OUTPUT_ASCII and + ASM_OUTPUT_LIMITED_STRING macros. Each byte in the table + corresponds to a particular byte value [0..255]. For any + given byte value, if the value in the corresponding table + position is zero, the given character can be output directly. + If the table value is 1, the byte must be output as a \ooo + octal escape. If the tables value is anything else, then the + byte value should be output as a \ followed by the value + in the table. Note that we can use standard UN*X escape + sequences for many control characters, but we don't use + \a to represent BEL because some svr4 assemblers (e.g. on + the i386) don't know about that. Also, we don't use \v + since some versions of gas, such as 2.2 did not accept it. */ + +#define ESCAPES \ +"\1\1\1\1\1\1\1\1btn\1fr\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\ +\0\0\"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\ +\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\\\0\0\0\ +\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\1\ +\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\ +\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\ +\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\ +\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1" + +/* Some svr4 assemblers have a limit on the number of characters which + can appear in the operand of a .string directive. If your assembler + has such a limitation, you should define STRING_LIMIT to reflect that + limit. Note that at least some svr4 assemblers have a limit on the + actual number of bytes in the double-quoted string, and that they + count each character in an escape sequence as one byte. Thus, an + escape sequence like \377 would count as four bytes. + + If your target assembler doesn't support the .string directive, you + should define this to zero. +*/ + +#define STRING_LIMIT ((unsigned) 256) + +#define STRING_ASM_OP ".string" + +/* The routine used to output NUL terminated strings. We use a special + version of this for most svr4 targets because doing so makes the + generated assembly code more compact (and thus faster to assemble) + as well as more readable, especially for targets like the i386 + (where the only alternative is to output character sequences as + comma separated lists of numbers). */ + +#define ASM_OUTPUT_LIMITED_STRING(FILE, STR) \ + do \ + { \ + register unsigned char *_limited_str = (unsigned char *) (STR); \ + register unsigned ch; \ + fprintf ((FILE), "\t%s\t\"", STRING_ASM_OP); \ + for (; ch = *_limited_str; _limited_str++) \ + { \ + register int escape; \ + switch (escape = ESCAPES[ch]) \ + { \ + case 0: \ + putc (ch, (FILE)); \ + break; \ + case 1: \ + fprintf ((FILE), "\\%03o", ch); \ + break; \ + default: \ + putc ('\\', (FILE)); \ + putc (escape, (FILE)); \ + break; \ + } \ + } \ + fprintf ((FILE), "\"\n"); \ + } \ + while (0) + +/* The routine used to output sequences of byte values. We use a special + version of this for most svr4 targets because doing so makes the + generated assembly code more compact (and thus faster to assemble) + as well as more readable. Note that if we find subparts of the + character sequence which end with NUL (and which are shorter than + STRING_LIMIT) we output those using ASM_OUTPUT_LIMITED_STRING. */ + +#undef ASM_OUTPUT_ASCII +#define ASM_OUTPUT_ASCII(FILE, STR, LENGTH) \ + do \ + { \ + register unsigned char *_ascii_bytes = (unsigned char *) (STR); \ + register unsigned char *limit = _ascii_bytes + (LENGTH); \ + register unsigned bytes_in_chunk = 0; \ + for (; _ascii_bytes < limit; _ascii_bytes++) \ + { \ + register unsigned char *p; \ + if (bytes_in_chunk >= 64) \ + { \ + fputc ('\n', (FILE)); \ + bytes_in_chunk = 0; \ + } \ + for (p = _ascii_bytes; p < limit && *p != '\0'; p++) \ + continue; \ + if (p < limit && (p - _ascii_bytes) <= STRING_LIMIT) \ + { \ + if (bytes_in_chunk > 0) \ + { \ + fputc ('\n', (FILE)); \ + bytes_in_chunk = 0; \ + } \ + ASM_OUTPUT_LIMITED_STRING ((FILE), _ascii_bytes); \ + _ascii_bytes = p; \ + } \ + else \ + { \ + if (bytes_in_chunk == 0) \ + fprintf ((FILE), "\t.byte\t"); \ + else \ + fputc (',', (FILE)); \ + fprintf ((FILE), "0x%02x", *_ascii_bytes); \ + bytes_in_chunk += 5; \ + } \ + } \ + if (bytes_in_chunk > 0) \ + fprintf ((FILE), "\n"); \ + } \ + while (0) + +/* This is how to output an element of a case-vector that is relative. + This is only used for PIC code. See comments by the `casesi' insn in + i386.md for an explanation of the expression this outputs. + PE format differs on what PC-relative offsets look like (see + coff_i386_rtype_to_howto), and we need to compensate (by one word) here. */ + +#undef ASM_OUTPUT_ADDR_DIFF_ELT +#define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, BODY, VALUE, REL) \ + fprintf (FILE, "\t.long __GLOBAL_OFFSET_TABLE_+[.-%s%d+4]\n", LPREFIX, VALUE) + +/* Indicate that jump tables go in the text section. This is + necessary when compiling PIC code. */ + +#define JUMP_TABLES_IN_TEXT_SECTION 1 + +/* Emit code to check the stack when allocating more that 4000 + bytes in one go. */ + +#define CHECK_STACK_LIMIT 0x1000 + +/* the following are OSF linker (not gld) specific... we don't want them */ +#undef HAS_INIT_SECTION +#undef LD_INIT_SWITCH +#undef LD_FINI_SWITCH + + +/* The following are needed for C++, but also needed for profiling */ + +/* Support const sections and the ctors and dtors sections for g++. + Note that there appears to be two different ways to support const + sections at the moment. You can either #define the symbol + READONLY_DATA_SECTION (giving it some code which switches to the + readonly data section) or else you can #define the symbols + EXTRA_SECTIONS, EXTRA_SECTION_FUNCTIONS, SELECT_SECTION, and + SELECT_RTX_SECTION. We do both here just to be on the safe side. */ + +#define USE_CONST_SECTION 1 + +#define CONST_SECTION_ASM_OP ".section\t.rdata,\"r\"" + +/* 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 ".section\t.ctors,\"x\"" +#define DTORS_SECTION_ASM_OP ".section\t.dtors,\"x\"" + +/* A default list of other sections which we might be "in" at any given + time. For targets that use additional sections (e.g. .tdesc) you + should override this definition in the target-specific file which + includes this file. */ + +#undef EXTRA_SECTIONS +#define EXTRA_SECTIONS in_const, in_ctors, in_dtors + +/* A default list of extra section function definitions. For targets + that use additional sections (e.g. .tdesc) you should override this + definition in the target-specific file which includes this file. */ + +#undef EXTRA_SECTION_FUNCTIONS +#define EXTRA_SECTION_FUNCTIONS \ + CONST_SECTION_FUNCTION \ + CTORS_SECTION_FUNCTION \ + DTORS_SECTION_FUNCTION + +#undef READONLY_DATA_SECTION +#define READONLY_DATA_SECTION() const_section () + +extern void text_section (); + +#define CONST_SECTION_FUNCTION \ +void \ +const_section () \ +{ \ + if (!USE_CONST_SECTION) \ + text_section(); \ + else if (in_section != in_const) \ + { \ + fprintf (asm_out_file, "%s\n", CONST_SECTION_ASM_OP); \ + in_section = in_const; \ + } \ +} + +#define CTORS_SECTION_FUNCTION \ +void \ +ctors_section () \ +{ \ + if (in_section != in_ctors) \ + { \ + fprintf (asm_out_file, "%s\n", CTORS_SECTION_ASM_OP); \ + in_section = in_ctors; \ + } \ +} + +#define DTORS_SECTION_FUNCTION \ +void \ +dtors_section () \ +{ \ + if (in_section != in_dtors) \ + { \ + fprintf (asm_out_file, "%s\n", DTORS_SECTION_ASM_OP); \ + in_section = in_dtors; \ + } \ +} + +#if 0 +/* Currently gas chokes on this; that's not too hard to fix, but there's + not a lot of impeteus to do it, either. If it is done, gas will have + to handle long section name escapes (which are defined in the COFF/PE + document as /nnn where nnn is a string table index). The benefit: + section attributes and -ffunction-sections, neither of which seem to + be critical. */ +/* gas may have been fixed? bfd was. */ + +/* Switch into a generic section. + This is currently only used to support section attributes. + + We make the section read-only and executable for a function decl, + read-only for a const data decl, and writable for a non-const data decl. */ +#define ASM_OUTPUT_SECTION_NAME(FILE, DECL, NAME) \ + fprintf (FILE, ".section\t%s,\"%s\",@progbits\n", NAME, \ + (DECL) && TREE_CODE (DECL) == FUNCTION_DECL ? "ax" : \ + (DECL) && TREE_READONLY (DECL) ? "a" : "aw") +#endif + +#define INT_ASM_OP ".long" + +/* The MS compilers take alignment as a number of bytes, so we do as well */ +#undef ASM_OUTPUT_ALIGN +#define ASM_OUTPUT_ALIGN(FILE,LOG) \ + if ((LOG)!=0) fprintf ((FILE), "\t.balign %d\n", 1<<(LOG)) + +/* A C statement (sans semicolon) to output an element in the table of + global constructors. */ +#define ASM_OUTPUT_CONSTRUCTOR(FILE,NAME) \ + do { \ + ctors_section (); \ + fprintf (FILE, "\t%s\t ", INT_ASM_OP); \ + assemble_name (FILE, NAME); \ + fprintf (FILE, "\n"); \ + } while (0) + +/* A C statement (sans semicolon) to output an element in the table of + global destructors. */ +#define ASM_OUTPUT_DESTRUCTOR(FILE,NAME) \ + do { \ + dtors_section (); \ + fprintf (FILE, "\t%s\t ", INT_ASM_OP); \ + assemble_name (FILE, NAME); \ + fprintf (FILE, "\n"); \ + } while (0) + +/* 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 ".set" +/* Output a definition (implements alias) */ +#define ASM_OUTPUT_DEF(FILE,LABEL1,LABEL2) \ +do \ +{ \ + fprintf ((FILE), "\t%s\t", SET_ASM_OP); \ + assemble_name (FILE, LABEL1); \ + fprintf (FILE, ","); \ + assemble_name (FILE, LABEL2); \ + fprintf (FILE, "\n"); \ + } \ +while (0) + +#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) + +/* The following two flags are usually "off" for i386, because some non-gnu + tools (for the i386) don't handle them. However, we don't have that + problem, so.... */ + +/* Forward references to tags are allowed. */ +#define SDB_ALLOW_FORWARD_REFERENCES + +/* Unknown tags are also allowed. */ +#define SDB_ALLOW_UNKNOWN_REFERENCES + +/* The integer half of this list needs to be constant. However, there's + a lot of disagreement about what the floating point adjustments should + be. We pick one that works with gdb. (The underlying problem is + what to do about the segment registers. Since we have access to them + from /proc, we'll allow them to be accessed in gdb, even tho the + gcc compiler can't generate them. (There's some evidence that + MSVC does, but possibly only for certain special "canned" sequences.) */ + +#undef DBX_REGISTER_NUMBER +#define DBX_REGISTER_NUMBER(n) \ +((n) == 0 ? 0 \ + : (n) == 1 ? 2 \ + : (n) == 2 ? 1 \ + : (n) == 3 ? 3 \ + : (n) == 4 ? 6 \ + : (n) == 5 ? 7 \ + : (n) == 6 ? 5 \ + : (n) == 7 ? 4 \ + : ((n) >= FIRST_STACK_REG && (n) <= LAST_STACK_REG) ? (n)+8 \ + : (-1)) + +/* Define this macro if references to a symbol must be treated + differently depending on something about the variable or + function named by the symbol (such as what section it is in). + + Apply stddef, handle (as yet unimplemented) pic. + + stddef renaming does NOT apply to Alpha. */ + +char *gen_stdcall_suffix (); + +#undef ENCODE_SECTION_INFO +#define ENCODE_SECTION_INFO(DECL) \ +do \ + { \ + if (flag_pic) \ + { \ + rtx rtl = (TREE_CODE_CLASS (TREE_CODE (DECL)) != 'd' \ + ? TREE_CST_RTL (DECL) : DECL_RTL (DECL)); \ + SYMBOL_REF_FLAG (XEXP (rtl, 0)) \ + = (TREE_CODE_CLASS (TREE_CODE (DECL)) != 'd' \ + || ! TREE_PUBLIC (DECL)); \ + } \ + if (TREE_CODE (DECL) == FUNCTION_DECL) \ + if (lookup_attribute ("stdcall", \ + TYPE_ATTRIBUTES (TREE_TYPE (DECL)))) \ + XEXP (DECL_RTL (DECL), 0) = \ + gen_rtx (SYMBOL_REF, Pmode, gen_stdcall_suffix (DECL)); \ + } \ +while (0) + +/* This macro gets just the user-specified name + out of the string in a SYMBOL_REF. Discard + trailing @[NUM] encoded by ENCODE_SECTION_INFO. */ +#undef STRIP_NAME_ENCODING +#define STRIP_NAME_ENCODING(VAR,SYMBOL_NAME) \ +do { \ + char *_p; \ + char *_name = SYMBOL_NAME; \ + for (_p = _name; *_p && *_p != '@'; ++_p) \ + ; \ + if (*_p == '@') \ + { \ + int _len = _p - _name; \ + (VAR) = (char *) alloca (_len + 1); \ + strncpy ((VAR), _name, _len); \ + (VAR)[_len] = '\0'; \ + } \ + else \ + (VAR) = _name; \ +} while (0) + +#if 0 +/* Turn this back on when the linker is updated to handle grouped + .data$ sections correctly. See corresponding note in i386/interix.c. + MK. */ + +/* 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 + +#define UNIQUE_SECTION_P(DECL) DECL_ONE_ONLY (DECL) +extern void i386_pe_unique_section (); +#define UNIQUE_SECTION(DECL,RELOC) i386_pe_unique_section (DECL, RELOC) + +#define SUPPORTS_ONE_ONLY 1 + +/* A C statement to output something to the assembler file to switch to section + NAME for object DECL which is either a FUNCTION_DECL, a VAR_DECL or + NULL_TREE. Some target formats do not support arbitrary sections. Do not + define this macro in such cases. */ +#undef ASM_OUTPUT_SECTION_NAME +#define ASM_OUTPUT_SECTION_NAME(STREAM, DECL, NAME, RELOC) \ +do { \ + static struct section_info \ + { \ + struct section_info *next; \ + char *name; \ + enum sect_enum {SECT_RW, SECT_RO, SECT_EXEC} type; \ + } *sections; \ + struct section_info *s; \ + char *mode; \ + enum sect_enum type; \ + \ + for (s = sections; s; s = s->next) \ + if (!strcmp (NAME, s->name)) \ + break; \ + \ + if (DECL && TREE_CODE (DECL) == FUNCTION_DECL) \ + type = SECT_EXEC, mode = "x"; \ + else if (DECL && DECL_READONLY_SECTION (DECL, RELOC)) \ + type = SECT_RO, mode = "r"; \ + else \ + type = SECT_RW, mode = "w"; \ + \ + if (s == 0) \ + { \ + s = (struct section_info *) xmalloc (sizeof (struct section_info)); \ + s->name = xmalloc ((strlen (NAME) + 1) * sizeof (*NAME)); \ + strcpy (s->name, NAME); \ + s->type = type; \ + s->next = sections; \ + sections = s; \ + fprintf (STREAM, ".section\t%s,\"%s\"\n", NAME, mode); \ + /* Functions may have been compiled at various levels of \ + optimization so we can't use `same_size' here. Instead, \ + have the linker pick one. */ \ + if ((DECL) && DECL_ONE_ONLY (DECL)) \ + fprintf (STREAM, "\t.linkonce %s\n", \ + TREE_CODE (DECL) == FUNCTION_DECL \ + ? "discard" : "same_size"); \ + } \ + else \ + { \ + fprintf (STREAM, ".section\t%s,\"%s\"\n", NAME, mode); \ + } \ +} while (0) + +#endif /* 0 */ + +/* DWARF2 Unwinding doesn't work with exception handling yet. */ +#define DWARF2_UNWIND_INFO 0 + +/* Don't assume anything about the header files. */ +#define NO_IMPLICIT_EXTERN_C + diff --git a/gcc/config/i386/openbsd.h b/gcc/config/i386/openbsd.h new file mode 100644 index 00000000000..69ac05baf77 --- /dev/null +++ b/gcc/config/i386/openbsd.h @@ -0,0 +1,135 @@ +/* Configuration for an OpenBSD i386 target. + + Copyright (C) 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. */ + +/* This is tested by i386gas.h. */ +#define YES_UNDERSCORES + +#include <i386/gstabs.h> + +/* Get perform_* macros to build libgcc.a. */ +#include <i386/perform.h> + +/* Get generic OpenBSD definitions. */ +#define OBSD_OLD_GAS +#include <openbsd.h> + +/* This goes away when the math-emulator is fixed */ +#undef TARGET_DEFAULT +#define TARGET_DEFAULT \ + (MASK_80387 | MASK_IEEE_FP | MASK_FLOAT_RETURNS | MASK_NO_FANCY_MATH_387) + +/* Run-time target specifications */ +#define CPP_PREDEFINES "-D__unix__ -D__i386__ -D__OpenBSD__ -Asystem(unix) -Asystem(OpenBSD) -Acpu(i386) -Amachine(i386)" + +/* Layout of source language data types. */ + +/* This must agree with <machine/ansi.h> */ +#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 + +/* Assembler format: overall framework. */ + +#undef ASM_APP_ON +#define ASM_APP_ON "#APP\n" + +#undef ASM_APP_OFF +#define ASM_APP_OFF "#NO_APP\n" + +/* The following macros were originally stolen from i386v4.h. + These have to be defined to get PIC code correct. */ + +/* Assembler format: dispatch tables. */ + +/* How to output an element of a case-vector that is relative. + This is only used for PIC code. See comments by the `casesi' insn in + i386.md for an explanation of the expression this outputs. */ +#undef ASM_OUTPUT_ADDR_DIFF_ELT +#define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, BODY, VALUE, REL) \ + fprintf (FILE, "\t.long _GLOBAL_OFFSET_TABLE_+[.-%s%d]\n", LPREFIX, VALUE) + +/* Assembler format: sections. */ + +/* Indicate when jump tables go in the text section. This is + necessary when compiling PIC code. */ +#define JUMP_TABLES_IN_TEXT_SECTION (flag_pic) + +/* Stack & calling: aggregate returns. */ + +/* 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 + +/* Assembler format: alignment output. */ + +/* Kludgy test: when gas is upgraded, it will have p2align, and no problems + with nops. */ +#ifndef HAVE_GAS_MAX_SKIP_P2ALIGN +/* i386 OpenBSD still uses an older gas that doesn't insert nops by default + when the .align directive demands to insert extra space in the text + segment. */ +#undef ASM_OUTPUT_ALIGN +#define ASM_OUTPUT_ALIGN(FILE,LOG) \ + if ((LOG)!=0) fprintf ((FILE), "\t.align %d,0x90\n", (LOG)) +#endif + +/* Stack & calling: profiling. */ + +/* OpenBSD's profiler recovers all information from the stack pointer. + The icky part is not here, but in machine/profile.h. */ +#undef FUNCTION_PROFILER +#define FUNCTION_PROFILER(FILE, LABELNO) \ + fputs (flag_pic ? "\tcall mcount@PLT\n": "\tcall mcount\n", FILE); + +/* Assembler format: exception region output. */ + +/* All configurations that don't use elf must be explicit about not using + dwarf unwind information. egcs doesn't try too hard to check internal + configuration files... */ +#define DWARF2_UNWIND_INFO 0 + +/* Assembler format: alignment output. */ + +/* A C statement to output to the stdio stream FILE an assembler + command to advance the location counter to a multiple of 1<<LOG + bytes if it is within MAX_SKIP bytes. + + This will be used to align code labels according to Intel + recommendations, in prevision of binutils upgrade. */ +#ifdef HAVE_GAS_MAX_SKIP_P2ALIGN +#define ASM_OUTPUT_MAX_SKIP_ALIGN(FILE,LOG,MAX_SKIP) \ + do { \ + if ((LOG) != 0) \ + if ((MAX_SKIP) == 0) fprintf ((FILE), "\t.p2align %d\n", (LOG)); \ + else fprintf ((FILE), "\t.p2align %d,,%d\n", (LOG), (MAX_SKIP)); \ + } while (0) +#endif + +/* Note that we pick up ASM_OUTPUT_MI_THUNK from unix.h. */ + diff --git a/gcc/config/i386/t-cygwin b/gcc/config/i386/t-cygwin new file mode 100644 index 00000000000..175f66be6f3 --- /dev/null +++ b/gcc/config/i386/t-cygwin @@ -0,0 +1,16 @@ +LIBGCC1 = libgcc1-asm.a +CROSS_LIBGCC1 = libgcc1-asm.a +LIB1ASMSRC = i386/cygwin.asm +LIB1ASMFUNCS = _chkstk + +# cygwin always has a limits.h, but, depending upon how we are doing +# the build, it may not be installed yet. +LIMITS_H_TEST = true + +# If we are building next to winsup, this will let us find the real +# limits.h when building libgcc2. Otherwise, winsup must be installed +# first. +LIBGCC2_INCLUDES = -I$(srcdir)/../winsup/include + +winnt.o: $(srcdir)/config/i386/winnt.c + $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $(srcdir)/config/i386/winnt.c diff --git a/gcc/config/i386/t-djgpp b/gcc/config/i386/t-djgpp new file mode 100644 index 00000000000..6160b7ec945 --- /dev/null +++ b/gcc/config/i386/t-djgpp @@ -0,0 +1,2 @@ +LIBGCC1 = libgcc1.null +CROSS_LIBGCC1 = libgcc1.null diff --git a/gcc/config/i386/t-interix b/gcc/config/i386/t-interix new file mode 100644 index 00000000000..39df73956b6 --- /dev/null +++ b/gcc/config/i386/t-interix @@ -0,0 +1,10 @@ +# t-interix +LIBGCC1 = libgcc1-asm.a +CROSS_LIBGCC1 = libgcc1-asm.a + +LIB1ASMSRC = i386/cygwin.asm +LIB1ASMFUNCS = _chkstk + +interix.o: $(srcdir)/config/i386/interix.c + $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $(srcdir)/config/i386/interix.c + diff --git a/gcc/config/i386/t-uwin b/gcc/config/i386/t-uwin new file mode 100644 index 00000000000..8e598683cdc --- /dev/null +++ b/gcc/config/i386/t-uwin @@ -0,0 +1,5 @@ +# +# This is included *after* t-cygwin to override LIB1ASMSRC. +# +LIB1ASMSRC = i386/uwin.asm + diff --git a/gcc/config/i386/uwin.asm b/gcc/config/i386/uwin.asm new file mode 100644 index 00000000000..6268343f4c0 --- /dev/null +++ b/gcc/config/i386/uwin.asm @@ -0,0 +1,32 @@ +/* stuff needed for libgcc1 on win32. */ + +#ifdef L_chkstk + + .global __chkstk + .global __alloca +__chkstk: +__alloca: + pushl %ecx /* save temp */ + movl %esp,%ecx /* get sp */ + addl $0x8,%ecx /* and point to return addr */ + +probe: cmpl $0x1000,%eax /* > 4k ?*/ + jb done + + subl $0x1000,%ecx /* yes, move pointer down 4k*/ + orl $0x0,(%ecx) /* probe there */ + subl $0x1000,%eax /* decrement count */ + jmp probe /* and do it again */ + +done: subl %eax,%ecx + orl $0x0,(%ecx) /* less that 4k, just peek here */ + + movl %esp,%eax + movl %ecx,%esp /* decrement stack */ + + movl (%eax),%ecx /* recover saved temp */ + movl 4(%eax),%eax /* get return address */ + jmp *%eax + + +#endif diff --git a/gcc/config/i386/uwin.h b/gcc/config/i386/uwin.h new file mode 100644 index 00000000000..0d5019d5b04 --- /dev/null +++ b/gcc/config/i386/uwin.h @@ -0,0 +1,93 @@ +/* Operating system specific defines to be used when targeting GCC for + hosting on U/WIN (Windows32), using GNU tools and the Windows32 API + Library, 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) 1999 Free Software Foundation, Inc. + Contributed by Mumit Khan <khan@xraylith.wisc.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. */ + +/* Most of this is the same as for Cygwin32, except for changing some + specs. */ + +#include "i386/cygwin.h" + +#define STANDARD_INCLUDE_COMPONENT "UWIN" +#define SYSTEM_INCLUDE_DIR "/usr/gnu/include" + +#undef CPP_PREDEFINES +#define CPP_PREDEFINES "-D__i386__ -D_WIN32 -D__WIN32__ \ + -D_UWIN -DWINNT -D_X86_=1 -D__STDC__=1 \ + -D__UWIN__ -D__MSVCRT__ \ + -D_STD_INCLUDE_DIR=mingw32 \ + -D__stdcall=__attribute__((__stdcall__)) \ + _D_stdcall=__attribute__((__stdcall__)) \ + -D__cdecl=__attribute__((__cdecl__)) \ + -D__declspec(x)=__attribute__((x)) \ + -Asystem(winnt) -Acpu(i386) -Amachine(i386)" + +#undef CPP_SPEC +#define CPP_SPEC "-remap %(cpp_cpu) %{posix:-D_POSIX_SOURCE} \ + -include /usr/include/astwin32.h \ + -iprefix /usr/gnu/include -iwithprefix /mingw32" + +/* For Windows applications, include more libraries, but always include + kernel32. */ +#undef LIB_SPEC +#define LIB_SPEC \ + "%{mwindows:-luser32 -lgdi32 -lcomdlg32} -lkernel32 -ladvapi32" + +/* This is needed in g77spec.c for now. Will be removed in the future. */ +#define WIN32_UWIN_TARGET 1 + +/* Include in the mingw32 libraries with libgcc */ +#undef LIBGCC_SPEC +#define LIBGCC_SPEC "-lgnuwin -lposix -lgcc -last -lmoldname -lmsvcrt" + +/* Specify a different entry point when linking a DLL */ +#undef LINK_SPEC +#define LINK_SPEC \ + "%{mwindows:--subsystem windows} %{mdll:--dll -e _DllMainCRTStartup@12}" + +#undef STARTFILE_SPEC +#define STARTFILE_SPEC "%{mdll:dllcrt2%O%s} %{!mdll:crt2%O%s}" + +/* These are PE BFD bug workarounds. Should go away eventually. */ + +#undef ASM_DECLARE_FUNCTION_NAME +#define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL) \ + do \ + { \ + if (i386_pe_dllexport_name_p (NAME)) \ + { \ + drectve_section (); \ + fprintf ((FILE), "\t.ascii \" -export:%s\"\n", \ + I386_PE_STRIP_ENCODING (NAME)); \ + function_section (DECL); \ + } \ + /* disable i386_pe_declare_function_type for UWIN */ \ + if (0 && write_symbols != SDB_DEBUG) \ + i386_pe_declare_function_type (FILE, NAME, TREE_PUBLIC (DECL)); \ + ASM_OUTPUT_LABEL (FILE, NAME); \ + } \ + while (0) + +#undef ASM_OUTPUT_EXTERNAL +#undef ASM_OUTPUT_EXTERNAL_LIBCALL +#undef ASM_FILE_END + diff --git a/gcc/config/i386/x-cygwin b/gcc/config/i386/x-cygwin new file mode 100644 index 00000000000..f251835bd33 --- /dev/null +++ b/gcc/config/i386/x-cygwin @@ -0,0 +1,4 @@ +# Don't run fixproto +STMP_FIXPROTO = +# prefix.c wants to poke around the Registry +CLIB = -ladvapi32 diff --git a/gcc/config/i386/x-djgpp b/gcc/config/i386/x-djgpp new file mode 100644 index 00000000000..89f31ff5008 --- /dev/null +++ b/gcc/config/i386/x-djgpp @@ -0,0 +1,24 @@ +# translate the version string, so it can be used on DJGPP, where only +# one dot in filename is allowed + +# to avoid recursion when redefining $(version) +_version:=$(version) +__version=$(subst ., ,$(_version)) +version=$(word 1,$(__version))$(word 2,$(__version)).$(word 3,$(__version)) + +SYSTEM_HEADER_DIR=$(DJDIR)/include +X_CPPFLAGS=-DSTANDARD_INCLUDE_DIR=\"\$$DJDIR/include\" \ + -DSTANDARD_INCLUDE_COMPONENT=\"\" + +# when building a native compiler for DJGPP, make the target_alias +# a shorter name, since otherwise it will produce some problems, when +# using the same gcc once with long filenames and once with short (8+3) +# filenames +ifeq ($(findstring -pc-msdosdjgpp,$(target_alias)),-pc-msdosdjgpp) +target_alias=djgpp +endif + +# on DJGPP the 'ln -s' does not work correctly +LN = cp -p +LN_S = cp -p + diff --git a/gcc/config/i386/xm-cygwin.h b/gcc/config/i386/xm-cygwin.h new file mode 100644 index 00000000000..e877665b47a --- /dev/null +++ b/gcc/config/i386/xm-cygwin.h @@ -0,0 +1,68 @@ +/* Configuration for GNU C-compiler for hosting on Windows NT. + using a unix style C library. + Copyright (C) 1995, 1996, 1997, 1998, 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. */ + +#define EXECUTABLE_SUFFIX ".exe" +#define NO_SYS_SIGLIST 1 +#define HAVE_BCOPY 1 +#define HAVE_BZERO 1 +#define HAVE_BCMP 1 +#define HAVE_RINDEX 1 +#define HAVE_INDEX 1 + +/* We support both "/" and "\" since everybody tests both but we + default to "/". This is important because if gcc produces Win32 + paths containing backslashes, make and configure may treat the + backslashes as escape characters. Many Win32 programs use forward + slashes so using a forward slash shouldn't be problematic from the + perspective of wanting gcc to produce native Win32 paths. */ +#define DIR_SEPARATOR '/' + +/* If we allow both '/' and '\' as dir separators, then + allow both unix and win32 PATH syntax. */ +#undef GET_ENV_PATH_LIST +#define GET_ENV_PATH_LIST(VAR,NAME) \ +do { \ + char *_epath; \ + char *_win32epath; \ + _epath = _win32epath = getenv (NAME); \ + /* if we have a posix path list, convert to win32 path list */ \ + if (_epath != NULL && *_epath != 0 \ + && cygwin32_posix_path_list_p (_epath)) \ + { \ + char *p; \ + _win32epath = (char *) xmalloc \ + (cygwin32_posix_to_win32_path_list_buf_size (_epath)); \ + cygwin32_posix_to_win32_path_list (_epath, _win32epath); \ + for (p = _win32epath; p && *p; ++p) \ + { \ + if (*p == '\\') \ + *p = '/'; \ + } \ + } \ + (VAR) = _win32epath; \ +} while (0) + +#define PATH_SEPARATOR ';' + +/* This is needed so that protoize will compile. */ +#ifndef POSIX +#define POSIX +#endif diff --git a/gcc/config/i386/xm-djgpp.h b/gcc/config/i386/xm-djgpp.h new file mode 100644 index 00000000000..de91855f2e7 --- /dev/null +++ b/gcc/config/i386/xm-djgpp.h @@ -0,0 +1,42 @@ +/* Configuration for GNU C-compiler for Intel 80386 running DJGPP. + Copyright (C) 1988, 1996, 1998, 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. */ + +#define __MSDOS__ 1 + +#include "i386/xm-i386.h" + +/* Use semicolons to separate elements of a path. */ +#define PATH_SEPARATOR ';' + +#define EXECUTABLE_SUFFIX ".exe" + +/* Even though we support "/", allow "\" since everybody tests both. */ +#define DIR_SEPARATOR '\\' + +#define NO_SYS_SIGLIST 1 + +#define LIBSTDCXX "-lstdcxx" + +/* System dependant initialization for collect2 + to tell system() to act like Unix. */ +#define COLLECT2_HOST_INITIALIZATION \ + do { __system_flags |= (__system_allow_multiple_cmds \ + | __system_emulate_chdir); } while (0) + diff --git a/gcc/config/i386/xm-openbsd.h b/gcc/config/i386/xm-openbsd.h new file mode 100644 index 00000000000..1a79e83bc4a --- /dev/null +++ b/gcc/config/i386/xm-openbsd.h @@ -0,0 +1,23 @@ +/* Configuration file for i386 hosts running OpenBSD. + Copyright (C) 1999 Free Software Foundation, Inc. + +This file is part of GNU CC. + +GNU CC is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU CC is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU CC; see the file COPYING. If not, write to +the Free Software Foundation, 59 Temple Place - Suite 330, +Boston, MA 02111-1307, USA. */ + +#include <xm-openbsd.h> +#include <i386/xm-i386.h> + diff --git a/gcc/config/i386/xm-uwin.h b/gcc/config/i386/xm-uwin.h new file mode 100644 index 00000000000..2e1ecde0fa7 --- /dev/null +++ b/gcc/config/i386/xm-uwin.h @@ -0,0 +1,39 @@ +/* Configuration for GNU C-compiler for hosting on Windows32. + using GNU tools and the Windows32 API Library. + Copyright (C) 1999 Free Software Foundation, Inc. + Contributed by Mumit Khan <khan@xraylith.wisc.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. */ + +#ifndef ONLY_INT_FIELD +#define ONLY_INT_FIELDS 1 +#endif + +#ifndef USE_PROTOTYPES +#define USE_PROTOTYPES 1 +#endif + +/* U/WIN system calls only support '/' */ +#undef DIR_SEPARATOR +#define DIR_SEPARATOR '/' +#undef EXECUTABLE_SUFFIX +#define EXECUTABLE_SUFFIX ".exe" + +#undef PATH_SEPARATOR +#define PATH_SEPARATOR ':' + diff --git a/gcc/config/interix.h b/gcc/config/interix.h new file mode 100644 index 00000000000..0b108fe84d4 --- /dev/null +++ b/gcc/config/interix.h @@ -0,0 +1,86 @@ +/* Operating system specific defines to be used when targeting GCC for + Interix + Copyright (C) 1994, 1995, 1999 Free Software Foundation, Inc. + Donn Terry, Softway Systems, Inc. (donn@softway.com) + Modified from code + Contributed 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 TARGET_MEM_FUNCTIONS + +/* POSIX/Uni-thread only for now. Look at the winnt version +for windows/multi thread */ + +/* We need multiple -lc -lcpsx because they mutually refer; + that should go away someday */ + +#undef LIB_SPEC +#define LIB_SPEC "\ + %{!shared:%{!dynamic:-lc -lcpsx -lc -lcpsx %$INTERIX_ROOT/usr/lib/psxdll.a \ + %$INTERIX_ROOT/usr/lib/psxdll2.a \ + }} \ + %{!G:%{!dynamic:-lc -lcpsx -lc -lcpsx %$INTERIX_ROOT/usr/lib/psxdll.a \ + %$INTERIX_ROOT/usr/lib/psxdll2.a \ + }} \ + %{dynamic:-lc %$INTERIX_ROOT/usr/lib/psxdll.a \ + %$INTERIX_ROOT/usr/lib/psxdll2.a \ + } \ + %{v}" + +#undef LINK_SPEC +#define LINK_SPEC "%{!shared:-stack 0x400000,0x10000} \ + -subsystem posix \ + %{g} \ + %{dynamic:-Bdynamic} \ + %{static:-Bstatic} \ + %{shared:--shared -Bdynamic} \ + %{G:--shared -Bdynamic} \ + %{symbolic:--shared -Bsymbolic -Bdynamic} \ + %{soname*:--soname %*} \ + %{rpath*:--rpath %*} \ + " + +#undef STARTFILE_SPEC +#define STARTFILE_SPEC \ + "%{!shared:%{pg:gcrt0%O%s}%{!pg:%{p:mcrt0%O%s}%{!p:crt0%O%s}}} %{shared:crti%O%s}" + +#undef WORD_SWITCH_TAKES_ARG +#define WORD_SWITCH_TAKES_ARG(STR) \ + ((DEFAULT_WORD_SWITCH_TAKES_ARG (STR) \ + || !strcmp(STR, "rpath")) \ + && strcmp (STR, "Tdata") && strcmp (STR, "Ttext") \ + && strcmp (STR, "Tbss")) + + +#if 0 +/* don't do this until we can sort out the default path issues. MK */ +#undef STANDARD_EXEC_PREFIX +#define STANDARD_EXEC_PREFIX "" + +#undef STANDARD_STARTFILE_PREFIX +#define STANDARD_STARTFILE_PREFIX "" + +#undef TOOLDIR_BASE_PREFIX +#define TOOLDIR_BASE_PREFIX "" + +#endif /* 0 */ + +#undef STDC_VALUE +#define STDC_VALUE 0 + diff --git a/gcc/config/m68k/m68020-elf.h b/gcc/config/m68k/m68020-elf.h new file mode 100644 index 00000000000..94b5d44064c --- /dev/null +++ b/gcc/config/m68k/m68020-elf.h @@ -0,0 +1,53 @@ +/* Definitions of target machine for GNU compiler. "naked" 68020, + elf object files and debugging, version. + Copyright (C) 1987, 1988, 1992, 1995, 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. */ + +/* This comment is here to see if it will keep Sun's cpp from dying. */ + +#include "m68k/m68k-none.h" +#include "m68k/m68kelf.h" +#include "elfos.h" +/* m68k/m68kemb.h sets some macros in ways that override the svr4 abi. */ +#include "m68k/m68kemb.h" + +/* We need to override the default specs from elfos.h. This suppresses the + loading of crt0.o by gcc's default linker spec. For embedded targets crt0 + now comes from the linker script. */ + +#undef STARTFILE_SPEC +#define STARTFILE_SPEC "crtbegin.o%s" + +#undef ENDFILE_SPEC +#define ENDFILE_SPEC "crtend.o%s" + +#define LIB_SPEC "-lc" + +/* ??? Quick hack to get constructors working. Make this look more like a + COFF target, so the existing dejagnu/libgloss support works. A better + solution would be to make the necessary dejagnu and libgloss changes so + that we can use normal the ELF constructor mechanism. */ +#undef INIT_SECTION_ASM_OP +#undef FINI_SECTION_ASM_OP +#undef STARTFILE_SPEC +#define STARTFILE_SPEC "" +#undef ENDFILE_SPEC +#define ENDFILE_SPEC "" + +/* end of m68020-elf.h */ diff --git a/gcc/config/m68k/m68kelf.h b/gcc/config/m68k/m68kelf.h new file mode 100644 index 00000000000..476692db31d --- /dev/null +++ b/gcc/config/m68k/m68kelf.h @@ -0,0 +1,273 @@ +/* m68kelf support, derived from m68kv4.h */ + +/* Target definitions for GNU compiler for mc680x0 running System V.4 + Copyright (C) 1991, 1993 Free Software Foundation, Inc. + + Written by Ron Guilmette (rfg@netcom.com) and Fred Fish (fnf@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. */ + +/* #notinclude "m68k/sgs.h" /* The m68k/SVR4 assembler is SGS based */ + +/* These are necessary for -fpic/-fPIC to work correctly. */ +#ifndef MOTOROLA +#define MOTOROLA /* Use MOTOROLA syntax. */ +#endif +#ifdef USE_GAS /* when present, forces jsbr instead of jsr. */ +#undef USE_GAS +#endif + +#ifndef SWBEG_ASM_OP +#define SWBEG_ASM_OP ".swbeg" +#endif + +/* Here are four prefixes that are used by asm_fprintf to + facilitate customization for alternate assembler syntaxes. + Machines with no likelihood of an alternate syntax need not + define these and need not use asm_fprintf. */ + +/* The prefix for register names. Note that REGISTER_NAMES + is supposed to include this prefix. Also note that this is NOT an + fprintf format string, it is a literal string */ + +#undef REGISTER_PREFIX +#define REGISTER_PREFIX "%" + +/* The prefix for local (compiler generated) labels. + These labels will not appear in the symbol table. */ + +#undef LOCAL_LABEL_PREFIX +#define LOCAL_LABEL_PREFIX "." + +/* The prefix to add to user-visible assembler symbols. */ + +#undef USER_LABEL_PREFIX +#define USER_LABEL_PREFIX "" + +/* The prefix for immediate operands. */ + +#undef IMMEDIATE_PREFIX +#define IMMEDIATE_PREFIX "#" + +/* In the machine description we can't use %R, because it will not be seen + by ASM_FPRINTF. (Isn't that a design bug?). */ + +#undef REGISTER_PREFIX_MD +#define REGISTER_PREFIX_MD "%%" + +/* config/m68k.md has an explicit reference to the program counter, + prefix this by the register prefix. */ + +#define ASM_RETURN_CASE_JUMP \ + do { \ + if (TARGET_5200) \ + return "ext%.l %0\n\tjmp %%pc@(2,%0:l)"; \ + else \ + return "jmp %%pc@(2,%0:w)"; \ + } while (0) + +/* How to refer to registers in assembler output. + This sequence is indexed by compiler's hard-register-number. + Motorola format uses different register names than defined + in m68k.h. */ + +#undef REGISTER_NAMES + +#define REGISTER_NAMES \ +{"%d0", "%d1", "%d2", "%d3", "%d4", "%d5", "%d6", "%d7", \ + "%a0", "%a1", "%a2", "%a3", "%a4", "%a5", "%a6", "%sp", \ + "%fp0", "%fp1", "%fp2", "%fp3", "%fp4", "%fp5", "%fp6", "%fp7" } + +/* 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%s \t%u\n", ALIGN_ASM_OP, 1 << (LOG)); \ + else if ((LOG) > 31) \ + abort (); + +/* Use proper assembler syntax for these macros. */ +#undef ASM_OUTPUT_REG_PUSH +#define ASM_OUTPUT_REG_PUSH(FILE,REGNO) \ + asm_fprintf (FILE, "\t%Omove.l %s,-(%Rsp)\n", reg_names[REGNO]) + +#undef ASM_OUTPUT_REG_POP +#define ASM_OUTPUT_REG_POP(FILE,REGNO) \ + asm_fprintf (FILE, "\t%Omove.l (%Rsp)+,%s\n", reg_names[REGNO]) + +/* Override the definition of NO_DOLLAR_IN_LABEL in svr4.h, for special + g++ assembler names. When this is defined, g++ uses embedded '.' + characters and some m68k assemblers have problems with this. The + chances are much greater that any particular assembler will permit + embedded '$' characters. */ + +#undef NO_DOLLAR_IN_LABEL + +/* Define PCC_STATIC_STRUCT_RETURN if the convention on the target machine + is to use the nonreentrant technique for returning structure and union + values, as commonly implemented by the AT&T Portable C Compiler (PCC). + When defined, the gcc option -fpcc-struct-return can be used to cause + this form to be generated. When undefined, the option does nothing. + For m68k SVR4, the convention is to use a reentrant technique compatible + with the gcc default, so override the definition of this macro in m68k.h */ + +#undef PCC_STATIC_STRUCT_RETURN + +/* Local common symbols are declared to the assembler with ".lcomm" rather + than ".bss", so override the definition in svr4.h */ + +#undef BSS_ASM_OP +#define BSS_ASM_OP ".lcomm" + +/* Register in which address to store a structure value is passed to a + function. The default in m68k.h is a1. For m68k/SVR4 it is a0. */ + +#undef STRUCT_VALUE_REGNUM +#define STRUCT_VALUE_REGNUM 8 + +#define ASM_COMMENT_START "|" + +#undef TYPE_OPERAND_FMT +#define TYPE_OPERAND_FMT "@%s" + +/* Define how the m68k registers should be numbered for Dwarf output. + The numbering provided here should be compatible with the native + SVR4 SDB debugger in the m68k/SVR4 reference port, where d0-d7 + are 0-7, a0-a8 are 8-15, and fp0-fp7 are 16-23. */ + +#undef DBX_REGISTER_NUMBER +#define DBX_REGISTER_NUMBER(REGNO) (REGNO) + +/* The ASM_OUTPUT_SKIP macro is first defined in m68k.h, using ".skip". + It is then overridden by m68k/sgs.h to use ".space", and again by svr4.h + to use ".zero". The m68k/SVR4 assembler uses ".space", so repeat the + definition from m68k/sgs.h here. Note that ASM_NO_SKIP_IN_TEXT is + defined in m68k/sgs.h, so we don't have to repeat it here. */ + +#undef ASM_OUTPUT_SKIP +#define ASM_OUTPUT_SKIP(FILE,SIZE) \ + fprintf (FILE, "\t%s %u\n", SPACE_ASM_OP, (SIZE)) + +#if 0 +/* SVR4 m68k assembler is bitching on the `comm i,1,1' which askes for + 1 byte alignment. Don't generate alignment for COMMON seems to be + safer until we the assembler is fixed. */ +#undef ASM_OUTPUT_ALIGNED_COMMON +/* Same problem with this one. */ +#undef ASM_OUTPUT_ALIGNED_LOCAL +#endif + +/* The `string' directive on m68k svr4 does not handle string with + escape char (ie., `\') right. Use normal way to output ASCII bytes + seems to be safer. */ +#undef ASM_OUTPUT_ASCII +#define ASM_OUTPUT_ASCII(FILE,PTR,LEN) \ +do { \ + register int sp = 0, lp = 0, ch; \ + fprintf ((FILE), "\t%s ", BYTE_ASM_OP); \ + do { \ + ch = (PTR)[sp]; \ + if (ch > ' ' && ! (ch & 0x80) && ch != '\\') \ + { \ + fprintf ((FILE), "'%c", ch); \ + } \ + else \ + { \ + fprintf ((FILE), "0x%x", ch); \ + } \ + if (++sp < (LEN)) \ + { \ + if ((sp % 10) == 0) \ + { \ + fprintf ((FILE), "\n\t%s ", BYTE_ASM_OP); \ + } \ + else \ + { \ + putc (',', (FILE)); \ + } \ + } \ + } while (sp < (LEN)); \ + putc ('\n', (FILE)); \ +} while (0) + +/* SVR4 m68k assembler is bitching on the syntax `2.b'. + So use the "LLDnnn-LLnnn" format. Define LLDnnn after the table. */ + +#undef ASM_OUTPUT_CASE_END +#define ASM_OUTPUT_CASE_END(FILE,NUM,TABLE) \ +do { \ + if (switch_table_difference_label_flag) \ + asm_fprintf ((FILE), "\t%s %LLD%d,%LL%d\n", SET_ASM_OP, (NUM), (NUM));\ + switch_table_difference_label_flag = 0; \ +} while (0) + +extern int switch_table_difference_label_flag; + +#undef ASM_OUTPUT_COMMON +#undef ASM_OUTPUT_LOCAL +#define ASM_OUTPUT_COMMON(FILE, NAME, SIZE, ROUNDED) \ +( fputs (".comm ", (FILE)), \ + assemble_name ((FILE), (NAME)), \ + fprintf ((FILE), ",%u\n", (SIZE))) + +#define ASM_OUTPUT_LOCAL(FILE, NAME, SIZE, ROUNDED) \ +( fputs (".lcomm ", (FILE)), \ + assemble_name ((FILE), (NAME)), \ + fprintf ((FILE), ",%u\n", (SIZE))) + +/* Currently, JUMP_TABLES_IN_TEXT_SECTION must be defined in order to + keep switch tables in the text section. */ + +#define JUMP_TABLES_IN_TEXT_SECTION 1 + +/* Override the definition in svr4.h. In m68k svr4, using swbeg is the + standard way to do switch table. */ +#undef ASM_OUTPUT_BEFORE_CASE_LABEL +#define ASM_OUTPUT_BEFORE_CASE_LABEL(FILE,PREFIX,NUM,TABLE) \ + fprintf ((FILE), "\t%s &%d\n", SWBEG_ASM_OP, XVECLEN (PATTERN (TABLE), 1)); + +/* In m68k svr4, a symbol_ref rtx can be a valid PIC operand if it is an + operand of a function call. */ +#undef LEGITIMATE_PIC_OPERAND_P +#define LEGITIMATE_PIC_OPERAND_P(X) \ + (! symbolic_operand (X, VOIDmode) \ + || ((GET_CODE(X) == SYMBOL_REF) && SYMBOL_REF_FLAG(X))) + +/* Turn off function cse if we are doing PIC. We always want function call + to be done as `bsr foo@PLTPC', so it will force the assembler to create + the PLT entry for `foo'. Doing function cse will cause the address of `foo' + to be loaded into a register, which is exactly what we want to avoid when + we are doing PIC on svr4 m68k. */ +#undef OVERRIDE_OPTIONS +#define OVERRIDE_OPTIONS \ +{ \ + if (flag_pic) flag_no_function_cse = 1; \ + if (! TARGET_68020 && flag_pic == 2) \ + error("-fPIC is not currently supported on the 68000 or 68010\n"); \ +} +/* end of stuff from m68kv4.h */ + +#undef SGS_CMP_ORDER + +#undef ENDFILE_SPEC +#define ENDFILE_SPEC "crtend.o%s" + +#undef STARTFILE_SPEC +#define STARTFILE_SPEC "crtbegin.o%s" diff --git a/gcc/config/m68k/openbsd.h b/gcc/config/m68k/openbsd.h new file mode 100644 index 00000000000..bdec4563393 --- /dev/null +++ b/gcc/config/m68k/openbsd.h @@ -0,0 +1,121 @@ +/* Configuration file for an m68k OpenBSD target. + Copyright (C) 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. */ + +/* m68k is an old configuration that does not yet use the TARGET_CPU_DEFAULT + framework. */ +#define TARGET_DEFAULT (MASK_BITFIELD | MASK_68881 | MASK_68020) + +#include <m68k/m68k.h> + +/* Get generic OpenBSD definitions. */ +#define OBSD_OLD_GAS +#include <openbsd.h> + +/* Define __HAVE_68881__ in preprocessor, unless -msoft-float is specified. + This will control the use of inline 68881 insns in certain macros. */ +#undef CPP_SPEC +#define CPP_SPEC "%{!msoft-float:-D__HAVE_68881__ -D__HAVE_FPU__} %{posix:-D_POSIX_SOURCE} %{pthread:-D_POSIX_THREADS}" + +/* Run-time target specifications */ +#define CPP_PREDEFINES "-D__unix__ -D__m68k__ -D__mc68000__ -D__mc68020__ -D__OpenBSD__ -Asystem(unix) -Asystem(OpenBSD) -Acpu(m68k) -Amachine(m68k)" + +/* TODO: activate subtarget types when gas is updated. +#define ASM_SPEC "%| %{m68030} %{m68040} %{m68060} %{fpic:-k} %{fPIC:-k -K}" + */ + +/* Layout of source language data types. */ + +/* This must agree with <machine/ansi.h> */ +#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 + +/* Storage layout. */ + +/* Every structure or union's size must be a multiple of 2 bytes. */ +#define STRUCTURE_SIZE_BOUNDARY 16 + +/* Specific options for DBX Output. */ + +/* This is BSD, so it wants DBX format. */ +#define DBX_DEBUGGING_INFO + +/* Do not break .stabs pseudos into continuations. */ +#define DBX_CONTIN_LENGTH 0 + +/* This is the char to use for continuation (in case we need to turn + continuation back on). */ +#define DBX_CONTIN_CHAR '?' + +/* Stack & calling: aggregate returns. */ + +/* 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 + +/* Assembler format: exception region output. */ + +/* All configurations that don't use elf must be explicit about not using + dwarf unwind information. egcs doesn't try too hard to check internal + configuration files... */ +#define DWARF2_UNWIND_INFO 0 + + +/* TODO: ASM_OUTPUT_MI_THUNK is busted. I need to figure out + what bra func@PLTPC means under linux, and find the corresponding + construction for our gas/pic setup. */ +#if 0 +/* Taken from linux.h. Processor dependent optimized code to handle C++ + multiple inheritance vtable lookup. */ + +/* Output code to add DELTA to the first argument, and then jump to FUNCTION. + Used for C++ multiple inheritance. */ +#define ASM_OUTPUT_MI_THUNK(FILE, THUNK_FNDECL, DELTA, FUNCTION) \ +do { \ + if (DELTA > 0 && DELTA <= 8) \ + asm_fprintf (FILE, "\taddq.l %I%d,4(%Rsp)\n", DELTA); \ + else if (DELTA < 0 && DELTA >= -8) \ + asm_fprintf (FILE, "\tsubq.l %I%d,4(%Rsp)\n", -DELTA); \ + else \ + asm_fprintf (FILE, "\tadd.l %I%d,4(%Rsp)\n", DELTA); \ + \ + if (flag_pic) \ + { \ + fprintf (FILE, "\tbra.l "); \ + assemble_name (FILE, XSTR (XEXP (DECL_RTL (FUNCTION), 0), 0)); \ + fprintf (FILE, "@PLTPC\n"); \ + } \ + else \ + { \ + fprintf (FILE, "\tjmp "); \ + assemble_name (FILE, XSTR (XEXP (DECL_RTL (FUNCTION), 0), 0)); \ + fprintf (FILE, "\n"); \ + } \ +} while (0) +#endif + diff --git a/gcc/config/m68k/t-m68kelf b/gcc/config/m68k/t-m68kelf new file mode 100644 index 00000000000..d0f857a496d --- /dev/null +++ b/gcc/config/m68k/t-m68kelf @@ -0,0 +1,29 @@ +CROSS_LIBGCC1 = libgcc1-asm.a +LIB1ASMSRC = m68k/lb1sf68.asm +LIB1ASMFUNCS = _mulsi3 _udivsi3 _divsi3 _umodsi3 _modsi3 \ + _double _float _floatex \ + _eqdf2 _nedf2 _gtdf2 _gedf2 _ltdf2 _ledf2 \ + _eqsf2 _nesf2 _gtsf2 _gesf2 _ltsf2 _lesf2 + +# These are really part of libgcc1, but this will cause them to be +# built correctly, so... +LIB2FUNCS_EXTRA = fpgnulib.c xfgnulib.c + +fpgnulib.c: $(srcdir)/config/m68k/fpgnulib.c + cp $(srcdir)/config/m68k/fpgnulib.c fpgnulib.c +xfgnulib.c: $(srcdir)/config/m68k/fpgnulib.c + echo '#define EXTFLOAT' > xfgnulib.c + cat $(srcdir)/config/m68k/fpgnulib.c >> xfgnulib.c + +MULTILIB_OPTIONS = m68000/m68020/m5200/mcpu32 m68881/msoft-float +MULTILIB_DIRNAMES = +MULTILIB_MATCHES = m68000=mc68000 m68000=m68302 mcpu32=m68332 m68020=mc68020 m68020=m68040 m68020=m68060 +MULTILIB_EXCEPTIONS = m68000/msoft-float m5200/m68881 m5200/msoft-float mcpu32/m68881 mcpu32/msoft-float + +LIBGCC = stmp-multilib +INSTALL_LIBGCC = install-multilib + +# from ../t-svr4 +EXTRA_PARTS=crtbegin.o crtend.o +# no pic for now +#CRTSTUFF_T_CFLAGS=-fpic diff --git a/gcc/config/m68k/xm-openbsd.h b/gcc/config/m68k/xm-openbsd.h new file mode 100644 index 00000000000..c4312ff8725 --- /dev/null +++ b/gcc/config/m68k/xm-openbsd.h @@ -0,0 +1,23 @@ +/* Configuration file for an host running m68k OpenBSD. + Copyright (C) 1999 Free Software Foundation, Inc. + +This file is part of GNU CC. + +GNU CC is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU CC is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU CC; see the file COPYING. If not, write to +the Free Software Foundation, 59 Temple Place - Suite 330, +Boston, MA 02111-1307, USA. */ + +#include <xm-openbsd.h> +#include <m68k/xm-m68k.h> + diff --git a/gcc/config/mips/linux.h b/gcc/config/mips/linux.h new file mode 100644 index 00000000000..e780a4bb3b8 --- /dev/null +++ b/gcc/config/mips/linux.h @@ -0,0 +1,70 @@ +/* Definitions for MIPS running Linux-based GNU systems with ELF format. + 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. */ + +/* Required to keep collect2.c happy */ +#undef OBJECT_FORMAT_COFF + +#define HAVE_ATEXIT + +/* If we don't set MASK_ABICALLS, we can't default to PIC. */ +#undef TARGET_DEFAULT +#define TARGET_DEFAULT (MASK_ABICALLS|MASK_GAS) + + +/* Provide a STARTFILE_SPEC appropriate for GNU/Linux. Here we add + the GNU/Linux magical crtbegin.o file (see crtstuff.c) which + provides part of the support for getting C++ file-scope static + object constructed before entering `main'. */ + +#undef STARTFILE_SPEC +#define STARTFILE_SPEC \ + "%{!shared: \ + %{pg:gcrt1.o%s} %{!pg:%{p:gcrt1.o%s} %{!p:crt1.o%s}}}\ + crti.o%s %{!shared:crtbegin.o%s} %{shared:crtbeginS.o%s}" + +/* Provide a ENDFILE_SPEC appropriate for GNU/Linux. Here we tack on + the GNU/Linux magical crtend.o file (see crtstuff.c) which + provides part of the support for getting C++ file-scope static + object constructed before entering `main', followed by a normal + GNU/Linux "finalizer" file, `crtn.o'. */ + +#undef ENDFILE_SPEC +#define ENDFILE_SPEC \ + "%{!shared:crtend.o%s} %{shared:crtendS.o%s} crtn.o%s" + +/* From iris5.h */ +/* -G is incompatible with -KPIC which is the default, so only allow objects + in the small data section if the user explicitly asks for it. */ +#undef MIPS_DEFAULT_GVALUE +#define MIPS_DEFAULT_GVALUE 0 + +/* Borrowed from sparc/linux.h */ +#undef LINK_SPEC +#define LINK_SPEC "-Y P,/usr/lib %{shared:-shared} \ + %{!shared: \ + %{!ibcs: \ + %{!static: \ + %{rdynamic:-export-dynamic} \ + %{!dynamic-linker:-dynamic-linker /lib/ld.so.1}} \ + %{static:-static}}}" + + +#undef SUBTARGET_ASM_SPEC +#define SUBTARGET_ASM_SPEC "-KPIC" diff --git a/gcc/config/openbsd.h b/gcc/config/openbsd.h new file mode 100644 index 00000000000..30f24942341 --- /dev/null +++ b/gcc/config/openbsd.h @@ -0,0 +1,308 @@ +/* Base configuration file for all OpenBSD targets. + Copyright (C) 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. */ + +/* Common OpenBSD configuration. + All OpenBSD architectures include this file, which is intended as + a repository for common defines. + + Some defines are common to all architectures, a few of them are + triggered by OBSD_* guards, so that we won't override architecture + defaults by mistakes. + + OBSD_HAS_CORRECT_SPECS: + another mechanism provides correct specs already. + OBSD_NO_DYNAMIC_LIBRARIES: + no implementation of dynamic libraries. + OBSD_OLD_GAS: + older flavor of gas which needs help for PIC. + OBSD_HAS_DECLARE_FUNCTION_NAME, OBSD_HAS_DECLARE_FUNCTION_SIZE, + OBSD_HAS_DECLARE_OBJECT: + PIC support, FUNCTION_NAME/FUNCTION_SIZE are independent, whereas + the corresponding logic for OBJECTS is necessarily coupled. + + There are also a few `default' defines such as ASM_WEAKEN_LABEL, + intended as common ground for arch that don't provide + anything suitable. */ + +/* OPENBSD_NATIVE is defined only when gcc is configured as part of + the OpenBSD source tree, specifically through Makefile.bsd-wrapper. + + In such a case the include path can be trimmed as there is no + distinction between system includes and gcc includes. */ + +/* This configuration method, namely Makefile.bsd-wrapper and + OPENBSD_NATIVE is NOT recommended for building cross-compilers. */ + +#ifdef OPENBSD_NATIVE + +#undef GCC_INCLUDE_DIR +#define GCC_INCLUDE_DIR "/usr/include" + +/* The compiler is configured with ONLY the gcc/g++ standard headers. */ +#undef INCLUDE_DEFAULTS +#define INCLUDE_DEFAULTS \ + { \ + { GPLUSPLUS_INCLUDE_DIR, "G++", 1, 1 }, \ + { GCC_INCLUDE_DIR, "GCC", 0, 0 }, \ + { 0, 0, 0, 0 } \ + } + +/* Under OpenBSD, the normal location of the various *crt*.o files is the + /usr/lib directory. */ +#define STANDARD_STARTFILE_PREFIX "/usr/lib/" + +#endif + + +/* Controlling the compilation driver. */ + +/* CPP_SPEC appropriate for OpenBSD. We deal with -posix and -pthread. + XXX the way threads are handling currently is not very satisfying, + since all code must be compiled with -pthread to work. + This two-stage defines makes it easy to pick that for targets that + have subspecs. */ +#define OBSD_CPP_SPEC "%{posix:-D_POSIX_SOURCE} %{pthread:-D_POSIX_THREADS}" + +/* LIB_SPEC appropriate for OpenBSD. Select the appropriate libc, + depending on profiling and threads. Basically, + -lc(_r)?(_p)?, select _r for threads, and _p for p or pg. */ +#define OBSD_LIB_SPEC "-lc%{pthread:_r}%{p:_p}%{!p:%{pg:_p}}" + +#ifndef OBSD_HAS_CORRECT_SPECS + +#ifndef OBSD_NO_DYNAMIC_LIBRARIES +#undef SWITCH_TAKES_ARG +#define SWITCH_TAKES_ARG(CHAR) \ + (DEFAULT_SWITCH_TAKES_ARG (CHAR) \ + || (CHAR) == 'R') +#endif + +#undef CPP_SPEC +#define CPP_SPEC OBSD_CPP_SPEC + +#ifdef OBSD_OLD_GAS +/* ASM_SPEC appropriate for OpenBSD. For some architectures, OpenBSD + still uses a special flavor of gas that needs to be told when generating + pic code. */ +#undef ASM_SPEC +#define ASM_SPEC "%{fpic:-k} %{fPIC:-k -K} %|" +#else +/* Since we use gas, stdin -> - is a good idea, but we don't want to + override native specs just for that. */ +#ifndef ASM_SPEC +#define ASM_SPEC "%|" +#endif +#endif + +/* LINK_SPEC appropriate for OpenBSD. Support for GCC options + -static, -assert, and -nostdlib. */ +#undef LINK_SPEC +#ifdef OBSD_NO_DYNAMIC_LIBRARIES +#define LINK_SPEC \ + "%{!nostdlib:%{!r*:%{!e*:-e start}}} -dc -dp %{assert*}" +#else +#define LINK_SPEC \ + "%{!nostdlib:%{!r*:%{!e*:-e start}}} -dc -dp %{R*} %{static:-Bstatic} %{assert*}" +#endif + +#undef LIB_SPEC +#define LIB_SPEC OBSD_LIB_SPEC +#endif + + +/* Runtime target specification. */ + +/* You must redefine CPP_PREDEFINES in any arch specific file. */ +#undef CPP_PREDEFINES + +/* Implicit calls to library routines. */ + +/* Use memcpy and memset instead of bcopy and bzero. */ +#define TARGET_MEM_FUNCTIONS + +/* Miscellaneous parameters. */ + +/* Tell libgcc2.c that OpenBSD targets support atexit. */ +#define HAVE_ATEXIT + +/* Controlling debugging info: dbx options. */ + +/* Don't use the `xsTAG;' construct in DBX output; OpenBSD systems that + use DBX don't support it. */ +#define DBX_NO_XREFS + + +/* Support of shared libraries, mostly imported from svr4.h through netbsd. */ +/* Two differences from svr4.h: + - we use . - _func instead of a local label, + - we put extra spaces in expressions such as + .type _func , @function + This is more readable for a human being and confuses c++filt less. */ + +/* Assembler format: output and generation of labels. */ + +/* Define the strings used for the .type and .size directives. + These strings generally do not vary from one system running OpenBSD + to another, but if a given system needs to use different pseudo-op + names for these, they may be overridden in the arch specific file. */ + +/* OpenBSD assembler is hacked to have .type & .size support even in a.out + format object files. Functions size are supported but not activated + yet (look for GRACE_PERIOD_EXPIRED in gas/config/obj-aout.c). */ + +#undef TYPE_ASM_OP +#undef SIZE_ASM_OP + +#define TYPE_ASM_OP ".type" +#define SIZE_ASM_OP ".size" + +/* The following macro defines the format used to output the second + operand of the .type assembler directive. */ +#undef TYPE_OPERAND_FMT +#define TYPE_OPERAND_FMT "@%s" + +/* Provision if extra assembler code is needed to declare a function's result + (taken from svr4, not needed yet actually). */ +#ifndef ASM_DECLARE_RESULT +#define ASM_DECLARE_RESULT(FILE, RESULT) +#endif + +/* These macros generate the special .type and .size directives which + are used to set the corresponding fields of the linker symbol table + entries under OpenBSD. These macros also have to output the starting + labels for the relevant functions/objects. */ + +#ifndef OBSD_HAS_DECLARE_FUNCTION_NAME +/* Extra assembler code needed to declare a function properly. + Some assemblers may also need to also have something extra said + about the function's return value. We allow for that here. */ +#undef ASM_DECLARE_FUNCTION_NAME +#define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL) \ + do { \ + fprintf (FILE, "\t%s\t", TYPE_ASM_OP); \ + assemble_name (FILE, NAME); \ + fputs (" , ", FILE); \ + fprintf (FILE, TYPE_OPERAND_FMT, "function"); \ + putc ('\n', FILE); \ + ASM_DECLARE_RESULT (FILE, DECL_RESULT (DECL)); \ + ASM_OUTPUT_LABEL(FILE, NAME); \ + } while (0) +#endif + +#ifndef OBSD_HAS_DECLARE_FUNCTION_SIZE +/* Declare the size of a function. */ +#undef ASM_DECLARE_FUNCTION_SIZE +#define ASM_DECLARE_FUNCTION_SIZE(FILE, FNAME, DECL) \ + do { \ + if (!flag_inhibit_size_directive) \ + { \ + fprintf (FILE, "\t%s\t", SIZE_ASM_OP); \ + assemble_name (FILE, (FNAME)); \ + fputs (" , . - ", FILE); \ + assemble_name (FILE, (FNAME)); \ + putc ('\n', FILE); \ + } \ + } while (0) +#endif + +#ifndef OBSD_HAS_DECLARE_OBJECT +/* Extra assembler code needed to declare an object properly. */ +#undef ASM_DECLARE_OBJECT_NAME +#define ASM_DECLARE_OBJECT_NAME(FILE, NAME, DECL) \ + do { \ + fprintf (FILE, "\t%s\t ", TYPE_ASM_OP); \ + assemble_name (FILE, NAME); \ + fputs (" , ", FILE); \ + fprintf (FILE, TYPE_OPERAND_FMT, "object"); \ + putc ('\n', FILE); \ + size_directive_output = 0; \ + if (!flag_inhibit_size_directive && DECL_SIZE (DECL)) \ + { \ + size_directive_output = 1; \ + fprintf (FILE, "\t%s\t", SIZE_ASM_OP); \ + assemble_name (FILE, NAME); \ + fprintf (FILE, " , %d\n", int_size_in_bytes (TREE_TYPE (DECL)));\ + } \ + ASM_OUTPUT_LABEL (FILE, NAME); \ + } while (0) + +/* Output the size directive for a decl in rest_of_decl_compilation + in the case where we did not do so before the initializer. + Once we find the error_mark_node, we know that the value of + size_directive_output was set by ASM_DECLARE_OBJECT_NAME + when it was run for the same decl. */ +#undef ASM_FINISH_DECLARE_OBJECT +#define ASM_FINISH_DECLARE_OBJECT(FILE, DECL, TOP_LEVEL, AT_END) \ +do { \ + char *name = XSTR (XEXP (DECL_RTL (DECL), 0), 0); \ + if (!flag_inhibit_size_directive && DECL_SIZE (DECL) \ + && ! AT_END && TOP_LEVEL \ + && DECL_INITIAL (DECL) == error_mark_node \ + && !size_directive_output) \ + { \ + size_directive_output = 1; \ + fprintf (FILE, "\t%s\t", SIZE_ASM_OP); \ + assemble_name (FILE, name); \ + fprintf (FILE, " , %d\n", int_size_in_bytes (TREE_TYPE (DECL)));\ + } \ + } while (0) +#endif + + +/* Those are `generic' ways to weaken/globalize a label. We shouldn't need + to override a processor specific definition. Hence, #ifndef ASM_* + In case overriding turns out to be needed, one can always #undef ASM_* + before including this file. */ + +/* Tell the assembler that a symbol is weak. */ +/* Note: netbsd arm32 assembler needs a .globl here. An override may + be needed when/if we go for arm32 support. */ +#ifndef ASM_WEAKEN_LABEL +#define ASM_WEAKEN_LABEL(FILE,NAME) \ + do { fputs ("\t.weak\t", FILE); assemble_name (FILE, NAME); \ + fputc ('\n', FILE); } while (0) +#endif + +/* Tell the assembler that a symbol is global. */ +#ifndef ASM_GLOBALIZE_LABEL +#define ASM_GLOBALIZE_LABEL(FILE,NAME) \ + do { fputs ("\t.globl\t", FILE); assemble_name (FILE, NAME); \ + fputc ('\n', FILE); } while(0) +#endif + + +/* Storage layout. */ + +/* We don't have to worry about binary compatibility with older C++ code, + but there is a big known bug with vtable thunks which has not been + fixed yet, so DON'T activate it by default. */ +/* #define DEFAULT_VTABLE_THUNKS 1 */ + + +/* Otherwise, since we support weak, gthr.h erroneously tries to use + #pragma weak. */ +#define GTHREAD_USE_WEAK 0 + +/* bug work around: we don't want to support #pragma weak, but the current + code layout needs HANDLE_PRAGMA_WEAK asserted for __attribute((weak)) to + work. On the other hand, we don't define HANDLE_PRAGMA_WEAK directly, + as this depends on a few other details as well... */ +#define HANDLE_SYSV_PRAGMA + diff --git a/gcc/config/rs6000/cygwin.h b/gcc/config/rs6000/cygwin.h new file mode 100644 index 00000000000..0ed448b2124 --- /dev/null +++ b/gcc/config/rs6000/cygwin.h @@ -0,0 +1,67 @@ +/* Operating system specific defines to be used when targeting GCC for + hosting on Windows NT 3.x, using the Cygnus API + + This is different to the winnt.h file, since that is used + to build GCC for use with a windows style library and tool + set, winnt.h uses the Microsoft tools to do that. + + Copyright (C) 1996, 1997 Free Software Foundation, Inc. + +This file is part of GNU CC. + +GNU CC is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU CC is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU CC; see the file COPYING. If not, write to +the Free Software Foundation, 59 Temple Place - Suite 330, +Boston, MA 02111-1307, USA. */ + + +/* Ugly hack */ +#include "rs6000/win-nt.h" + + +#ifdef CPP_PREDEFINES +#undef CPP_PREDEFINES +#endif + +#define CPP_PREDEFINES "-D_WIN32 -DWINNT -D__CYGWIN__ -D__CYGWIN32__ -DPOSIX \ + -D_POWER -D_ARCH_PPC -D__PPC__ -Asystem(winnt) -Acpu(powerpc) -Amachine(powerpc)" + +#undef CPP_SPEC +#define CPP_SPEC "-remap %{posix: -D_POSIX_SOURCE} %(cpp_cpu)" + +/* 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 "-lcygwin %{mwindows:-luser32 -lgdi32 -lcomdlg32} -lkernel32" + +#undef LINK_SPEC +#define LINK_SPEC "%{v:-V}" + +#undef STARTFILE_SPEC +#define STARTFILE_SPEC "crti%O%s crt0%O%s" + +#undef ENDFILE_SPEC +#define ENDFILE_SPEC "crtn%O%s" + +#define PTRDIFF_TYPE "int" +#define WCHAR_UNSIGNED 1 +#define WCHAR_TYPE_SIZE 16 +#define WCHAR_TYPE "short unsigned int" + +#define DBX_DEBUGGING_INFO +#undef SDB_DEBUGGING_INFO +#define PREFERRED_DEBUGGING_TYPE DBX_DEBUG diff --git a/gcc/config/rs6000/x-aix41-gld b/gcc/config/rs6000/x-aix41-gld new file mode 100644 index 00000000000..ca444ae013c --- /dev/null +++ b/gcc/config/rs6000/x-aix41-gld @@ -0,0 +1,12 @@ +# configuration for IBM RS/6000 running AIX 4.1+ + +# Show we need to use the C version of ALLOCA +ALLOCA=alloca.o + +# We need -lld for collect2 (actually this only matters +# for a native compiler, but this is as good a place as any +# to define the symbol). +CLIB=-lld + +# f771 and cc1plus overflow the AIX TOC, however gld doesn't support -bbigtoc +# BOOT_LDFLAGS=-Wl,-bbigtoc diff --git a/gcc/config/rs6000/x-cygwin b/gcc/config/rs6000/x-cygwin new file mode 100644 index 00000000000..5e796a0e916 --- /dev/null +++ b/gcc/config/rs6000/x-cygwin @@ -0,0 +1,4 @@ +# Don't run fixproto +STMP_FIXPROTO = +# Don't need collect2 +USE_COLLECT2 = diff --git a/gcc/config/rs6000/xm-cygwin.h b/gcc/config/rs6000/xm-cygwin.h new file mode 100644 index 00000000000..ca548319c10 --- /dev/null +++ b/gcc/config/rs6000/xm-cygwin.h @@ -0,0 +1 @@ +#define EXECUTABLE_SUFFIX ".exe" diff --git a/gcc/config/sparc/openbsd.h b/gcc/config/sparc/openbsd.h new file mode 100644 index 00000000000..19ece975e99 --- /dev/null +++ b/gcc/config/sparc/openbsd.h @@ -0,0 +1,68 @@ +/* Configuration file for sparc OpenBSD target. + Copyright (C) 1999 Free Software Foundation, Inc. + +This file is part of GNU CC. + +GNU CC is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU CC is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU CC; see the file COPYING. If not, write to +the Free Software Foundation, 59 Temple Place - Suite 330, +Boston, MA 02111-1307, USA. */ + +#include <sparc/sparc.h> + +/* Get generic OpenBSD definitions. */ +#define OBSD_OLD_GAS +#include <openbsd.h> + +/* Run-time target specifications. */ +#define CPP_PREDEFINES "-D__unix__ -D__sparc__ -D__OpenBSD__ -Asystem(unix) -Asystem(OpenBSD) -Acpu(sparc) -Amachine(sparc)" + +/* Layout of source language data types */ + +/* This must agree with <machine/ansi.h> */ +#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 + +/* Specific options for DBX Output. */ + +/* This is BSD, so it wants DBX format. */ +#define DBX_DEBUGGING_INFO + +/* This is the char to use for continuation */ +#define DBX_CONTIN_CHAR '?' + +/* Stack & calling: aggregate returns. */ + +/* 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 + +/* Assembler format: exception region output. */ + +/* All configurations that don't use elf must be explicit about not using + dwarf unwind information. egcs doesn't try too hard to check internal + configuration files... */ +#define DWARF2_UNWIND_INFO 0 + +/* Default sparc.h does already define ASM_OUTPUT_MI_THUNK */ + diff --git a/gcc/config/sparc/xm-openbsd.h b/gcc/config/sparc/xm-openbsd.h new file mode 100644 index 00000000000..2df7fb3e363 --- /dev/null +++ b/gcc/config/sparc/xm-openbsd.h @@ -0,0 +1,23 @@ +/* Configuration file for an host running sparc OpenBSD. + Copyright (C) 1999 Free Software Foundation, Inc. + +This file is part of GNU CC. + +GNU CC is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU CC is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU CC; see the file COPYING. If not, write to +the Free Software Foundation, 59 Temple Place - Suite 330, +Boston, MA 02111-1307, USA. */ + +#include <xm-openbsd.h> +#include <sparc/xm-sparc.h> + diff --git a/gcc/config/t-install-cpp b/gcc/config/t-install-cpp new file mode 100644 index 00000000000..9f887543d03 --- /dev/null +++ b/gcc/config/t-install-cpp @@ -0,0 +1,3 @@ +# Handle cpp installation. +INSTALL_CPP=install-cpp +UNINSTALL_CPP=uninstall-cpp diff --git a/gcc/config/t-openbsd b/gcc/config/t-openbsd new file mode 100644 index 00000000000..14bebc13e6b --- /dev/null +++ b/gcc/config/t-openbsd @@ -0,0 +1,7 @@ +# Don't run fixproto +STMP_FIXPROTO = + +# We don't need GCC's own include files but we do need lang specific ones. +USER_H = ${LANG_EXTRA_HEADERS} +INSTALL_ASSERT_H = + diff --git a/gcc/config/t-openbsd-thread b/gcc/config/t-openbsd-thread new file mode 100644 index 00000000000..4b25f25a4e5 --- /dev/null +++ b/gcc/config/t-openbsd-thread @@ -0,0 +1,5 @@ +# This is currently needed to compile libgcc2 for threads support +TARGET_LIBGCC2_CFLAGS=-pthread +#T_CFLAGS=-pthread +#T_CPPFLAGS=-pthread + diff --git a/gcc/config/tm-dwarf2.h b/gcc/config/tm-dwarf2.h new file mode 100644 index 00000000000..a580964ba1a --- /dev/null +++ b/gcc/config/tm-dwarf2.h @@ -0,0 +1,4 @@ +/* Enable Dwarf2 debugging and make it the default */ +#define DWARF2_DEBUGGING_INFO 1 +#define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG + diff --git a/gcc/config/x-interix b/gcc/config/x-interix new file mode 100644 index 00000000000..270770fe696 --- /dev/null +++ b/gcc/config/x-interix @@ -0,0 +1,29 @@ +# These are host overrides +# From config dir + +# Interix doesn't yet have alloca; it's better to use the portable C version for +# bootstrapping. Do this by defining ALLOCA. + +ALLOCA = alloca.o + +# See all the declarations. +FIXPROTO_DEFINES = -D_XOPEN_SOURCE + +# Don't run fixproto +STMP_FIXPROTO = +RANLIB = : +RANLIB_TEST = false +SHELL = sh + +# Existing CC/GCC may not define -D__INTERIX, so need this here. +X_CFLAGS= -D__INTERIX + +LIBGCC2_INCLUDES = -idirafter $${INTERIX_ROOT}/usr/include +# Headers come from a funny place +SYSTEM_HEADER_DIR=$${INTERIX_ROOT}/usr/include + +EXTRA_PARTS += crti.o + +crti.o: $(srcdir)/crti.c + $(GCC_FOR_TARGET) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $(srcdir)/crti.c + diff --git a/gcc/config/xm-interix.h b/gcc/config/xm-interix.h new file mode 100644 index 00000000000..46cbaee4e76 --- /dev/null +++ b/gcc/config/xm-interix.h @@ -0,0 +1,75 @@ +/* Configuration for GNU compiler for processor running Interix + Copyright (C) 1993, 1995, 1999 Free Software Foundation, Inc. + Donn Terry, Softway Systems, Inc, + from code + Contributed 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. */ + +#ifndef USG +#define USG 1 +#endif + +#ifndef ONLY_INT_FIELDS +#define ONLY_INT_FIELDS 1 +#endif + +#ifndef USE_PROTOTYPES +#define USE_PROTOTYPES 1 +#endif + +/* If not compiled with GNU C, use the portable alloca. */ +#ifndef __GNUC__ +#define USE_C_ALLOCA 1 +#endif + +#define NO_SYS_SIGLIST 1 + +/* Our strategy for finding global constructors is a bit different, although + not a lot. */ +#define DO_GLOBAL_CTORS_BODY \ +do { \ + int i; \ + unsigned long nptrs; \ + func_ptr *p; \ + asm( \ + " .section .ctor_head, \"rw\"\n" \ + "1:\n" \ + " .text \n" \ + ASM_LOAD_ADDR(1b,%0) \ + : "=r" (p) : : "cc"); \ + for (nptrs = 0; p[nptrs] != 0; nptrs++); \ + for (i = nptrs-1; i >= 0; i--) \ + p[i] (); \ +} while (0) + +#define DO_GLOBAL_DTORS_BODY \ +do { \ + func_ptr *p; \ + asm( \ + " .section .dtor_head, \"rw\"\n" \ + "1:\n" \ + " .text \n" \ + ASM_LOAD_ADDR(1b,%0) \ + : "=r" (p) : : "cc"); \ + while (*p) \ + { \ + p++; \ + (*(p-1)) (); \ + } \ +} while (0) diff --git a/gcc/config/xm-openbsd.h b/gcc/config/xm-openbsd.h new file mode 100644 index 00000000000..74a842184c3 --- /dev/null +++ b/gcc/config/xm-openbsd.h @@ -0,0 +1,35 @@ +/* Configuration fragment for hosts running a version of OpenBSD. + Copyright (C) 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. */ +/* This file gets included by all architectures. It holds stuff + that ought to be defined when hosting a compiler on an OpenBSD + machine, independently of the architecture. It's included by + ${cpu_type}/xm-openbsd.h, not included directly. */ + +/* OpenBSD is trying to be POSIX-compliant, to the point of fixing + problems that may occur with gcc's interpretation. */ +#undef POSIX +#define POSIX + +/* Ensure we get gnu C's defaults. */ +#ifdef __GNUC__ +#define alloca __builtin_alloca +#endif + + diff --git a/gcc/cppfiles.c b/gcc/cppfiles.c new file mode 100644 index 00000000000..aac49bd5437 --- /dev/null +++ b/gcc/cppfiles.c @@ -0,0 +1,1555 @@ +/* Part of CPP library. (include file handling) + Copyright (C) 1986, 87, 89, 92 - 95, 98, 1999 Free Software Foundation, Inc. + Written by Per Bothner, 1994. + Based on CCCP program by Paul Rubin, June 1986 + Adapted to ANSI C, Richard Stallman, Jan 1987 + Split out of cpplib.c, Zack Weinberg, Oct 1998 + +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" + +/* The entry points to this file are: find_include_file, finclude, + include_hash, append_include_chain, deps_output, and file_cleanup. + file_cleanup is only called through CPP_BUFFER(pfile)->cleanup, + so it's static anyway. */ + +static struct include_hash *redundant_include_p + PROTO ((cpp_reader *, + struct include_hash *, + struct file_name_list *)); +static struct file_name_map *read_name_map PROTO ((cpp_reader *, + const char *)); +static char *read_filename_string PROTO ((int, FILE *)); +static char *remap_filename PROTO ((cpp_reader *, char *, + struct file_name_list *)); +static long read_and_prescan PROTO ((cpp_reader *, cpp_buffer *, + int, size_t)); +static struct file_name_list *actual_directory PROTO ((cpp_reader *, char *)); + +#if 0 +static void hack_vms_include_specification PROTO ((char *)); +#endif + +/* Windows does not natively support inodes, and neither does MSDOS. + VMS has non-numeric inodes. */ +#ifdef VMS +#define INO_T_EQ(a, b) (!bcmp((char *) &(a), (char *) &(b), sizeof (a))) +#elif (defined _WIN32 && !defined CYGWIN && ! defined (_UWIN)) \ + || defined __MSDOS__ +#define INO_T_EQ(a, b) 0 +#else +#define INO_T_EQ(a, b) ((a) == (b)) +#endif + +/* Merge the four include chains together in the order quote, bracket, + system, after. Remove duplicate dirs (as determined by + INO_T_EQ()). The system_include and after_include chains are never + referred to again after this function; all access is through the + bracket_include path. + + For the future: Check if the directory is empty (but + how?) and possibly preload the include hash. */ + +void +merge_include_chains (opts) + struct cpp_options *opts; +{ + struct file_name_list *prev, *cur, *other; + struct file_name_list *quote, *brack, *systm, *after; + struct file_name_list *qtail, *btail, *stail, *atail; + + qtail = opts->pending->quote_tail; + btail = opts->pending->brack_tail; + stail = opts->pending->systm_tail; + atail = opts->pending->after_tail; + + quote = opts->pending->quote_head; + brack = opts->pending->brack_head; + systm = opts->pending->systm_head; + after = opts->pending->after_head; + + /* Paste together bracket, system, and after include chains. */ + if (stail) + stail->next = after; + else + systm = after; + if (btail) + btail->next = systm; + else + brack = systm; + + /* This is a bit tricky. + First we drop dupes from the quote-include list. + Then we drop dupes from the bracket-include list. + Finally, if qtail and brack are the same directory, + we cut out qtail. + + We can't just merge the lists and then uniquify them because + then we may lose directories from the <> search path that should + be there; consider -Ifoo -Ibar -I- -Ifoo -Iquux. It is however + safe to treat -Ibar -Ifoo -I- -Ifoo -Iquux as if written + -Ibar -I- -Ifoo -Iquux. + + Note that this algorithm is quadratic in the number of -I switches, + which is acceptable since there aren't usually that many of them. */ + + for (cur = quote; cur; cur = cur->next) + { + for (other = quote; other != cur; other = other->next) + if (INO_T_EQ (cur->ino, other->ino) + && cur->dev == other->dev) + { + if (opts->verbose) + cpp_notice ("ignoring duplicate directory `%s'\n", cur->name); + + prev->next = cur->next; + free (cur->name); + free (cur); + cur = prev; + break; + } + prev = cur; + } + qtail = prev; + + for (cur = brack; cur; cur = cur->next) + { + for (other = brack; other != cur; other = other->next) + if (INO_T_EQ (cur->ino, other->ino) + && cur->dev == other->dev) + { + if (opts->verbose) + cpp_notice ("ignoring duplicate directory `%s'\n", cur->name); + + prev->next = cur->next; + free (cur->name); + free (cur); + cur = prev; + break; + } + prev = cur; + } + + if (quote) + { + if (INO_T_EQ (qtail->ino, brack->ino) && qtail->dev == brack->dev) + { + if (quote == qtail) + { + if (opts->verbose) + cpp_notice ("ignoring duplicate directory `%s'\n", + quote->name); + + free (quote->name); + free (quote); + quote = brack; + } + else + { + cur = quote; + while (cur->next != qtail) + cur = cur->next; + cur->next = brack; + if (opts->verbose) + cpp_notice ("ignoring duplicate directory `%s'\n", + qtail->name); + + free (qtail->name); + free (qtail); + } + } + else + qtail->next = brack; + } + else + quote = brack; + + opts->quote_include = quote; + opts->bracket_include = brack; +} + +/* Look up or add an entry to the table of all includes. This table + is indexed by the name as it appears in the #include line. The + ->next_this_file chain stores all different files with the same + #include name (there are at least three ways this can happen). The + hash function could probably be improved a bit. */ + +struct include_hash * +include_hash (pfile, fname, add) + cpp_reader *pfile; + char *fname; + int add; +{ + unsigned int hash = 0; + struct include_hash *l, *m; + char *f = fname; + + while (*f) + hash += *f++; + + l = pfile->all_include_files[hash % ALL_INCLUDE_HASHSIZE]; + m = 0; + for (; l; m = l, l = l->next) + if (!strcmp (l->nshort, fname)) + return l; + + if (!add) + return 0; + + l = (struct include_hash *) xmalloc (sizeof (struct include_hash)); + l->next = NULL; + l->next_this_file = NULL; + l->foundhere = NULL; + l->buf = NULL; + l->limit = NULL; + if (m) + m->next = l; + else + pfile->all_include_files[hash % ALL_INCLUDE_HASHSIZE] = l; + + return l; +} + +/* Return 0 if the file pointed to by IHASH has never been included before, + -1 if it has been included before and need not be again, + or a pointer to an IHASH entry which is the file to be reread. + "Never before" is with respect to the position in ILIST. + + This will not detect redundancies involving odd uses of the + `current directory' rule for "" includes. They aren't quite + pathological, but I think they are rare enough not to worry about. + The simplest example is: + + top.c: + #include "a/a.h" + #include "b/b.h" + + a/a.h: + #include "../b/b.h" + + and the problem is that for `current directory' includes, + ihash->foundhere is not on any of the global include chains, + so the test below (i->foundhere == l) may be false even when + the directories are in fact the same. */ + +static struct include_hash * +redundant_include_p (pfile, ihash, ilist) + cpp_reader *pfile; + struct include_hash *ihash; + struct file_name_list *ilist; +{ + struct file_name_list *l; + struct include_hash *i; + + if (! ihash->foundhere) + return 0; + + for (i = ihash; i; i = i->next_this_file) + for (l = ilist; l; l = l->next) + if (i->foundhere == l) + /* The control_macro works like this: If it's NULL, the file + is to be included again. If it's "", the file is never to + be included again. If it's a string, the file is not to be + included again if the string is the name of a defined macro. */ + return (i->control_macro + && (i->control_macro[0] == '\0' + || cpp_lookup (pfile, i->control_macro, -1, -1))) + ? (struct include_hash *)-1 : i; + + return 0; +} + +static int +file_cleanup (pbuf, pfile) + cpp_buffer *pbuf; + cpp_reader *pfile; +{ + if (pbuf->buf) + { + free (pbuf->buf); + pbuf->buf = 0; + } + if (pfile->system_include_depth) + pfile->system_include_depth--; + return 0; +} + +/* Search for include file FNAME in the include chain starting at + SEARCH_START. Return -2 if this file doesn't need to be included + (because it was included already and it's marked idempotent), + -1 if an error occurred, or a file descriptor open on the file. + *IHASH is set to point to the include hash entry for this file, and + *BEFORE is 1 if the file was included before (but needs to be read + again). */ +int +find_include_file (pfile, fname, search_start, ihash, before) + cpp_reader *pfile; + char *fname; + struct file_name_list *search_start; + struct include_hash **ihash; + int *before; +{ + struct file_name_list *l; + struct include_hash *ih, *jh; + int f, len; + char *name; + + ih = include_hash (pfile, fname, 1); + jh = redundant_include_p (pfile, ih, + fname[0] == '/' ? ABSOLUTE_PATH : search_start); + + if (jh != 0) + { + *before = 1; + *ihash = jh; + + if (jh == (struct include_hash *)-1) + return -2; + else + return open (jh->name, O_RDONLY, 0666); + } + + if (ih->foundhere) + /* A file is already known by this name, but it's not the same file. + Allocate another include_hash block and add it to the next_this_file + chain. */ + { + jh = (struct include_hash *)xmalloc (sizeof (struct include_hash)); + while (ih->next_this_file) ih = ih->next_this_file; + + ih->next_this_file = jh; + jh = ih; + ih = ih->next_this_file; + + ih->next = NULL; + ih->next_this_file = NULL; + ih->buf = NULL; + ih->limit = NULL; + } + *before = 0; + *ihash = ih; + ih->nshort = xstrdup (fname); + ih->control_macro = NULL; + + /* If the pathname is absolute, just open it. */ + if (fname[0] == '/') + { + ih->foundhere = ABSOLUTE_PATH; + ih->name = ih->nshort; + return open (ih->name, O_RDONLY, 0666); + } + + /* Search directory path, trying to open the file. */ + + len = strlen (fname); + name = xmalloc (len + pfile->max_include_len + 2 + INCLUDE_LEN_FUDGE); + + for (l = search_start; l; l = l->next) + { + bcopy (l->name, name, l->nlen); + name[l->nlen] = '/'; + strcpy (&name[l->nlen+1], fname); + simplify_pathname (name); + if (CPP_OPTIONS (pfile)->remap) + name = remap_filename (pfile, name, l); + + f = open (name, O_RDONLY|O_NONBLOCK|O_NOCTTY, 0666); +#ifdef EACCES + if (f == -1 && errno == EACCES) + { + cpp_error(pfile, "included file `%s' exists but is not readable", + name); + return -1; + } +#endif + + if (f >= 0) + { + ih->foundhere = l; + ih->name = xrealloc (name, strlen (name)+1); + return f; + } + } + + if (jh) + { + jh->next_this_file = NULL; + free (ih); + } + free (name); + *ihash = (struct include_hash *)-1; + return -1; +} + +/* The file_name_map structure holds a mapping of file names for a + particular directory. This mapping is read from the file named + FILE_NAME_MAP_FILE in that directory. Such a file can be used to + map filenames on a file system with severe filename restrictions, + such as DOS. The format of the file name map file is just a series + of lines with two tokens on each line. The first token is the name + to map, and the second token is the actual name to use. */ + +struct file_name_map +{ + struct file_name_map *map_next; + char *map_from; + char *map_to; +}; + +#define FILE_NAME_MAP_FILE "header.gcc" + +/* Read a space delimited string of unlimited length from a stdio + file. */ + +static char * +read_filename_string (ch, f) + int ch; + FILE *f; +{ + char *alloc, *set; + int len; + + len = 20; + set = alloc = xmalloc (len + 1); + if (! is_space[ch]) + { + *set++ = ch; + while ((ch = getc (f)) != EOF && ! is_space[ch]) + { + if (set - alloc == len) + { + len *= 2; + alloc = xrealloc (alloc, len + 1); + set = alloc + len / 2; + } + *set++ = ch; + } + } + *set = '\0'; + ungetc (ch, f); + return alloc; +} + +/* This structure holds a linked list of file name maps, one per directory. */ + +struct file_name_map_list +{ + struct file_name_map_list *map_list_next; + char *map_list_name; + struct file_name_map *map_list_map; +}; + +/* Read the file name map file for DIRNAME. */ + +static struct file_name_map * +read_name_map (pfile, dirname) + cpp_reader *pfile; + const char *dirname; +{ + register struct file_name_map_list *map_list_ptr; + char *name; + FILE *f; + + for (map_list_ptr = CPP_OPTIONS (pfile)->map_list; map_list_ptr; + map_list_ptr = map_list_ptr->map_list_next) + if (! strcmp (map_list_ptr->map_list_name, dirname)) + return map_list_ptr->map_list_map; + + map_list_ptr = ((struct file_name_map_list *) + xmalloc (sizeof (struct file_name_map_list))); + map_list_ptr->map_list_name = xstrdup (dirname); + + name = (char *) alloca (strlen (dirname) + strlen (FILE_NAME_MAP_FILE) + 2); + strcpy (name, dirname); + if (*dirname) + strcat (name, "/"); + strcat (name, FILE_NAME_MAP_FILE); + f = fopen (name, "r"); + if (!f) + map_list_ptr->map_list_map = (struct file_name_map *)-1; + else + { + int ch; + int dirlen = strlen (dirname); + + while ((ch = getc (f)) != EOF) + { + char *from, *to; + struct file_name_map *ptr; + + if (is_space[ch]) + continue; + from = read_filename_string (ch, f); + while ((ch = getc (f)) != EOF && is_hor_space[ch]) + ; + to = read_filename_string (ch, f); + + ptr = ((struct file_name_map *) + xmalloc (sizeof (struct file_name_map))); + ptr->map_from = from; + + /* Make the real filename absolute. */ + if (*to == '/') + ptr->map_to = to; + else + { + ptr->map_to = xmalloc (dirlen + strlen (to) + 2); + strcpy (ptr->map_to, dirname); + ptr->map_to[dirlen] = '/'; + strcpy (ptr->map_to + dirlen + 1, to); + free (to); + } + + ptr->map_next = map_list_ptr->map_list_map; + map_list_ptr->map_list_map = ptr; + + while ((ch = getc (f)) != '\n') + if (ch == EOF) + break; + } + fclose (f); + } + + map_list_ptr->map_list_next = CPP_OPTIONS (pfile)->map_list; + CPP_OPTIONS (pfile)->map_list = map_list_ptr; + + return map_list_ptr->map_list_map; +} + +/* Remap NAME based on the file_name_map (if any) for LOC. */ + +static char * +remap_filename (pfile, name, loc) + cpp_reader *pfile; + char *name; + struct file_name_list *loc; +{ + struct file_name_map *map; + const char *from, *p, *dir; + + if (! loc->name_map) + loc->name_map = read_name_map (pfile, + loc->name + ? loc->name : "."); + + if (loc->name_map == (struct file_name_map *)-1) + return name; + + from = name + strlen (loc->name) + 1; + + for (map = loc->name_map; map; map = map->map_next) + if (!strcmp (map->map_from, from)) + return map->map_to; + + /* Try to find a mapping file for the particular directory we are + looking in. Thus #include <sys/types.h> will look up sys/types.h + in /usr/include/header.gcc and look up types.h in + /usr/include/sys/header.gcc. */ + p = rindex (name, '/'); + if (!p) + p = name; + if (loc && loc->name + && strlen (loc->name) == (size_t) (p - name) + && !strncmp (loc->name, name, p - name)) + /* FILENAME is in SEARCHPTR, which we've already checked. */ + return name; + + if (p == name) + { + dir = "."; + from = name; + } + else + { + char * newdir = (char *) alloca (p - name + 1); + bcopy (name, newdir, p - name); + newdir[p - name] = '\0'; + dir = newdir; + from = p + 1; + } + + for (map = read_name_map (pfile, dir); map; map = map->map_next) + if (! strcmp (map->map_from, name)) + return map->map_to; + + return name; +} + +/* Read the contents of FD into the buffer on the top of PFILE's stack. + IHASH points to the include hash entry for the file associated with + FD. + + The caller is responsible for the cpp_push_buffer. */ + +int +finclude (pfile, fd, ihash) + cpp_reader *pfile; + int fd; + struct include_hash *ihash; +{ + struct stat st; + size_t st_size; + long length; + cpp_buffer *fp; + + if (fstat (fd, &st) < 0) + goto perror_fail; + if (fcntl (fd, F_SETFL, 0) == -1) /* turn off nonblocking mode */ + goto perror_fail; + + fp = CPP_BUFFER (pfile); + + /* If fd points to a plain file, we know how big it is, so we can + allocate the buffer all at once. If fd is a pipe or terminal, we + can't. Most C source files are 4k or less, so we guess that. If + fd is something weird, like a block device or a directory, we + don't want to read it at all. + + Unfortunately, different systems use different st.st_mode values + for pipes: some have S_ISFIFO, some S_ISSOCK, some are buggy and + zero the entire struct stat except a couple fields. Hence the + mess below. + + In all cases, read_and_prescan will resize the buffer if it + turns out there's more data than we thought. */ + + if (S_ISREG (st.st_mode)) + { + /* off_t might have a wider range than size_t - in other words, + the max size of a file might be bigger than the address + space. We can't handle a file that large. (Anyone with + a single source file bigger than 4GB needs to rethink + their coding style.) */ + st_size = (size_t) st.st_size; + if ((unsigned HOST_WIDEST_INT) st_size + != (unsigned HOST_WIDEST_INT) st.st_size) + { + cpp_error (pfile, "file `%s' is too large", ihash->name); + goto fail; + } + } + else if (S_ISFIFO (st.st_mode) || S_ISSOCK (st.st_mode) + /* Some 4.x (x<4) derivatives have a bug that makes fstat() of a + socket or pipe return a stat struct with most fields zeroed. */ + || (st.st_mode == 0 && st.st_nlink == 0 && st.st_size == 0) + || (S_ISCHR (st.st_mode) && isatty (fd))) + { + /* Cannot get its file size before reading. 4k is a decent + first guess. */ + st_size = 4096; + } + else + { + cpp_error (pfile, "`%s' is not a file, pipe, or tty", ihash->name); + goto fail; + } + + /* Read the file, converting end-of-line characters and trigraphs + (if enabled). */ + fp->ihash = ihash; + fp->nominal_fname = fp->fname = ihash->name; + length = read_and_prescan (pfile, fp, fd, st_size); + if (length < 0) + goto fail; + if (length == 0) + ihash->control_macro = ""; /* never re-include */ + + close (fd); + fp->rlimit = fp->alimit = fp->buf + length; + fp->cur = fp->buf; + if (ihash->foundhere != ABSOLUTE_PATH) + fp->system_header_p = ihash->foundhere->sysp; + fp->lineno = 1; + fp->colno = 1; + fp->cleanup = file_cleanup; + + /* The ->actual_dir field is only used when ignore_srcdir is not in effect; + see do_include */ + if (!CPP_OPTIONS (pfile)->ignore_srcdir) + fp->actual_dir = actual_directory (pfile, fp->fname); + + pfile->input_stack_listing_current = 0; + return 1; + + perror_fail: + cpp_error_from_errno (pfile, ihash->name); + fail: + cpp_pop_buffer (pfile); + close (fd); + return 0; +} + +/* Given a path FNAME, extract the directory component and place it + onto the actual_dirs list. Return a pointer to the allocated + file_name_list structure. These structures are used to implement + current-directory "" include searching. */ + +static struct file_name_list * +actual_directory (pfile, fname) + cpp_reader *pfile; + char *fname; +{ + char *last_slash, *dir; + size_t dlen; + struct file_name_list *x; + + dir = xstrdup (fname); + last_slash = rindex (dir, '/'); + if (last_slash) + { + if (last_slash == dir) + { + dlen = 1; + last_slash[1] = '\0'; + } + else + { + dlen = last_slash - dir; + *last_slash = '\0'; + } + } + else + { + dir[0] = '.'; + dir[1] = '\0'; + dlen = 1; + } + + if (dlen > pfile->max_include_len) + pfile->max_include_len = dlen; + + for (x = pfile->actual_dirs; x; x = x->alloc) + if (!strcmp (x->name, dir)) + { + free (dir); + return x; + } + + /* Not found, make a new one. */ + x = (struct file_name_list *) xmalloc (sizeof (struct file_name_list)); + x->name = dir; + x->nlen = dlen; + x->next = CPP_OPTIONS (pfile)->quote_include; + x->alloc = pfile->actual_dirs; + x->sysp = CPP_BUFFER (pfile)->system_header_p; + x->name_map = NULL; + + pfile->actual_dirs = x; + return x; +} + +/* Almost but not quite the same as adjust_position in cpplib.c. + Used only by read_and_prescan. */ +static void +find_position (start, limit, linep, colp) + U_CHAR *start; + U_CHAR *limit; + long *linep; + long *colp; +{ + long line = *linep, col = 0; + while (start < limit) + { + U_CHAR ch = *start++; + if (ch == '\n' || ch == '\r') + line++, col = 1; + else + col++; + } + *linep = line, *colp = col; +} + +/* Read the entire contents of file DESC into buffer BUF. LEN is how + much memory to allocate initially; more will be allocated if + necessary. Convert end-of-line markers (\n, \r, \r\n, \n\r) to + canonical form (\n). If enabled, convert and/or warn about + trigraphs. Convert backslash-newline to a one-character escape + (\r) and remove it from "embarrassing" places (i.e. the middle of a + token). If there is no newline at the end of the file, add one and + warn. Returns -1 on failure, or the actual length of the data to + be scanned. + + This function does a lot of work, and can be a serious performance + bottleneck. It has been tuned heavily; make sure you understand it + before hacking. The common case - no trigraphs, Unix style line + breaks, backslash-newline set off by whitespace, newline at EOF - + has been optimized at the expense of the others. The performance + penalty for DOS style line breaks (\r\n) is about 15%. + + Warnings lose particularly heavily since we have to determine the + line number, which involves scanning from the beginning of the file + or from the last warning. The penalty for the absence of a newline + at the end of reload1.c is about 60%. (reload1.c is 329k.) + + If your file has more than one kind of end-of-line marker, you + will get messed-up line numbering. */ + +#ifndef PIPE_BUF +#define PIPE_BUF 4096 +#endif + +static long +read_and_prescan (pfile, fp, desc, len) + cpp_reader *pfile; + cpp_buffer *fp; + int desc; + size_t len; +{ + U_CHAR *buf = (U_CHAR *) xmalloc (len); + U_CHAR *ip, *op, *line_base; + U_CHAR *ibase; + unsigned int line, deferred_newlines; + int count; + size_t offset; + /* PIPE_BUF bytes of buffer proper, 2 to detect running off the end + without address arithmetic all the time, and 2 for pushback in + the case there's a potential trigraph or end-of-line digraph at + the end of a block. */ + U_CHAR intermed[PIPE_BUF + 2 + 2]; + + /* Table of characters that can't be handled in the inner loop. + Keep these contiguous to optimize the performance of the code generated + for the switch that uses them. */ +#define SPECCASE_EMPTY 0 +#define SPECCASE_NUL 1 +#define SPECCASE_CR 2 +#define SPECCASE_BACKSLASH 3 +#define SPECCASE_QUESTION 4 + U_CHAR speccase[256]; + + offset = 0; + op = buf; + line_base = buf; + line = 1; + ibase = intermed + 2; + deferred_newlines = 0; + + memset (speccase, SPECCASE_EMPTY, sizeof (speccase)); + speccase['\0'] = SPECCASE_NUL; + speccase['\r'] = SPECCASE_CR; + speccase['\\'] = SPECCASE_BACKSLASH; + if (CPP_OPTIONS (pfile)->trigraphs || CPP_OPTIONS (pfile)->warn_trigraphs) + speccase['?'] = SPECCASE_QUESTION; + + for (;;) + { + read_next: + + count = read (desc, intermed + 2, PIPE_BUF); + if (count < 0) + goto error; + else if (count == 0) + break; + + offset += count; + ip = ibase; + ibase = intermed + 2; + ibase[count] = ibase[count+1] = '\0'; + + if (offset > len) + { + size_t delta_op; + size_t delta_line_base; + len *= 2; + if (offset > len) + /* len overflowed. + This could happen if the file is larger than half the + maximum address space of the machine. */ + goto too_big; + + delta_op = op - buf; + delta_line_base = line_base - buf; + buf = (U_CHAR *) xrealloc (buf, len); + op = buf + delta_op; + line_base = buf + delta_line_base; + } + + for (;;) + { + unsigned int span = 0; + + /* Deal with \-newline in the middle of a token. */ + if (deferred_newlines) + { + while (speccase[ip[span]] == SPECCASE_EMPTY + && ip[span] != '\n' + && ip[span] != '\t' + && ip[span] != ' ') + span++; + memcpy (op, ip, span); + op += span; + ip += span; + if (*ip == '\n' || *ip == '\t' + || *ip == ' ' || *ip == ' ') + while (deferred_newlines) + deferred_newlines--, *op++ = '\r'; + span = 0; + } + + /* Copy as much as we can without special treatment. */ + while (speccase[ip[span]] == SPECCASE_EMPTY) span++; + memcpy (op, ip, span); + op += span; + ip += span; + + switch (speccase[*ip++]) + { + case SPECCASE_NUL: /* \0 */ + ibase[-1] = op[-1]; + goto read_next; + + case SPECCASE_CR: /* \r */ + if (*ip == '\n') + ip++; + else if (*ip == '\0') + { + --ibase; + intermed[1] = '\r'; + goto read_next; + } + else if (ip[-2] == '\n') + continue; + *op++ = '\n'; + break; + + case SPECCASE_BACKSLASH: /* \ */ + backslash: + { + /* If we're at the end of the intermediate buffer, + we have to shift the backslash down to the start + and come back next pass. */ + if (*ip == '\0') + { + --ibase; + intermed[1] = '\\'; + goto read_next; + } + else if (*ip == '\n') + { + ip++; + if (*ip == '\r') ip++; + if (*ip == '\n' || *ip == '\t' || *ip == ' ') + *op++ = '\r'; + else if (op[-1] == '\t' || op[-1] == ' ' + || op[-1] == '\r' || op[-1] == '\n') + *op++ = '\r'; + else + deferred_newlines++; + line++; + line_base = op; + } + else if (*ip == '\r') + { + ip++; + if (*ip == '\n') ip++; + else if (*ip == '\0') + { + ibase -= 2; + intermed[0] = '\\'; + intermed[1] = '\r'; + goto read_next; + } + else if (*ip == '\r' || *ip == '\t' || *ip == ' ') + *op++ = '\r'; + else + deferred_newlines++; + line++; + line_base = op; + } + else + *op++ = '\\'; + } + break; + + case SPECCASE_QUESTION: /* ? */ + { + unsigned int d; + /* If we're at the end of the intermediate buffer, + we have to shift the ?'s down to the start and + come back next pass. */ + d = ip[0]; + if (d == '\0') + { + --ibase; + intermed[1] = '?'; + goto read_next; + } + if (d != '?') + { + *op++ = '?'; + break; + } + d = ip[1]; + if (d == '\0') + { + ibase -= 2; + intermed[0] = intermed[1] = '?'; + goto read_next; + } + if (!trigraph_table[d]) + { + *op++ = '?'; + break; + } + + if (CPP_OPTIONS (pfile)->warn_trigraphs) + { + long col; + find_position (line_base, op, &line, &col); + line_base = op - col; + cpp_warning_with_line (pfile, line, col, + "trigraph ??%c encountered", d); + } + if (CPP_OPTIONS (pfile)->trigraphs) + { + if (trigraph_table[d] == '\\') + goto backslash; + else + *op++ = trigraph_table[d]; + } + else + { + *op++ = '?'; + *op++ = '?'; + *op++ = d; + } + ip += 2; + } + } + } + } + + if (offset == 0) + return 0; + + /* Deal with pushed-back chars at true EOF. + This may be any of: ?? ? \ \r \n \\r \\n. + \r must become \n, \\r or \\n must become \r. + We know we have space already. */ + if (ibase == intermed) + { + if (*ibase == '?') + { + *op++ = '?'; + *op++ = '?'; + } + else + *op++ = '\r'; + } + else if (ibase == intermed + 1) + { + if (*ibase == '\r') + *op++ = '\n'; + else + *op++ = *ibase; + } + + if (op[-1] != '\n') + { + long col; + find_position (line_base, op, &line, &col); + cpp_warning_with_line (pfile, line, col, "no newline at end of file\n"); + if (offset + 1 > len) + { + len += 1; + if (offset + 1 > len) + goto too_big; + buf = (U_CHAR *) xrealloc (buf, len); + op = buf + offset; + } + *op++ = '\n'; + } + + fp->buf = ((len - offset < 20) ? buf : (U_CHAR *)xrealloc (buf, op - buf)); + return op - buf; + + too_big: + cpp_error (pfile, "file is too large (>%lu bytes)\n", (unsigned long)offset); + free (buf); + return -1; + + error: + cpp_error_from_errno (pfile, fp->fname); + free (buf); + return -1; +} + +/* Add output to `deps_buffer' for the -M switch. + STRING points to the text to be output. + SPACER is ':' for targets, ' ' for dependencies, zero for text + to be inserted literally. */ + +void +deps_output (pfile, string, spacer) + cpp_reader *pfile; + char *string; + int spacer; +{ + int size; + int cr = 0; + + if (!*string) + return; + + size = strlen (string); + +#ifndef MAX_OUTPUT_COLUMNS +#define MAX_OUTPUT_COLUMNS 72 +#endif + if (pfile->deps_column > 0 + && (pfile->deps_column + size) > MAX_OUTPUT_COLUMNS) + { + cr = 5; + pfile->deps_column = 0; + } + + if (pfile->deps_size + size + cr + 8 > pfile->deps_allocated_size) + { + pfile->deps_allocated_size = (pfile->deps_size + size + 50) * 2; + pfile->deps_buffer = (char *) xrealloc (pfile->deps_buffer, + pfile->deps_allocated_size); + } + + if (cr) + { + bcopy (" \\\n ", &pfile->deps_buffer[pfile->deps_size], 5); + pfile->deps_size += 5; + } + + if (spacer == ' ' && pfile->deps_column > 0) + pfile->deps_buffer[pfile->deps_size++] = ' '; + bcopy (string, &pfile->deps_buffer[pfile->deps_size], size); + pfile->deps_size += size; + pfile->deps_column += size; + if (spacer == ':') + pfile->deps_buffer[pfile->deps_size++] = ':'; + pfile->deps_buffer[pfile->deps_size] = 0; +} + +/* Simplify a path name in place, deleting redundant components. This + reduces OS overhead and guarantees that equivalent paths compare + the same (modulo symlinks). + + Transforms made: + foo/bar/../quux foo/quux + foo/./bar foo/bar + foo//bar foo/bar + /../quux /quux + //quux //quux (POSIX allows leading // as a namespace escape) + + Guarantees no trailing slashes. All transforms reduce the length + of the string. + */ +void +simplify_pathname (path) + char *path; +{ + char *from, *to; + char *base; + int absolute = 0; + +#if defined _WIN32 || defined __MSDOS__ + /* Convert all backslashes to slashes. */ + for (from = path; *from; from++) + if (*from == '\\') *from = '/'; + + /* Skip over leading drive letter if present. */ + if (ISALPHA (path[0]) && path[1] == ':') + from = to = &path[2]; + else + from = to = path; +#else + from = to = path; +#endif + + /* Remove redundant initial /s. */ + if (*from == '/') + { + absolute = 1; + to++; + from++; + if (*from == '/') + { + if (*++from == '/') + /* 3 or more initial /s are equivalent to 1 /. */ + while (*++from == '/'); + else + /* On some hosts // differs from /; Posix allows this. */ + to++; + } + } + base = to; + + for (;;) + { + while (*from == '/') + from++; + + if (from[0] == '.' && from[1] == '/') + from += 2; + else if (from[0] == '.' && from[1] == '\0') + goto done; + else if (from[0] == '.' && from[1] == '.' && from[2] == '/') + { + if (base == to) + { + if (absolute) + from += 3; + else + { + *to++ = *from++; + *to++ = *from++; + *to++ = *from++; + base = to; + } + } + else + { + to -= 2; + while (to > base && *to != '/') to--; + if (*to == '/') + to++; + from += 3; + } + } + else if (from[0] == '.' && from[1] == '.' && from[2] == '\0') + { + if (base == to) + { + if (!absolute) + { + *to++ = *from++; + *to++ = *from++; + } + } + else + { + to -= 2; + while (to > base && *to != '/') to--; + if (*to == '/') + to++; + } + goto done; + } + else + /* Copy this component and trailing /, if any. */ + while ((*to++ = *from++) != '/') + { + if (!to[-1]) + { + to--; + goto done; + } + } + + } + + done: + /* Trim trailing slash */ + if (to[0] == '/' && (!absolute || to > path+1)) + to--; + + /* Change the empty string to "." so that stat() on the result + will always work. */ + if (to == path) + *to++ = '.'; + + *to = '\0'; + + return; +} + +/* It is not clear when this should be used if at all, so I've + disabled it until someone who understands VMS can look at it. */ +#if 0 + +/* Under VMS we need to fix up the "include" specification filename. + + Rules for possible conversions + + fullname tried paths + + name name + ./dir/name [.dir]name + /dir/name dir:name + /name [000000]name, name + dir/name dir:[000000]name, dir:name, dir/name + dir1/dir2/name dir1:[dir2]name, dir1:[000000.dir2]name + path:/name path:[000000]name, path:name + path:/dir/name path:[000000.dir]name, path:[dir]name + path:dir/name path:[dir]name + [path]:[dir]name [path.dir]name + path/[dir]name [path.dir]name + + The path:/name input is constructed when expanding <> includes. */ + + +static void +hack_vms_include_specification (fullname) + char *fullname; +{ + register char *basename, *unixname, *local_ptr, *first_slash; + int f, check_filename_before_returning, must_revert; + char Local[512]; + + check_filename_before_returning = 0; + must_revert = 0; + /* See if we can find a 1st slash. If not, there's no path information. */ + first_slash = index (fullname, '/'); + if (first_slash == 0) + return 0; /* Nothing to do!!! */ + + /* construct device spec if none given. */ + + if (index (fullname, ':') == 0) + { + + /* If fullname has a slash, take it as device spec. */ + + if (first_slash == fullname) + { + first_slash = index (fullname+1, '/'); /* 2nd slash ? */ + if (first_slash) + *first_slash = ':'; /* make device spec */ + for (basename = fullname; *basename != 0; basename++) + *basename = *(basename+1); /* remove leading slash */ + } + else if ((first_slash[-1] != '.') /* keep ':/', './' */ + && (first_slash[-1] != ':') + && (first_slash[-1] != ']')) /* or a vms path */ + { + *first_slash = ':'; + } + else if ((first_slash[1] == '[') /* skip './' in './[dir' */ + && (first_slash[-1] == '.')) + fullname += 2; + } + + /* Get part after first ':' (basename[-1] == ':') + or last '/' (basename[-1] == '/'). */ + + basename = base_name (fullname); + + local_ptr = Local; /* initialize */ + + /* We are trying to do a number of things here. First of all, we are + trying to hammer the filenames into a standard format, such that later + processing can handle them. + + If the file name contains something like [dir.], then it recognizes this + as a root, and strips the ".]". Later processing will add whatever is + needed to get things working properly. + + If no device is specified, then the first directory name is taken to be + a device name (or a rooted logical). */ + + /* Point to the UNIX filename part (which needs to be fixed!) + but skip vms path information. + [basename != fullname since first_slash != 0]. */ + + if ((basename[-1] == ':') /* vms path spec. */ + || (basename[-1] == ']') + || (basename[-1] == '>')) + unixname = basename; + else + unixname = fullname; + + if (*unixname == '/') + unixname++; + + /* If the directory spec is not rooted, we can just copy + the UNIX filename part and we are done. */ + + if (((basename - fullname) > 1) + && ( (basename[-1] == ']') + || (basename[-1] == '>'))) + { + if (basename[-2] != '.') + { + + /* The VMS part ends in a `]', and the preceding character is not a `.'. + -> PATH]:/name (basename = '/name', unixname = 'name') + We strip the `]', and then splice the two parts of the name in the + usual way. Given the default locations for include files in cccp.c, + we will only use this code if the user specifies alternate locations + with the /include (-I) switch on the command line. */ + + basename -= 1; /* Strip "]" */ + unixname--; /* backspace */ + } + else + { + + /* The VMS part has a ".]" at the end, and this will not do. Later + processing will add a second directory spec, and this would be a syntax + error. Thus we strip the ".]", and thus merge the directory specs. + We also backspace unixname, so that it points to a '/'. This inhibits the + generation of the 000000 root directory spec (which does not belong here + in this case). */ + + basename -= 2; /* Strip ".]" */ + unixname--; /* backspace */ + } + } + + else + + { + + /* We drop in here if there is no VMS style directory specification yet. + If there is no device specification either, we make the first dir a + device and try that. If we do not do this, then we will be essentially + searching the users default directory (as if they did a #include "asdf.h"). + + Then all we need to do is to push a '[' into the output string. Later + processing will fill this in, and close the bracket. */ + + if ((unixname != fullname) /* vms path spec found. */ + && (basename[-1] != ':')) + *local_ptr++ = ':'; /* dev not in spec. take first dir */ + + *local_ptr++ = '['; /* Open the directory specification */ + } + + if (unixname == fullname) /* no vms dir spec. */ + { + must_revert = 1; + if ((first_slash != 0) /* unix dir spec. */ + && (*unixname != '/') /* not beginning with '/' */ + && (*unixname != '.')) /* or './' or '../' */ + *local_ptr++ = '.'; /* dir is local ! */ + } + + /* at this point we assume that we have the device spec, and (at least + the opening "[" for a directory specification. We may have directories + specified already. + + If there are no other slashes then the filename will be + in the "root" directory. Otherwise, we need to add + directory specifications. */ + + if (index (unixname, '/') == 0) + { + /* if no directories specified yet and none are following. */ + if (local_ptr[-1] == '[') + { + /* Just add "000000]" as the directory string */ + strcpy (local_ptr, "000000]"); + local_ptr += strlen (local_ptr); + check_filename_before_returning = 1; /* we might need to fool with this later */ + } + } + else + { + + /* As long as there are still subdirectories to add, do them. */ + while (index (unixname, '/') != 0) + { + /* If this token is "." we can ignore it + if it's not at the beginning of a path. */ + if ((unixname[0] == '.') && (unixname[1] == '/')) + { + /* remove it at beginning of path. */ + if ( ((unixname == fullname) /* no device spec */ + && (fullname+2 != basename)) /* starts with ./ */ + /* or */ + || ((basename[-1] == ':') /* device spec */ + && (unixname-1 == basename))) /* and ./ afterwards */ + *local_ptr++ = '.'; /* make '[.' start of path. */ + unixname += 2; + continue; + } + + /* Add a subdirectory spec. Do not duplicate "." */ + if ( local_ptr[-1] != '.' + && local_ptr[-1] != '[' + && local_ptr[-1] != '<') + *local_ptr++ = '.'; + + /* If this is ".." then the spec becomes "-" */ + if ( (unixname[0] == '.') + && (unixname[1] == '.') + && (unixname[2] == '/')) + { + /* Add "-" and skip the ".." */ + if ((local_ptr[-1] == '.') + && (local_ptr[-2] == '[')) + local_ptr--; /* prevent [.- */ + *local_ptr++ = '-'; + unixname += 3; + continue; + } + + /* Copy the subdirectory */ + while (*unixname != '/') + *local_ptr++= *unixname++; + + unixname++; /* Skip the "/" */ + } + + /* Close the directory specification */ + if (local_ptr[-1] == '.') /* no trailing periods */ + local_ptr--; + + if (local_ptr[-1] == '[') /* no dir needed */ + local_ptr--; + else + *local_ptr++ = ']'; + } + + /* Now add the filename. */ + + while (*unixname) + *local_ptr++ = *unixname++; + *local_ptr = 0; + + /* Now append it to the original VMS spec. */ + + strcpy ((must_revert==1)?fullname:basename, Local); + + /* If we put a [000000] in the filename, try to open it first. If this fails, + remove the [000000], and return that name. This provides flexibility + to the user in that they can use both rooted and non-rooted logical names + to point to the location of the file. */ + + if (check_filename_before_returning) + { + f = open (fullname, O_RDONLY, 0666); + if (f >= 0) + { + /* The file name is OK as it is, so return it as is. */ + close (f); + return 1; + } + + /* The filename did not work. Try to remove the [000000] from the name, + and return it. */ + + basename = index (fullname, '['); + local_ptr = index (fullname, ']') + 1; + strcpy (basename, local_ptr); /* this gets rid of it */ + + } + + return 1; +} +#endif /* VMS */ diff --git a/gcc/cppinit.c b/gcc/cppinit.c new file mode 100644 index 00000000000..08bbff410b3 --- /dev/null +++ b/gcc/cppinit.c @@ -0,0 +1,1806 @@ +/* CPP Library. + Copyright (C) 1986, 87, 89, 92-98, 1999 Free Software Foundation, Inc. + Contributed by Per Bothner, 1994-95. + Based on CCCP program by Paul Rubin, June 1986 + Adapted to ANSI C, Richard Stallman, Jan 1987 + +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. */ + +#include "config.h" +#include "system.h" + +#define FAKE_CONST +#include "cpplib.h" +#include "cpphash.h" +#include "output.h" +#include "prefix.h" +#include "intl.h" + +/* XXX Should be in a header file. */ +extern char *version_string; + +/* Predefined symbols, built-in macros, and the default include path. */ + +#ifndef GET_ENV_PATH_LIST +#define GET_ENV_PATH_LIST(VAR,NAME) do { (VAR) = getenv (NAME); } while (0) +#endif + +/* By default, colon separates directories in a path. */ +#ifndef PATH_SEPARATOR +#define PATH_SEPARATOR ':' +#endif + +#ifndef STANDARD_INCLUDE_DIR +#define STANDARD_INCLUDE_DIR "/usr/include" +#endif + +/* We let tm.h override the types used here, to handle trivial differences + such as the choice of unsigned int or long unsigned int for size_t. + When machines start needing nontrivial differences in the size type, + it would be best to do something here to figure out automatically + from other information what type to use. */ + +/* The string value for __SIZE_TYPE__. */ + +#ifndef SIZE_TYPE +#define SIZE_TYPE "long unsigned int" +#endif + +/* The string value for __PTRDIFF_TYPE__. */ + +#ifndef PTRDIFF_TYPE +#define PTRDIFF_TYPE "long int" +#endif + +/* The string value for __WCHAR_TYPE__. */ + +#ifndef WCHAR_TYPE +#define WCHAR_TYPE "int" +#endif +#define CPP_WCHAR_TYPE(PFILE) \ + (CPP_OPTIONS (PFILE)->cplusplus ? "__wchar_t" : WCHAR_TYPE) + +/* The string value for __USER_LABEL_PREFIX__ */ + +#ifndef USER_LABEL_PREFIX +#define USER_LABEL_PREFIX "" +#endif + +/* The string value for __REGISTER_PREFIX__ */ + +#ifndef REGISTER_PREFIX +#define REGISTER_PREFIX "" +#endif + +/* Suffix for object files, and known input-file extensions. */ +static char *known_suffixes[] = +{ + ".c", ".C", ".s", ".S", ".m", + ".cc", ".cxx", ".cpp", ".cp", ".c++", + NULL +}; + +#ifndef OBJECT_SUFFIX +# ifdef VMS +# define OBJECT_SUFFIX ".obj" +# else +# define OBJECT_SUFFIX ".o" +# endif +#endif + + +/* This is the default list of directories to search for include files. + It may be overridden by the various -I and -ixxx options. + + #include "file" looks in the same directory as the current file, + then this list. + #include <file> just looks in this list. + + All these directories are treated as `system' include directories + (they are not subject to pedantic warnings in some cases). */ + +static struct default_include +{ + char *fname; /* The name of the directory. */ + char *component; /* The component containing the directory + (see update_path in prefix.c) */ + int cplusplus; /* Only look here if we're compiling C++. */ + int cxx_aware; /* Includes in this directory don't need to + be wrapped in extern "C" when compiling + C++. This is not used anymore. */ +} +include_defaults_array[] +#ifdef INCLUDE_DEFAULTS += INCLUDE_DEFAULTS; +#else += { + /* Pick up GNU C++ specific include files. */ + { GPLUSPLUS_INCLUDE_DIR, "G++", 1, 1 }, +#ifdef CROSS_COMPILE + /* This is the dir for fixincludes. Put it just before + the files that we fix. */ + { GCC_INCLUDE_DIR, "GCC", 0, 0 }, + /* For cross-compilation, this dir name is generated + automatically in Makefile.in. */ + { CROSS_INCLUDE_DIR, "GCC", 0, 0 }, +#ifdef TOOL_INCLUDE_DIR + /* This is another place that the target system's headers might be. */ + { TOOL_INCLUDE_DIR, "BINUTILS", 0, 1 }, +#endif +#else /* not CROSS_COMPILE */ +#ifdef LOCAL_INCLUDE_DIR + /* This should be /usr/local/include and should come before + the fixincludes-fixed header files. */ + { LOCAL_INCLUDE_DIR, 0, 0, 1 }, +#endif +#ifdef TOOL_INCLUDE_DIR + /* This is here ahead of GCC_INCLUDE_DIR because assert.h goes here. + Likewise, behind LOCAL_INCLUDE_DIR, where glibc puts its assert.h. */ + { TOOL_INCLUDE_DIR, "BINUTILS", 0, 1 }, +#endif + /* This is the dir for fixincludes. Put it just before + the files that we fix. */ + { GCC_INCLUDE_DIR, "GCC", 0, 0 }, + /* Some systems have an extra dir of include files. */ +#ifdef SYSTEM_INCLUDE_DIR + { SYSTEM_INCLUDE_DIR, 0, 0, 0 }, +#endif +#ifndef STANDARD_INCLUDE_COMPONENT +#define STANDARD_INCLUDE_COMPONENT 0 +#endif + { STANDARD_INCLUDE_DIR, STANDARD_INCLUDE_COMPONENT, 0, 0 }, +#endif /* not CROSS_COMPILE */ + { 0, 0, 0, 0 } + }; +#endif /* no INCLUDE_DEFAULTS */ + +/* Internal structures and prototypes. */ + +/* A `struct pending_option' remembers one -D, -A, -U, -include, or -imacros + switch. There are four lists: one for -D and -U, one for -A, one + for -include, one for -imacros. `undef' is set for -U, clear for + -D, ignored for the others. + (Future: add an equivalent of -U for -A) */ +struct pending_option +{ + struct pending_option *next; + char *arg; + int undef; +}; + +#ifdef __STDC__ +#define APPEND(pend, list, elt) \ + do { if (!(pend)->list##_head) (pend)->list##_head = (elt); \ + else (pend)->list##_tail->next = (elt); \ + (pend)->list##_tail = (elt); \ + } while (0) +#else +#define APPEND(pend, list, elt) \ + do { if (!(pend)->list/**/_head) (pend)->list/**/_head = (elt); \ + else (pend)->list/**/_tail->next = (elt); \ + (pend)->list/**/_tail = (elt); \ + } while (0) +#endif + +static void initialize_char_syntax PARAMS ((int)); +static void print_help PARAMS ((void)); +static void path_include PARAMS ((cpp_reader *, + struct cpp_pending *, + char *, int)); +static void initialize_builtins PARAMS ((cpp_reader *)); +static void append_include_chain PARAMS ((cpp_reader *, + struct cpp_pending *, + char *, int)); + +#ifdef CPP_PREDEFINES +static void install_predefs PARAMS ((cpp_reader *)); +#endif + +/* Last argument to append_include_chain: chain to use */ +enum { QUOTE = 0, BRACKET, SYSTEM, AFTER }; + +/* If gcc is in use (stage2/stage3) we can make these tables initialized + data. */ +#if defined __GNUC__ && __GNUC__ >= 2 +/* Table to tell if a character is legal as the second or later character + of a C identifier. */ +U_CHAR is_idchar[256] = +{ + ['a'] = 1, ['b'] = 1, ['c'] = 1, ['d'] = 1, ['e'] = 1, ['f'] = 1, + ['g'] = 1, ['h'] = 1, ['i'] = 1, ['j'] = 1, ['k'] = 1, ['l'] = 1, + ['m'] = 1, ['n'] = 1, ['o'] = 1, ['p'] = 1, ['q'] = 1, ['r'] = 1, + ['s'] = 1, ['t'] = 1, ['u'] = 1, ['v'] = 1, ['w'] = 1, ['x'] = 1, + ['y'] = 1, ['z'] = 1, + + ['A'] = 1, ['B'] = 1, ['C'] = 1, ['D'] = 1, ['E'] = 1, ['F'] = 1, + ['G'] = 1, ['H'] = 1, ['I'] = 1, ['J'] = 1, ['K'] = 1, ['L'] = 1, + ['M'] = 1, ['N'] = 1, ['O'] = 1, ['P'] = 1, ['Q'] = 1, ['R'] = 1, + ['S'] = 1, ['T'] = 1, ['U'] = 1, ['V'] = 1, ['W'] = 1, ['X'] = 1, + ['Y'] = 1, ['Z'] = 1, + + ['1'] = 1, ['2'] = 1, ['3'] = 1, ['4'] = 1, ['5'] = 1, ['6'] = 1, + ['7'] = 1, ['8'] = 1, ['9'] = 1, ['0'] = 1, + + ['_'] = 1, +}; + +/* Table to tell if a character is legal as the first character of + a C identifier. */ +U_CHAR is_idstart[256] = +{ + ['a'] = 1, ['b'] = 1, ['c'] = 1, ['d'] = 1, ['e'] = 1, ['f'] = 1, + ['g'] = 1, ['h'] = 1, ['i'] = 1, ['j'] = 1, ['k'] = 1, ['l'] = 1, + ['m'] = 1, ['n'] = 1, ['o'] = 1, ['p'] = 1, ['q'] = 1, ['r'] = 1, + ['s'] = 1, ['t'] = 1, ['u'] = 1, ['v'] = 1, ['w'] = 1, ['x'] = 1, + ['y'] = 1, ['z'] = 1, + + ['A'] = 1, ['B'] = 1, ['C'] = 1, ['D'] = 1, ['E'] = 1, ['F'] = 1, + ['G'] = 1, ['H'] = 1, ['I'] = 1, ['J'] = 1, ['K'] = 1, ['L'] = 1, + ['M'] = 1, ['N'] = 1, ['O'] = 1, ['P'] = 1, ['Q'] = 1, ['R'] = 1, + ['S'] = 1, ['T'] = 1, ['U'] = 1, ['V'] = 1, ['W'] = 1, ['X'] = 1, + ['Y'] = 1, ['Z'] = 1, + + ['_'] = 1, +}; + +/* Table to tell if a character is horizontal space. + \r is magical, so it is not in here. */ +U_CHAR is_hor_space[256] = +{ + [' '] = 1, ['\t'] = 1, ['\v'] = 1, ['\f'] = 1, +}; +/* table to tell if a character is horizontal or vertical space. */ +U_CHAR is_space[256] = +{ + [' '] = 1, ['\t'] = 1, ['\v'] = 1, ['\f'] = 1, ['\n'] = 1, +}; +/* Table to handle trigraph conversion, which occurs before all other + processing, everywhere in the file. (This is necessary since one + of the trigraphs encodes backslash.) Note it's off by default. + + from to from to from to + ?? = # ?? ) ] ?? ! | + ?? ( [ ?? ' ^ ?? > } + ?? / \ ?? < { ?? - ~ + + There is not a space between the ?? and the third char. I put spaces + there to avoid warnings when compiling this file. */ +U_CHAR trigraph_table[256] = +{ + ['='] = '#', [')'] = ']', ['!'] = '|', + ['('] = '[', ['\''] = '^', ['>'] = '}', + ['/'] = '\\', ['<'] = '{', ['-'] = '~', +}; + +/* This function will be entirely removed soon. */ +static inline void +initialize_char_syntax (dollar_in_ident) + int dollar_in_ident; +{ + is_idchar['$'] = dollar_in_ident; + is_idstart['$'] = dollar_in_ident; +} + +#else /* Not GCC. */ + +U_CHAR is_idchar[256] = { 0 }; +U_CHAR is_idstart[256] = { 0 }; +U_CHAR is_hor_space[256] = { 0 }; +U_CHAR is_space[256] = { 0 }; +U_CHAR trigraph_table[256] = { 0 }; + +/* Initialize syntactic classifications of characters. */ +static void +initialize_char_syntax (dollar_in_ident) + int dollar_in_ident; +{ + is_idstart['a'] = 1; is_idstart['b'] = 1; is_idstart['c'] = 1; + is_idstart['d'] = 1; is_idstart['e'] = 1; is_idstart['f'] = 1; + is_idstart['g'] = 1; is_idstart['h'] = 1; is_idstart['i'] = 1; + is_idstart['j'] = 1; is_idstart['k'] = 1; is_idstart['l'] = 1; + is_idstart['m'] = 1; is_idstart['n'] = 1; is_idstart['o'] = 1; + is_idstart['p'] = 1; is_idstart['q'] = 1; is_idstart['r'] = 1; + is_idstart['s'] = 1; is_idstart['t'] = 1; is_idstart['u'] = 1; + is_idstart['v'] = 1; is_idstart['w'] = 1; is_idstart['x'] = 1; + is_idstart['y'] = 1; is_idstart['z'] = 1; + + is_idstart['A'] = 1; is_idstart['B'] = 1; is_idstart['C'] = 1; + is_idstart['D'] = 1; is_idstart['E'] = 1; is_idstart['F'] = 1; + is_idstart['G'] = 1; is_idstart['H'] = 1; is_idstart['I'] = 1; + is_idstart['J'] = 1; is_idstart['K'] = 1; is_idstart['L'] = 1; + is_idstart['M'] = 1; is_idstart['N'] = 1; is_idstart['O'] = 1; + is_idstart['P'] = 1; is_idstart['Q'] = 1; is_idstart['R'] = 1; + is_idstart['S'] = 1; is_idstart['T'] = 1; is_idstart['U'] = 1; + is_idstart['V'] = 1; is_idstart['W'] = 1; is_idstart['X'] = 1; + is_idstart['Y'] = 1; is_idstart['Z'] = 1; + + is_idstart['_'] = 1; + + is_idchar['a'] = 1; is_idchar['b'] = 1; is_idchar['c'] = 1; + is_idchar['d'] = 1; is_idchar['e'] = 1; is_idchar['f'] = 1; + is_idchar['g'] = 1; is_idchar['h'] = 1; is_idchar['i'] = 1; + is_idchar['j'] = 1; is_idchar['k'] = 1; is_idchar['l'] = 1; + is_idchar['m'] = 1; is_idchar['n'] = 1; is_idchar['o'] = 1; + is_idchar['p'] = 1; is_idchar['q'] = 1; is_idchar['r'] = 1; + is_idchar['s'] = 1; is_idchar['t'] = 1; is_idchar['u'] = 1; + is_idchar['v'] = 1; is_idchar['w'] = 1; is_idchar['x'] = 1; + is_idchar['y'] = 1; is_idchar['z'] = 1; + + is_idchar['A'] = 1; is_idchar['B'] = 1; is_idchar['C'] = 1; + is_idchar['D'] = 1; is_idchar['E'] = 1; is_idchar['F'] = 1; + is_idchar['G'] = 1; is_idchar['H'] = 1; is_idchar['I'] = 1; + is_idchar['J'] = 1; is_idchar['K'] = 1; is_idchar['L'] = 1; + is_idchar['M'] = 1; is_idchar['N'] = 1; is_idchar['O'] = 1; + is_idchar['P'] = 1; is_idchar['Q'] = 1; is_idchar['R'] = 1; + is_idchar['S'] = 1; is_idchar['T'] = 1; is_idchar['U'] = 1; + is_idchar['V'] = 1; is_idchar['W'] = 1; is_idchar['X'] = 1; + is_idchar['Y'] = 1; is_idchar['Z'] = 1; + + is_idchar['1'] = 1; is_idchar['2'] = 1; is_idchar['3'] = 1; + is_idchar['4'] = 1; is_idchar['5'] = 1; is_idchar['6'] = 1; + is_idchar['7'] = 1; is_idchar['8'] = 1; is_idchar['9'] = 1; + is_idchar['0'] = 1; + + is_idchar['_'] = 1; + + is_idchar['$'] = dollar_in_ident; + is_idstart['$'] = dollar_in_ident; + + /* white space tables */ + is_hor_space[' '] = 1; + is_hor_space['\t'] = 1; + is_hor_space['\v'] = 1; + is_hor_space['\f'] = 1; + + is_space[' '] = 1; + is_space['\t'] = 1; + is_space['\v'] = 1; + is_space['\f'] = 1; + is_space['\n'] = 1; + + /* trigraph conversion */ + trigraph_table['='] = '#'; trigraph_table[')'] = ']'; + trigraph_table['!'] = '|'; trigraph_table['('] = '['; + trigraph_table['\''] = '^'; trigraph_table['>'] = '}'; + trigraph_table['/'] = '\\'; trigraph_table['<'] = '{'; + trigraph_table['-'] = '~'; +} + +#endif /* Not GCC. */ + +/* Given a colon-separated list of file names PATH, + add all the names to the search path for include files. */ + +static void +path_include (pfile, pend, list, path) + cpp_reader *pfile; + struct cpp_pending *pend; + char *list; + int path; +{ + char *p, *q, *name; + + p = list; + + do + { + /* Find the end of this name. */ + q = p; + while (*q != 0 && *q != PATH_SEPARATOR) q++; + if (q == p) + { + /* An empty name in the path stands for the current directory. */ + name = (char *) xmalloc (2); + name[0] = '.'; + name[1] = 0; + } + else + { + /* Otherwise use the directory that is named. */ + name = (char *) xmalloc (q - p + 1); + memcpy (name, p, q - p); + name[q - p] = 0; + } + + append_include_chain (pfile, pend, name, path); + + /* Advance past this name. */ + if (*q == 0) + break; + p = q + 1; + } + while (1); +} + +/* Find the base name of a (partial) pathname FNAME. + Returns a pointer into the string passed in. + Accepts Unix (/-separated) paths on all systems, + DOS and VMS paths on those systems. */ +static char * +base_name (fname) + const char *fname; +{ + char *s = (char *)fname; + char *p; +#if defined (__MSDOS__) || defined (_WIN32) + if (ISALPHA (s[0]) && s[1] == ':') s += 2; + if ((p = rindex (s, '\\'))) s = p + 1; +#elif defined VMS + if ((p = rindex (s, ':'))) s = p + 1; /* Skip device. */ + if ((p = rindex (s, ']'))) s = p + 1; /* Skip directory. */ + if ((p = rindex (s, '>'))) s = p + 1; /* Skip alternate (int'n'l) dir. */ +#endif + if ((p = rindex (s, '/'))) s = p + 1; + return s; +} + + +/* Append DIR to include path PATH. DIR must be permanently allocated + and writable. */ +static void +append_include_chain (pfile, pend, dir, path) + cpp_reader *pfile; + struct cpp_pending *pend; + char *dir; + int path; +{ + struct file_name_list *new; + struct stat st; + unsigned int len; + + simplify_pathname (dir); + if (stat (dir, &st)) + { + /* Dirs that don't exist are silently ignored. */ + if (errno != ENOENT) + cpp_perror_with_name (pfile, dir); + else if (CPP_OPTIONS (pfile)->verbose) + cpp_notice ("ignoring nonexistent directory `%s'\n", dir); + return; + } + + if (!S_ISDIR (st.st_mode)) + { + cpp_message (pfile, 1, "%s: %s: Not a directory", progname, dir); + return; + } + + len = strlen (dir); + if (len > pfile->max_include_len) + pfile->max_include_len = len; + + new = (struct file_name_list *)xmalloc (sizeof (struct file_name_list)); + new->name = dir; + new->nlen = len; + new->ino = st.st_ino; + new->dev = st.st_dev; + new->sysp = (path == SYSTEM); + new->name_map = NULL; + + switch (path) + { + case QUOTE: APPEND (pend, quote, new); break; + case BRACKET: APPEND (pend, brack, new); break; + case SYSTEM: APPEND (pend, systm, new); break; + case AFTER: APPEND (pend, after, new); break; + } +} + + +/* Write out a #define command for the special named MACRO_NAME + to PFILE's token_buffer. */ + +static void +dump_special_to_buffer (pfile, macro_name) + cpp_reader *pfile; + char *macro_name; +{ + static char define_directive[] = "#define "; + int macro_name_length = strlen (macro_name); + output_line_command (pfile, 0, same_file); + CPP_RESERVE (pfile, sizeof(define_directive) + macro_name_length); + CPP_PUTS_Q (pfile, define_directive, sizeof(define_directive)-1); + CPP_PUTS_Q (pfile, macro_name, macro_name_length); + CPP_PUTC_Q (pfile, ' '); + cpp_expand_to_buffer (pfile, macro_name, macro_name_length); + CPP_PUTC (pfile, '\n'); +} + +/* Initialize a cpp_options structure. */ +void +cpp_options_init (opts) + cpp_options *opts; +{ + bzero ((char *) opts, sizeof (struct cpp_options)); + + opts->dollars_in_ident = 1; + opts->cplusplus_comments = 1; + opts->warn_import = 1; + + opts->pending = (struct cpp_pending *) xmalloc (sizeof (struct cpp_pending)); + bzero ((char *) opts->pending, sizeof (struct cpp_pending)); +} + +/* Initialize a cpp_reader structure. */ +void +cpp_reader_init (pfile) + cpp_reader *pfile; +{ + bzero ((char *) pfile, sizeof (cpp_reader)); +#if 0 + pfile->get_token = cpp_get_token; +#endif + + pfile->token_buffer_size = 200; + pfile->token_buffer = (U_CHAR *) xmalloc (pfile->token_buffer_size); + CPP_SET_WRITTEN (pfile, 0); + + pfile->hashtab = (HASHNODE **) xcalloc (HASHSIZE, sizeof (HASHNODE *)); +} + +/* Free resources used by PFILE. + This is the cpp_reader 'finalizer' or 'destructor' (in C++ terminology). */ +void +cpp_cleanup (pfile) + cpp_reader *pfile; +{ + int i; + while (CPP_BUFFER (pfile) != CPP_NULL_BUFFER (pfile)) + cpp_pop_buffer (pfile); + + if (pfile->token_buffer) + { + free (pfile->token_buffer); + pfile->token_buffer = NULL; + } + + if (pfile->deps_buffer) + { + free (pfile->deps_buffer); + pfile->deps_buffer = NULL; + pfile->deps_allocated_size = 0; + } + + while (pfile->if_stack) + { + IF_STACK_FRAME *temp = pfile->if_stack; + pfile->if_stack = temp->next; + free (temp); + } + + for (i = ALL_INCLUDE_HASHSIZE; --i >= 0; ) + { + struct include_hash *imp = pfile->all_include_files[i]; + while (imp) + { + struct include_hash *next = imp->next; +#if 0 + /* This gets freed elsewhere - I think. */ + free (imp->name); +#endif + free (imp); + imp = next; + } + pfile->all_include_files[i] = 0; + } + + for (i = HASHSIZE; --i >= 0;) + { + while (pfile->hashtab[i]) + delete_macro (pfile->hashtab[i]); + } + free (pfile->hashtab); +} + + +/* Initialize the built-in macros. */ +static void +initialize_builtins (pfile) + cpp_reader *pfile; +{ +#define NAME(str) (U_CHAR *)str, sizeof str - 1 + cpp_install (pfile, NAME("__TIME__"), T_TIME, 0, -1); + cpp_install (pfile, NAME("__DATE__"), T_DATE, 0, -1); + cpp_install (pfile, NAME("__FILE__"), T_FILE, 0, -1); + cpp_install (pfile, NAME("__BASE_FILE__"), T_BASE_FILE, 0, -1); + cpp_install (pfile, NAME("__LINE__"), T_SPECLINE, 0, -1); + cpp_install (pfile, NAME("__INCLUDE_LEVEL__"), T_INCLUDE_LEVEL, 0, -1); + cpp_install (pfile, NAME("__VERSION__"), T_VERSION, 0, -1); +#ifndef NO_BUILTIN_SIZE_TYPE + cpp_install (pfile, NAME("__SIZE_TYPE__"), T_CONST, SIZE_TYPE, -1); +#endif +#ifndef NO_BUILTIN_PTRDIFF_TYPE + cpp_install (pfile, NAME("__PTRDIFF_TYPE__ "), T_CONST, PTRDIFF_TYPE, -1); +#endif + cpp_install (pfile, NAME("__WCHAR_TYPE__"), T_CONST, WCHAR_TYPE, -1); + cpp_install (pfile, NAME("__USER_LABEL_PREFIX__"), T_CONST, user_label_prefix, -1); + cpp_install (pfile, NAME("__REGISTER_PREFIX__"), T_CONST, REGISTER_PREFIX, -1); + if (!CPP_TRADITIONAL (pfile)) + { + cpp_install (pfile, NAME("__STDC__"), T_STDC, 0, -1); +#if 0 + if (CPP_OPTIONS (pfile)->c9x) + cpp_install (pfile, NAME("__STDC_VERSION__"),T_CONST, "199909L", -1); + else +#endif + cpp_install (pfile, NAME("__STDC_VERSION__"),T_CONST, "199409L", -1); + } +#undef NAME + + if (CPP_OPTIONS (pfile)->debug_output) + { + dump_special_to_buffer (pfile, "__BASE_FILE__"); + dump_special_to_buffer (pfile, "__VERSION__"); +#ifndef NO_BUILTIN_SIZE_TYPE + dump_special_to_buffer (pfile, "__SIZE_TYPE__"); +#endif +#ifndef NO_BUILTIN_PTRDIFF_TYPE + dump_special_to_buffer (pfile, "__PTRDIFF_TYPE__"); +#endif + dump_special_to_buffer (pfile, "__WCHAR_TYPE__"); + dump_special_to_buffer (pfile, "__DATE__"); + dump_special_to_buffer (pfile, "__TIME__"); + if (!CPP_TRADITIONAL (pfile)) + dump_special_to_buffer (pfile, "__STDC__"); + } +} + +/* Subroutine of cpp_start_read. Installs the predefined macros + and assertions found in CPP_PREDEFINES. + + CPP_PREDEFINES is a string of -D and -A options separated by + whitespace, like this: + "-D__unix__ -D__sparc__ -Asystem(unix) -Amachine(sparc)" */ +#ifdef CPP_PREDEFINES +static void +install_predefs (pfile) + cpp_reader *pfile; +{ + char *p = (char *) alloca (strlen (CPP_PREDEFINES) + 1); + char *q; + strcpy (p, CPP_PREDEFINES); + + while (*p) + { + while (*p == ' ' || *p == '\t') p++; + if (*p != '-') + abort(); + p = q = p + 2; + + while (*p && *p != ' ' && *p != '\t') p++; + if (*p != 0) + *p++= 0; + if (CPP_OPTIONS (pfile)->debug_output) + output_line_command (pfile, 0, same_file); + + if (q[-1] == 'D') + cpp_define (pfile, q); + else if (q[-1] == 'A') + cpp_assert (pfile, q); + else + abort (); + } +} +#endif + +/* Another subroutine of cpp_start_read. This one sets up to do + dependency-file output. */ +static void +initialize_dependency_output (pfile) + cpp_reader *pfile; +{ + cpp_options *opts = CPP_OPTIONS (pfile); + char *spec, *s, *output_file; + + /* Either of two environment variables can specify output of deps. + Its value is either "OUTPUT_FILE" or "OUTPUT_FILE DEPS_TARGET", + where OUTPUT_FILE is the file to write deps info to + and DEPS_TARGET is the target to mention in the deps. */ + + if (opts->print_deps == 0) + { + spec = getenv ("DEPENDENCIES_OUTPUT"); + if (spec) + opts->print_deps = 1; + else + { + spec = getenv ("SUNPRO_DEPENDENCIES"); + if (spec) + opts->print_deps = 2; + else + return; + } + + /* Find the space before the DEPS_TARGET, if there is one. */ + s = strchr (spec, ' '); + if (s) + { + opts->deps_target = s + 1; + output_file = (char *) xmalloc (s - spec + 1); + memcpy (output_file, spec, s - spec); + output_file[s - spec] = 0; + } + else + { + opts->deps_target = 0; + output_file = spec; + } + + opts->deps_file = output_file; + opts->print_deps_append = 1; + } + + /* Print the expected object file name as the target of this Make-rule. */ + pfile->deps_allocated_size = 200; + pfile->deps_buffer = (char *) xmalloc (pfile->deps_allocated_size); + pfile->deps_buffer[0] = 0; + pfile->deps_size = 0; + pfile->deps_column = 0; + + if (opts->deps_target) + deps_output (pfile, opts->deps_target, ':'); + else if (*opts->in_fname == 0) + deps_output (pfile, "-", ':'); + else + { + char *p, *q, *r; + int len, x; + + /* Discard all directory prefixes from filename. */ + q = base_name (opts->in_fname); + + /* Copy remainder to mungable area. */ + len = strlen (q); + p = (char *) alloca (len + 8); + strcpy (p, q); + + /* Output P, but remove known suffixes. */ + q = p + len; + /* Point to the filename suffix. */ + r = rindex (p, '.'); + /* Compare against the known suffixes. */ + for (x = 0; known_suffixes[x]; x++) + { + if (strncmp (known_suffixes[x], r, q - r) == 0) + { + /* Make q point to the bit we're going to overwrite + with an object suffix. */ + q = r; + break; + } + } + + /* Supply our own suffix. */ + strcpy (q, OBJECT_SUFFIX); + + deps_output (pfile, p, ':'); + deps_output (pfile, opts->in_fname, ' '); + } +} + +/* This is called after options have been processed. + * Check options for consistency, and setup for processing input + * from the file named FNAME. (Use standard input if FNAME==NULL.) + * Return 1 on success, 0 on failure. + */ + +int +cpp_start_read (pfile, fname) + cpp_reader *pfile; + char *fname; +{ + struct cpp_options *opts = CPP_OPTIONS (pfile); + struct pending_option *p, *q; + int f; + cpp_buffer *fp; + struct include_hash *ih_fake; + + /* -MG doesn't select the form of output and must be specified with one of + -M or -MM. -MG doesn't make sense with -MD or -MMD since they don't + inhibit compilation. */ + if (opts->print_deps_missing_files + && (opts->print_deps == 0 || !opts->no_output)) + { + cpp_fatal (pfile, "-MG must be specified with one of -M or -MM"); + return 0; + } + + /* Chill should not be used with -trigraphs. */ + if (opts->chill && opts->trigraphs) + { + cpp_warning (pfile, "-lang-chill and -trigraphs are mutually exclusive"); + opts->trigraphs = 0; + } + + /* Set this if it hasn't been set already. */ + if (user_label_prefix == NULL) + user_label_prefix = USER_LABEL_PREFIX; + + /* Now that we know dollars_in_ident, we can initialize the syntax + tables. */ + initialize_char_syntax (opts->dollars_in_ident); + + /* Do partial setup of input buffer for the sake of generating + early #line directives (when -g is in effect). */ + fp = cpp_push_buffer (pfile, NULL, 0); + if (!fp) + return 0; + if (opts->in_fname == NULL || *opts->in_fname == 0) + { + opts->in_fname = fname; + if (opts->in_fname == NULL) + opts->in_fname = ""; + } + fp->nominal_fname = fp->fname = opts->in_fname; + fp->lineno = 0; + + /* Install __LINE__, etc. Must follow initialize_char_syntax + and option processing. */ + initialize_builtins (pfile); + +#ifdef CPP_PREDEFINES + /* Do standard #defines and assertions + that identify system and machine type. */ + if (!opts->inhibit_predefs) + install_predefs (pfile); +#endif + + /* Do -U's, -D's and -A's in the order they were seen. */ + p = opts->pending->define_head; + while (p) + { + if (opts->debug_output) + output_line_command (pfile, 0, same_file); + if (p->undef) + cpp_undef (pfile, p->arg); + else + cpp_define (pfile, p->arg); + + q = p->next; + free (p); + p = q; + } + + p = opts->pending->assert_head; + while (p) + { + if (opts->debug_output) + output_line_command (pfile, 0, same_file); + if (p->undef) + cpp_unassert (pfile, p->arg); + else + cpp_assert (pfile, p->arg); + + q = p->next; + free (p); + p = q; + } + + opts->done_initializing = 1; + + /* Several environment variables may add to the include search path. + CPATH specifies an additional list of directories to be searched + as if specified with -I, while C_INCLUDE_PATH, CPLUS_INCLUDE_PATH, + etc. specify an additional list of directories to be searched as + if specified with -isystem, for the language indicated. + + These variables are ignored if -nostdinc is on. */ + if (! opts->no_standard_includes) + { + char *path; + GET_ENV_PATH_LIST (path, "CPATH"); + if (path != 0 && *path != 0) + path_include (pfile, opts->pending, path, BRACKET); + + switch ((opts->objc << 1) + opts->cplusplus) + { + case 0: + GET_ENV_PATH_LIST (path, "C_INCLUDE_PATH"); + break; + case 1: + GET_ENV_PATH_LIST (path, "CPLUS_INCLUDE_PATH"); + break; + case 2: + GET_ENV_PATH_LIST (path, "OBJC_INCLUDE_PATH"); + break; + case 3: + GET_ENV_PATH_LIST (path, "OBJCPLUS_INCLUDE_PATH"); + break; + } + if (path != 0 && *path != 0) + path_include (pfile, opts->pending, path, SYSTEM); + } + + /* Unless -nostdinc, add the compiled-in include path to the list, + translating prefixes. */ + if (!opts->no_standard_includes) + { + struct default_include *p = include_defaults_array; + char *specd_prefix = opts->include_prefix; + char *default_prefix = alloca (sizeof GCC_INCLUDE_DIR - 7); + int default_len; + int specd_len; + + /* Search "translated" versions of GNU directories. + These have /usr/local/lib/gcc... replaced by specd_prefix. */ + if (specd_prefix != 0) + { + /* Remove the `include' from /usr/local/lib/gcc.../include. + GCC_INCLUDE_DIR will always end in /include. */ + default_len = sizeof GCC_INCLUDE_DIR - 8; + memcpy (default_prefix, GCC_INCLUDE_DIR, default_len); + default_prefix[default_len] = '\0'; + + + specd_len = strlen (specd_prefix); + for (p = include_defaults_array; p->fname; p++) + { + /* Some standard dirs are only for C++. */ + if (!p->cplusplus + || (opts->cplusplus + && !opts->no_standard_cplusplus_includes)) + { + /* Does this dir start with the prefix? */ + if (!strncmp (p->fname, default_prefix, default_len)) + { + /* Yes; change prefix and add to search list. */ + int flen = strlen (p->fname); + int this_len = specd_len - default_len + flen; + char *str = (char *) xmalloc (this_len + 1); + memcpy (str, specd_prefix, specd_len); + memcpy (str+specd_len, p->fname, flen + 1); + + append_include_chain (pfile, opts->pending, + str, SYSTEM); + } + } + } + } + + /* Search ordinary names for GNU include directories. */ + for (p = include_defaults_array; p->fname; p++) + { + /* Some standard dirs are only for C++. */ + if (!p->cplusplus + || (opts->cplusplus + && !opts->no_standard_cplusplus_includes)) + { + char *str = (char *) update_path (p->fname, p->component); + str = xstrdup (str); /* XXX Potential memory leak! */ + append_include_chain (pfile, opts->pending, str, SYSTEM); + } + } + } + + merge_include_chains (opts); + + /* With -v, print the list of dirs to search. */ + if (opts->verbose) + { + struct file_name_list *p; + cpp_message (pfile, -1, "#include \"...\" search starts here:\n"); + for (p = opts->quote_include; p; p = p->next) + { + if (p == opts->bracket_include) + cpp_message (pfile, -1, "#include <...> search starts here:\n"); + fprintf (stderr, " %s\n", p->name); + } + cpp_message (pfile, -1, "End of search list.\n"); + } + + /* Open the main input file. + We do this in nonblocking mode so we don't get stuck here if + someone clever has asked cpp to process /dev/rmt0; + finclude() will check that we have a real file to work with. */ + if (fname == NULL || *fname == 0) + { + fname = ""; + f = 0; + } + else if ((f = open (fname, O_RDONLY|O_NONBLOCK|O_NOCTTY, 0666)) < 0) + cpp_pfatal_with_name (pfile, fname); + + initialize_dependency_output (pfile); + + /* Must call finclude() on the main input before processing + -include switches; otherwise the -included text winds up + after the main input. */ + ih_fake = (struct include_hash *) xmalloc (sizeof (struct include_hash)); + ih_fake->next = 0; + ih_fake->next_this_file = 0; + ih_fake->foundhere = ABSOLUTE_PATH; /* well sort of ... */ + ih_fake->name = fname; + ih_fake->control_macro = 0; + ih_fake->buf = (char *)-1; + ih_fake->limit = 0; + if (!finclude (pfile, f, ih_fake)) + return 0; + output_line_command (pfile, 0, same_file); + pfile->only_seen_white = 2; + + /* The -imacros files can be scanned now, but the -include files + have to be pushed onto the include stack and processed later, + in the main loop calling cpp_get_token. */ + + pfile->no_record_file++; + opts->no_output++; + p = opts->pending->imacros_head; + while (p) + { + int fd = open (p->arg, O_RDONLY|O_NONBLOCK|O_NOCTTY, 0666); + if (fd < 0) + { + cpp_perror_with_name (pfile, p->arg); + return 0; + } + if (!cpp_push_buffer (pfile, NULL, 0)) + return 0; + + ih_fake = (struct include_hash *) + xmalloc (sizeof (struct include_hash)); + ih_fake->next = 0; + ih_fake->next_this_file = 0; + ih_fake->foundhere = ABSOLUTE_PATH; /* well sort of ... */ + ih_fake->name = p->arg; + ih_fake->control_macro = 0; + ih_fake->buf = (char *)-1; + ih_fake->limit = 0; + if (!finclude (pfile, fd, ih_fake)) + cpp_scan_buffer (pfile); + free (ih_fake); + + q = p->next; + free (p); + p = q; + } + + opts->no_output--; + + p = opts->pending->include_head; + while (p) + { + int fd = open (p->arg, O_RDONLY|O_NONBLOCK|O_NOCTTY, 0666); + if (fd < 0) + { + cpp_perror_with_name (pfile, p->arg); + return 0; + } + if (!cpp_push_buffer (pfile, NULL, 0)) + return 0; + + ih_fake = (struct include_hash *) + xmalloc (sizeof (struct include_hash)); + ih_fake->next = 0; + ih_fake->next_this_file = 0; + ih_fake->foundhere = ABSOLUTE_PATH; /* well sort of ... */ + ih_fake->name = p->arg; + ih_fake->control_macro = 0; + ih_fake->buf = (char *)-1; + ih_fake->limit = 0; + if (finclude (pfile, fd, ih_fake)) + output_line_command (pfile, 0, enter_file); + + q = p->next; + free (p); + p = q; + } + pfile->no_record_file--; + + free (opts->pending); + opts->pending = NULL; + + return 1; +} + +/* This is called at the end of preprocessing. It pops the + last buffer and writes dependency output. It should also + clear macro definitions, such that you could call cpp_start_read + with a new filename to restart processing. */ +void +cpp_finish (pfile) + cpp_reader *pfile; +{ + struct cpp_options *opts = CPP_OPTIONS (pfile); + + if (CPP_PREV_BUFFER (CPP_BUFFER (pfile)) != CPP_NULL_BUFFER (pfile)) + cpp_fatal (pfile, + "cpplib internal error: buffers still stacked in cpp_finish"); + cpp_pop_buffer (pfile); + + if (opts->print_deps) + { + /* Stream on which to print the dependency information. */ + FILE *deps_stream; + + /* Don't actually write the deps file if compilation has failed. */ + if (pfile->errors == 0) + { + char *deps_mode = opts->print_deps_append ? "a" : "w"; + if (opts->deps_file == 0) + deps_stream = stdout; + else if ((deps_stream = fopen (opts->deps_file, deps_mode)) == 0) + cpp_pfatal_with_name (pfile, opts->deps_file); + fputs (pfile->deps_buffer, deps_stream); + putc ('\n', deps_stream); + if (opts->deps_file) + { + if (ferror (deps_stream) || fclose (deps_stream) != 0) + cpp_fatal (pfile, "I/O error on output"); + } + } + } +} + +/* Handle one command-line option in (argc, argv). + Can be called multiple times, to handle multiple sets of options. + Returns number of strings consumed. */ +int +cpp_handle_option (pfile, argc, argv) + cpp_reader *pfile; + int argc; + char **argv; +{ + struct cpp_options *opts = CPP_OPTIONS (pfile); + int i = 0; + + if (argv[i][0] != '-') + { + if (opts->out_fname != NULL) + { + print_help (); + cpp_fatal (pfile, "Too many arguments"); + } + else if (opts->in_fname != NULL) + opts->out_fname = argv[i]; + else + opts->in_fname = argv[i]; + } + else + switch (argv[i][1]) + { + case 'f': + if (!strcmp (argv[i], "-fleading-underscore")) + user_label_prefix = "_"; + else if (!strcmp (argv[i], "-fno-leading-underscore")) + user_label_prefix = ""; + break; + + case 'I': /* Add directory to path for includes. */ + if (!strcmp (argv[i] + 2, "-")) + { + /* -I- means: + Use the preceding -I directories for #include "..." + but not #include <...>. + Don't search the directory of the present file + for #include "...". (Note that -I. -I- is not the same as + the default setup; -I. uses the compiler's working dir.) */ + if (! opts->ignore_srcdir) + { + opts->ignore_srcdir = 1; + opts->pending->quote_head = opts->pending->brack_head; + opts->pending->quote_tail = opts->pending->brack_tail; + opts->pending->brack_head = 0; + opts->pending->brack_tail = 0; + } + else + { + cpp_fatal (pfile, "-I- specified twice"); + return argc; + } + } + else + { + char *fname; + if (argv[i][2] != 0) + fname = argv[i] + 2; + else if (i + 1 == argc) + goto missing_dirname; + else + fname = argv[++i]; + append_include_chain (pfile, opts->pending, + xstrdup (fname), BRACKET); + } + break; + + case 'i': + /* Add directory to beginning of system include path, as a system + include directory. */ + if (!strcmp (argv[i], "-isystem")) + { + if (i + 1 == argc) + goto missing_filename; + append_include_chain (pfile, opts->pending, + xstrdup (argv[++i]), SYSTEM); + } + else if (!strcmp (argv[i], "-include")) + { + if (i + 1 == argc) + goto missing_filename; + else + { + struct pending_option *o = (struct pending_option *) + xmalloc (sizeof (struct pending_option)); + o->arg = argv[++i]; + + /* This list has to be built in reverse order so that + when cpp_start_read pushes all the -include files onto + the buffer stack, they will be scanned in forward order. */ + o->next = opts->pending->include_head; + opts->pending->include_head = o; + } + } + else if (!strcmp (argv[i], "-imacros")) + { + if (i + 1 == argc) + goto missing_filename; + else + { + struct pending_option *o = (struct pending_option *) + xmalloc (sizeof (struct pending_option)); + o->arg = argv[++i]; + o->next = NULL; + + APPEND (opts->pending, imacros, o); + } + } + /* Add directory to end of path for includes, + with the default prefix at the front of its name. */ + else if (!strcmp (argv[i], "-iwithprefix")) + { + char *fname; + int len; + if (i + 1 == argc) + goto missing_dirname; + ++i; + len = strlen (argv[i]); + + if (opts->include_prefix != 0) + { + fname = xmalloc (opts->include_prefix_len + len + 1); + memcpy (fname, opts->include_prefix, opts->include_prefix_len); + memcpy (fname + opts->include_prefix_len, argv[i], len + 1); + } + else + { + fname = xmalloc (sizeof GCC_INCLUDE_DIR - 8 + len); + memcpy (fname, GCC_INCLUDE_DIR, sizeof GCC_INCLUDE_DIR - 9); + memcpy (fname + sizeof GCC_INCLUDE_DIR - 9, argv[i], len + 1); + } + + append_include_chain (pfile, opts->pending, fname, SYSTEM); + } + /* Add directory to main path for includes, + with the default prefix at the front of its name. */ + else if (!strcmp (argv[i], "-iwithprefixbefore")) + { + char *fname; + int len; + if (i + 1 == argc) + goto missing_dirname; + ++i; + len = strlen (argv[i]); + + if (opts->include_prefix != 0) + { + fname = xmalloc (opts->include_prefix_len + len + 1); + memcpy (fname, opts->include_prefix, opts->include_prefix_len); + memcpy (fname + opts->include_prefix_len, argv[i], len + 1); + } + else + { + fname = xmalloc (sizeof GCC_INCLUDE_DIR - 8 + len); + memcpy (fname, GCC_INCLUDE_DIR, sizeof GCC_INCLUDE_DIR - 9); + memcpy (fname + sizeof GCC_INCLUDE_DIR - 9, argv[i], len + 1); + } + + append_include_chain (pfile, opts->pending, fname, BRACKET); + } + /* Add directory to end of path for includes. */ + else if (!strcmp (argv[i], "-idirafter")) + { + if (i + 1 == argc) + goto missing_dirname; + append_include_chain (pfile, opts->pending, + xstrdup (argv[++i]), AFTER); + } + else if (!strcmp (argv[i], "-iprefix")) + { + if (i + 1 == argc) + goto missing_filename; + else + { + opts->include_prefix = argv[++i]; + opts->include_prefix_len = strlen (argv[i]); + } + } + else if (!strcmp (argv[i], "-ifoutput")) + opts->output_conditionals = 1; + + break; + + case 'o': + if (opts->out_fname != NULL) + { + cpp_fatal (pfile, "Output filename specified twice"); + return argc; + } + if (i + 1 == argc) + goto missing_filename; + opts->out_fname = argv[++i]; + if (!strcmp (opts->out_fname, "-")) + opts->out_fname = ""; + break; + + case 'p': + if (!strcmp (argv[i], "-pedantic")) + CPP_PEDANTIC (pfile) = 1; + else if (!strcmp (argv[i], "-pedantic-errors")) + { + CPP_PEDANTIC (pfile) = 1; + opts->pedantic_errors = 1; + } +#if 0 + else if (!strcmp (argv[i], "-pcp")) { + char *pcp_fname = argv[++i]; + pcp_outfile = ((pcp_fname[0] != '-' || pcp_fname[1] != '\0') + ? fopen (pcp_fname, "w") + : fdopen (dup (fileno (stdout)), "w")); + if (pcp_outfile == 0) + cpp_pfatal_with_name (pfile, pcp_fname); + no_precomp = 1; + } +#endif + break; + + case 't': + if (!strcmp (argv[i], "-traditional")) + { + opts->traditional = 1; + opts->cplusplus_comments = 0; + } + else if (!strcmp (argv[i], "-trigraphs")) + opts->trigraphs = 1; + break; + + case 'l': + if (! strcmp (argv[i], "-lang-c")) + opts->cplusplus = 0, opts->cplusplus_comments = 1, opts->c89 = 0, + opts->c9x = 1, opts->objc = 0; + if (! strcmp (argv[i], "-lang-c89")) + opts->cplusplus = 0, opts->cplusplus_comments = 0, opts->c89 = 1, + opts->c9x = 0, opts->objc = 0; + if (! strcmp (argv[i], "-lang-c++")) + opts->cplusplus = 1, opts->cplusplus_comments = 1, opts->c89 = 0, + opts->c9x = 0, opts->objc = 0; + if (! strcmp (argv[i], "-lang-objc")) + opts->cplusplus = 0, opts->cplusplus_comments = 1, opts->c89 = 0, + opts->c9x = 0, opts->objc = 1; + if (! strcmp (argv[i], "-lang-objc++")) + opts->cplusplus = 1, opts->cplusplus_comments = 1, opts->c89 = 0, + opts->c9x = 0, opts->objc = 1; + if (! strcmp (argv[i], "-lang-asm")) + opts->lang_asm = 1; + if (! strcmp (argv[i], "-lint")) + opts->for_lint = 1; + if (! strcmp (argv[i], "-lang-chill")) + opts->objc = 0, opts->cplusplus = 0, opts->chill = 1, + opts->traditional = 1; + break; + + case '+': + opts->cplusplus = 1, opts->cplusplus_comments = 1; + break; + + case 's': + if (!strcmp (argv[i], "-std=iso9899:1990") + || !strcmp (argv[i], "-std=iso9899:199409") + || !strcmp (argv[i], "-std=c89") + || !strcmp (argv[i], "-std=gnu89")) + opts->cplusplus = 0, opts->cplusplus_comments = 0, + opts->c89 = 1, opts->c9x = 0, opts->objc = 0; + else if (!strcmp (argv[i], "-std=iso9899:199x") + || !strcmp (argv[i], "-std=c9x") + || !strcmp (argv[i], "-std=gnu9x")) + opts->cplusplus = 0, opts->cplusplus_comments = 1, opts->c89 = 0, + opts->c9x = 1, opts->objc = 0; + break; + + case 'w': + opts->inhibit_warnings = 1; + break; + + case 'W': + if (!strcmp (argv[i], "-Wtrigraphs")) + opts->warn_trigraphs = 1; + else if (!strcmp (argv[i], "-Wno-trigraphs")) + opts->warn_trigraphs = 0; + else if (!strcmp (argv[i], "-Wcomment")) + opts->warn_comments = 1; + else if (!strcmp (argv[i], "-Wno-comment")) + opts->warn_comments = 0; + else if (!strcmp (argv[i], "-Wcomments")) + opts->warn_comments = 1; + else if (!strcmp (argv[i], "-Wno-comments")) + opts->warn_comments = 0; + else if (!strcmp (argv[i], "-Wtraditional")) + opts->warn_stringify = 1; + else if (!strcmp (argv[i], "-Wno-traditional")) + opts->warn_stringify = 0; + else if (!strcmp (argv[i], "-Wundef")) + opts->warn_undef = 1; + else if (!strcmp (argv[i], "-Wno-undef")) + opts->warn_undef = 0; + else if (!strcmp (argv[i], "-Wimport")) + opts->warn_import = 1; + else if (!strcmp (argv[i], "-Wno-import")) + opts->warn_import = 0; + else if (!strcmp (argv[i], "-Werror")) + opts->warnings_are_errors = 1; + else if (!strcmp (argv[i], "-Wno-error")) + opts->warnings_are_errors = 0; + else if (!strcmp (argv[i], "-Wall")) + { + opts->warn_trigraphs = 1; + opts->warn_comments = 1; + } + break; + + case 'M': + /* The style of the choices here is a bit mixed. + The chosen scheme is a hybrid of keeping all options in one string + and specifying each option in a separate argument: + -M|-MM|-MD file|-MMD file [-MG]. An alternative is: + -M|-MM|-MD file|-MMD file|-MG|-MMG; or more concisely: + -M[M][G][D file]. This is awkward to handle in specs, and is not + as extensible. */ + /* ??? -MG must be specified in addition to one of -M or -MM. + This can be relaxed in the future without breaking anything. + The converse isn't true. */ + + /* -MG isn't valid with -MD or -MMD. This is checked for later. */ + if (!strcmp (argv[i], "-MG")) + { + opts->print_deps_missing_files = 1; + break; + } + if (!strcmp (argv[i], "-M")) + opts->print_deps = 2; + else if (!strcmp (argv[i], "-MM")) + opts->print_deps = 1; + else if (!strcmp (argv[i], "-MD")) + opts->print_deps = 2; + else if (!strcmp (argv[i], "-MMD")) + opts->print_deps = 1; + /* For -MD and -MMD options, write deps on file named by next arg. */ + if (!strcmp (argv[i], "-MD") || !strcmp (argv[i], "-MMD")) + { + if (i+1 == argc) + goto missing_filename; + opts->deps_file = argv[++i]; + } + else + { + /* For -M and -MM, write deps on standard output + and suppress the usual output. */ + opts->no_output = 1; + } + break; + + case 'd': + { + char *p = argv[i] + 2; + char c; + while ((c = *p++) != 0) + { + /* Arg to -d specifies what parts of macros to dump */ + switch (c) + { + case 'M': + opts->dump_macros = dump_only; + opts->no_output = 1; + break; + case 'N': + opts->dump_macros = dump_names; + break; + case 'D': + opts->dump_macros = dump_definitions; + break; + case 'I': + opts->dump_includes = 1; + break; + } + } + } + break; + + case 'g': + if (argv[i][2] == '3') + opts->debug_output = 1; + break; + + case '-': + if (!strcmp (argv[i], "--help")) + print_help (); + else if (!strcmp (argv[i], "--version")) + cpp_notice ("GNU CPP version %s\n", version_string); + exit (0); /* XXX */ + break; + + case 'v': + cpp_notice ("GNU CPP version %s", version_string); +#ifdef TARGET_VERSION + TARGET_VERSION; +#endif + fputc ('\n', stderr); + opts->verbose = 1; + break; + + case 'H': + opts->print_include_names = 1; + break; + + case 'D': + { + struct pending_option *o = (struct pending_option *) + xmalloc (sizeof (struct pending_option)); + if (argv[i][2] != 0) + o->arg = argv[i] + 2; + else if (i + 1 == argc) + { + cpp_fatal (pfile, "Macro name missing after -D option"); + return argc; + } + else + o->arg = argv[++i]; + + o->next = NULL; + o->undef = 0; + APPEND (opts->pending, define, o); + } + break; + + case 'A': + { + char *p; + + if (argv[i][2] != 0) + p = argv[i] + 2; + else if (i + 1 == argc) + { + cpp_fatal (pfile, "Assertion missing after -A option"); + return argc; + } + else + p = argv[++i]; + + if (strcmp (p, "-")) + { + struct pending_option *o = (struct pending_option *) + xmalloc (sizeof (struct pending_option)); + + o->arg = p; + o->next = NULL; + o->undef = 0; + APPEND (opts->pending, assert, o); + } + else + { + /* -A- eliminates all predefined macros and assertions. + Let's include also any that were specified earlier + on the command line. That way we can get rid of any + that were passed automatically in from GCC. */ + struct pending_option *o1, *o2; + + o1 = opts->pending->define_head; + while (o1) + { + o2 = o1->next; + free (o1); + o1 = o2; + } + o1 = opts->pending->assert_head; + while (o1) + { + o2 = o1->next; + free (o1); + o1 = o2; + } + opts->pending->assert_head = NULL; + opts->pending->assert_tail = NULL; + opts->pending->define_head = NULL; + opts->pending->define_tail = NULL; + + opts->inhibit_predefs = 1; + } + } + break; + + case 'U': + { + struct pending_option *o = (struct pending_option *) + xmalloc (sizeof (struct pending_option)); + + if (argv[i][2] != 0) + o->arg = argv[i] + 2; + else if (i + 1 == argc) + { + cpp_fatal (pfile, "Macro name missing after -U option"); + return argc; + } + else + o->arg = argv[++i]; + + o->next = NULL; + o->undef = 1; + APPEND (opts->pending, define, o); + } + break; + + case 'C': + opts->put_out_comments = 1; + break; + + case 'E': /* -E comes from cc -E; ignore it. */ + break; + + case 'P': + opts->no_line_commands = 1; + break; + + case '$': /* Don't include $ in identifiers. */ + opts->dollars_in_ident = 0; + break; + + case 'n': + if (!strcmp (argv[i], "-nostdinc")) + /* -nostdinc causes no default include directories. + You must specify all include-file directories with -I. */ + opts->no_standard_includes = 1; + else if (!strcmp (argv[i], "-nostdinc++")) + /* -nostdinc++ causes no default C++-specific include directories. */ + opts->no_standard_cplusplus_includes = 1; +#if 0 + else if (!strcmp (argv[i], "-noprecomp")) + no_precomp = 1; +#endif + break; + + case 'r': + if (!strcmp (argv[i], "-remap")) + opts->remap = 1; + break; + + case 'u': + if (!strcmp (argv[i], "-undef")) + opts->inhibit_predefs = 1; + break; + + case '\0': /* JF handle '-' as file name meaning stdin or stdout */ + if (opts->in_fname == NULL) + opts->in_fname = ""; + else if (opts->out_fname == NULL) + opts->out_fname = ""; + else + return i; /* error */ + break; + + default: + return i; + } + + return i + 1; + + missing_filename: + cpp_fatal (pfile, "Filename missing after `%s' option", argv[i]); + return argc; + missing_dirname: + cpp_fatal (pfile, "Directory name missing after `%s' option", argv[i]); + return argc; +} + +/* Handle command-line options in (argc, argv). + Can be called multiple times, to handle multiple sets of options. + Returns if an unrecognized option is seen. + Returns number of strings consumed. */ + +int +cpp_handle_options (pfile, argc, argv) + cpp_reader *pfile; + int argc; + char **argv; +{ + int i; + int strings_processed; + for (i = 0; i < argc; i += strings_processed) + { + strings_processed = cpp_handle_option (pfile, argc - i, argv + i); + if (strings_processed == 0) + break; + } + return i; +} + +static void +print_help () +{ + cpp_notice ("Usage: %s [switches] input output\n", progname); + fputs (_("\ +Switches:\n\ + -include <file> Include the contents of <file> before other files\n\ + -imacros <file> Accept definition of macros in <file>\n\ + -iprefix <path> Specify <path> as a prefix for next two options\n\ + -iwithprefix <dir> Add <dir> to the end of the system include path\n\ + -iwithprefixbefore <dir> Add <dir> to the end of the main include path\n\ + -isystem <dir> Add <dir> to the start of the system include path\n\ + -idirafter <dir> Add <dir> to the end of the system include path\n\ + -I <dir> Add <dir> to the end of the main include path\n\ + -nostdinc Do not search system include directories\n\ + (dirs specified with -isystem will still be used)\n\ + -nostdinc++ Do not search system include directories for C++\n\ + -o <file> Put output into <file>\n\ + -pedantic Issue all warnings demanded by strict ANSI C\n\ + -traditional Follow K&R pre-processor behaviour\n\ + -trigraphs Support ANSI C trigraphs\n\ + -lang-c Assume that the input sources are in C\n\ + -lang-c89 Assume that the input sources are in C89\n\ + -lang-c++ Assume that the input sources are in C++\n\ + -lang-objc Assume that the input sources are in ObjectiveC\n\ + -lang-objc++ Assume that the input sources are in ObjectiveC++\n\ + -lang-asm Assume that the input sources are in assembler\n\ + -lang-chill Assume that the input sources are in Chill\n\ + -std=<std name> Specify the conformance standard; one of:\n\ + gnu89, gnu9x, c89, c9x, iso9899:1990,\n\ + iso9899:199409, iso9899:199x\n\ + -+ Allow parsing of C++ style features\n\ + -w Inhibit warning messages\n\ + -Wtrigraphs Warn if trigraphs are encountered\n\ + -Wno-trigraphs Do not warn about trigraphs\n\ + -Wcomment{s} Warn if one comment starts inside another\n\ + -Wno-comment{s} Do not warn about comments\n\ + -Wtraditional Warn if a macro argument is/would be turned into\n\ + a string if -traditional is specified\n\ + -Wno-traditional Do not warn about stringification\n\ + -Wundef Warn if an undefined macro is used by #if\n\ + -Wno-undef Do not warn about testing undefined macros\n\ + -Wimport Warn about the use of the #import directive\n\ + -Wno-import Do not warn about the use of #import\n\ + -Werror Treat all warnings as errors\n\ + -Wno-error Do not treat warnings as errors\n\ + -Wall Enable all preprocessor warnings\n\ + -M Generate make dependencies\n\ + -MM As -M, but ignore system header files\n\ + -MD As -M, but put output in a .d file\n\ + -MMD As -MD, but ignore system header files\n\ + -MG Treat missing header file as generated files\n\ + -g Include #define and #undef directives in the output\n\ + -D<macro> Define a <macro> with string '1' as its value\n\ + -D<macro>=<val> Define a <macro> with <val> as its value\n\ + -A<question> (<answer>) Assert the <answer> to <question>\n\ + -U<macro> Undefine <macro> \n\ + -u or -undef Do not predefine any macros\n\ + -v Display the version number\n\ + -H Print the name of header files as they are used\n\ + -C Do not discard comments\n\ + -dM Display a list of macro definitions active at end\n\ + -dD Preserve macro definitions in output\n\ + -dN As -dD except that only the names are preserved\n\ + -dI Include #include directives in the output\n\ + -ifoutput Describe skipped code blocks in output \n\ + -P Do not generate #line directives\n\ + -$ Do not allow '$' in identifiers\n\ + -remap Remap file names when including files.\n\ + -h or --help Display this information\n\ +"), stdout); +} diff --git a/gcc/cppspec.c b/gcc/cppspec.c new file mode 100644 index 00000000000..387b1ce4d1f --- /dev/null +++ b/gcc/cppspec.c @@ -0,0 +1,225 @@ +/* Specific flags and argument handling of the C preprocessor. + Copyright (C) 1999 Free Software Foundation, Inc. + +This file is part of GNU CC. + +GNU CC is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU CC is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU CC; see the file COPYING. If not, write to +the Free Software Foundation, 59 Temple Place - Suite 330, +Boston, MA 02111-1307, USA. */ + +#include "config.h" +#include "system.h" + +/* The `cpp' executable installed in $(bindir) and $(cpp_install_dir) + is a customized version of the gcc driver. It forces -E; -S and -c + are errors. It defaults to -x c for files with unrecognized + extensions, unless -x options appear in argv, in which case we + assume the user knows what they're doing. If no explicit input is + mentioned, it will read stdin. */ + +/* Snarfed from gcc.c: */ + +/* This defines which switch letters take arguments. */ + +#define DEFAULT_SWITCH_TAKES_ARG(CHAR) \ + ((CHAR) == 'D' || (CHAR) == 'U' || (CHAR) == 'o' \ + || (CHAR) == 'e' || (CHAR) == 'T' || (CHAR) == 'u' \ + || (CHAR) == 'I' || (CHAR) == 'm' || (CHAR) == 'x' \ + || (CHAR) == 'L' || (CHAR) == 'A' || (CHAR) == 'V' \ + || (CHAR) == 'B' || (CHAR) == 'b') + +#ifndef SWITCH_TAKES_ARG +#define SWITCH_TAKES_ARG(CHAR) DEFAULT_SWITCH_TAKES_ARG(CHAR) +#endif + +/* This defines which multi-letter switches take arguments. */ + +#define DEFAULT_WORD_SWITCH_TAKES_ARG(STR) \ + (!strcmp (STR, "Tdata") || !strcmp (STR, "Ttext") \ + || !strcmp (STR, "Tbss") || !strcmp (STR, "include") \ + || !strcmp (STR, "imacros") || !strcmp (STR, "aux-info") \ + || !strcmp (STR, "idirafter") || !strcmp (STR, "iprefix") \ + || !strcmp (STR, "iwithprefix") || !strcmp (STR, "iwithprefixbefore") \ + || !strcmp (STR, "isystem") || !strcmp (STR, "specs")) + +#ifndef WORD_SWITCH_TAKES_ARG +#define WORD_SWITCH_TAKES_ARG(STR) DEFAULT_WORD_SWITCH_TAKES_ARG (STR) +#endif + +/* Suffixes for known sorts of input files. We let gcc.c worry about + which are appropriate preprocessor input. */ +static const char *const known_suffixes[] = +{ + ".c", ".C", ".s", ".S", ".m", + ".cc", ".cxx", ".cpp", ".cp", ".c++", + ".i", ".ii", ".mi", ".o", ".a", + NULL +}; + +/* Filter argc and argv before processing by the gcc driver proper. */ +void +lang_specific_driver (errfn, in_argc, in_argv, in_added_libraries) + void (*errfn) PVPROTO((const char *, ...)); + int *in_argc; + char ***in_argv; + int *in_added_libraries ATTRIBUTE_UNUSED; +{ + int argc = *in_argc; + char **argv = *in_argv; + + /* Do we need to read stdin? */ + int read_stdin; + + /* Do we need to insert -E? */ + int need_E; + + /* Do we need to fixup files with unrecognized suffixes? */ + int need_fixups; + + /* Table of input files with unrecognized suffixes. */ + char *urs_tab; + int urs_count; + int urs_block; + + int i, j, quote; + char **new_argv; + int new_argc; + + /* First pass. If we see an -S or -c, barf. If we see an input file, + turn off read_stdin, and if it has an unrecognizable suffix, mark + it for fixup. */ + urs_tab = xmalloc (argc); + memset (urs_tab, 0, argc); + urs_count = 0; + urs_block = 0; + quote = 0; + read_stdin = 1; + need_E = 1; + need_fixups = 1; + for (i = 1; i < argc; i++) + { + if (quote == 1) + { + quote = 0; + continue; + } + + if (argv[i][0] == '-') + { + if (argv[i][1] == '\0') + read_stdin = 0; + else if (argv[i][2] == '\0') + { + if (argv[i][1] == 'E') + need_E = 0; + else if (argv[i][1] == 'S' || argv[i][1] == 'c') + { + (*errfn) ("`%s' is not a legal option to the preprocessor", + argv[i]); + goto done; + } + else if (argv[i][1] == 'x') + { + need_fixups = 0; + quote = 1; + } + else if (SWITCH_TAKES_ARG (argv[i][1])) + quote = 1; + } + else if (argv[i][1] == 'x') + need_fixups = 0; + else if (WORD_SWITCH_TAKES_ARG (&argv[i][1])) + quote = 1; + } + else /* not an option */ + { + int l = strlen (argv[i]); + int known = 0; + const char **suff; + + read_stdin = 0; + for (suff = known_suffixes; *suff; suff++) + if (!strcmp (*suff, &argv[i][l - strlen(*suff)])) + { + known = 1; + break; + } + + if (known) + { + if (urs_block) + { + urs_block = 0; + urs_tab[i] = 2; + urs_count++; + } + } + else + { + if (!urs_block) + { + urs_block = 1; + urs_tab[i] = 1; + urs_count++; + } + } + } + } + + /* If we were given an -E option and an input file, and no input + files have unrecognized suffixes, we can bail early. */ + if (!need_E && !read_stdin && (!need_fixups || urs_count == 0)) + goto done; + + new_argc = argc + need_E + read_stdin + (need_fixups ? urs_count : 0); + new_argv = xmalloc (new_argc * sizeof(char *)); + + new_argv[0] = argv[0]; + if (need_E) + { + new_argv[1] = "-E"; + j = 2; + } + else + j = 1; + + if (need_fixups) + for (i = 1; i < argc; i++, j++) + { + if (urs_tab[i]) + new_argv[j++] = (urs_tab[i] == 1) ? "-xc" : "-xnone"; + + new_argv[j] = argv[i]; + } + else + memcpy (&new_argv[j], &argv[1], (argc - 1)*sizeof (char *)); + + if (read_stdin) + new_argv[j] = "-"; + + *in_argc = new_argc; + *in_argv = new_argv; + +done: + free (urs_tab); +} + +/* Called before linking. Returns 0 on success and -1 on failure. */ +int lang_specific_pre_link () +{ + return 0; /* Not used for cpp. */ +} + +/* Number of extra output files that lang_specific_pre_link may generate. */ +int lang_specific_extra_outfiles = 0; /* Not used for cpp. */ diff --git a/gcc/cppulp.c b/gcc/cppulp.c new file mode 100644 index 00000000000..7e7457c68c0 --- /dev/null +++ b/gcc/cppulp.c @@ -0,0 +1,26 @@ +/* CPP Library. + Copyright (C) 1986, 87, 89, 92-98, 1999 Free Software Foundation, Inc. + Contributed by Per Bothner, 1994-95. + Based on CCCP program by Paul Rubin, June 1986 + Adapted to ANSI C, Richard Stallman, Jan 1987 + +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. */ + +#include "config.h" +#include "system.h" + +#include "output.h" + +const char *user_label_prefix = 0; diff --git a/gcc/f/ChangeLog.0 b/gcc/f/ChangeLog.0 new file mode 100644 index 00000000000..b74222ed673 --- /dev/null +++ b/gcc/f/ChangeLog.0 @@ -0,0 +1,4806 @@ +Mon Jun 29 09:47:33 1998 Craig Burley <burley@gnu.org> + + Fix 980628-*.f: + * bld.h: New `pad' field and accessor macros for + ACCTER, ARRTER, and CONTER ops. + * bld.c (ffebld_new_accter, ffebld_new_arrter, + ffebld_new_conter_with_orig): Initialize `pad' field + to zero. + * com.c (ffecom_transform_common_): Include initial + padding (aka modulo aka offset) in size calculation. + Copy initial padding value into FFE initialization expression + so the GBE transformation of that expression includes it. + Make array low bound 0 instead of 1, for consistency. + (ffecom_transform_equiv_): Include initial + padding (aka modulo aka offset) in size calculation. + Copy initial padding value into FFE initialization expression + so the GBE transformation of that expression includes it. + Make array low bound 0 instead of 1, for consistency. + (ffecom_expr_, case FFEBLD_opACCTER): Delete unused `size' + variable. + Track destination offset separately, allowing for + initial padding. + Don't bother setting initial PURPOSE offset if zero. + Include initial padding in size calculation. + (ffecom_expr_, case FFEBLD_opARRTER): Allow for + initial padding. + Include initial padding in size calculation. + Make array low bound 0 instead of 1, for consistency. + (ffecom_finish_global_): Make array low bound 0 instead + of 1, for consistency. + (ffecom_notify_init_storage): Copy `pad' field from old + ACCTER to new ARRTER. + (ffecom_notify_init_symbol): Ditto. + * data.c (ffedata_gather_): Initialize `pad' field in new + ARRTER to 0. + (ffedata_value_): Ditto. + * equiv.c (ffeequiv_layout_local_): When lowering start + of equiv area, extend lowering to maintain needed alignment. + * target.c (ffetarget_align): Handle negative offset correctly. + + * global.c (ffeglobal_pad_common): Warn about non-zero + padding only the first time its seen. + If new padding larger than old, update old. + (ffeglobal_save_common): Use correct type for size throughout. + * global.h: Use correct type for size throughout. + (ffeglobal_common_pad): New macro. + (ffeglobal_pad): Delete this unused and broken macro. + +Sat Jun 27 12:18:33 1998 Jeffrey A Law (law@cygnus.com) + + * Make-lang.in (g77): Depend on mkstemp.o. Link in mkstemp.o. + +Fri Jun 26 11:54:19 1998 Craig Burley <burley@gnu.org> + + * g77spec.c (lang_specific_driver): Put `-lg2c' in + front of any `-lm' that is seen. + +Wed Jun 24 01:01:23 1998 Jeffrey A Law (law@cygnus.com) + + * g77spec.c (lang_specific_driver): Revert last change. + +Mon Jun 22 23:12:05 1998 H.J. Lu (hjl@gnu.org) + + * Make-lang.in (G77STAGESTUFF): Add g77.c. + +Fri Jun 19 07:54:40 1998 H.J. Lu (hjl@gnu.org) + + * g77spec.c (lang_specific_driver): Check n_infiles before + appending args. + +Mon Jun 15 23:39:24 1998 Craig Burley <burley@gnu.org> + + * Make-lang.in (f/g77.info): Use -f when removing + pre-existing Info files, if any. (This rm command + can go away once makeinfo has been changed to delete + .info-N files beyond the last one it creates.) + + * Make-lang.in ($(srcdir)/f/intdoc.texi): Compile + using $(INCLUDES) macro to get the new hconfig.h + and system.h headers. + +Mon Jun 15 22:21:57 1998 Craig Burley <burley@gnu.org> + + Cutover to system.h: + * Make-lang.in: + * Makefile.in: + * ansify.c: + * bad.c: + * bld.c: + * com.c: + * com.h: + * expr.c: + * fini.c: + * g77spec.c: + * implic.c: + * intdoc.c: + * intrin.c: + * lex.c: + * lex.h: + * parse.c: + * proj.c: + * proj.h: + * src.c: + * src.h: + * stb.c: + * ste.c: + * target.c: + * top.c: + * system.j: New file. + + Use toplev.h where appropriate: + * Make-lang.in: + * Makefile.in: + * bad.c: + * bld.c: + * com.c: + * lex.c: + * ste.c: + * top.c: + * toplev.j: New file. + + Conditionalize all dumping/reporting routines so they don't + get built for gcc/egcs: + * bld.c: + * bld.h: + * com.c: + * equiv.c: + * equiv.h: + * sta.c: + * stt.c: + * stt.h: + * symbol.c: + * symbol.h: + + Use hconfig.h instead of config.h where appropriate: + * Makefile.in (proj-h.o): Compile with -DUSE_HCONFIG. + * fini.c: Define USE_HCONFIG before including proj.h. + + * Makefile.in (deps-kinda): Redirect stderr to stdout, + to eliminate diagnostics vis-a-vis g77spec.c. + + * Makefile.in: Regenerate dependencies via deps-kinda. + + * lex.c (ffelex_file_fixed, ffelex_file_free): Eliminate + apparently spurious warnings about uninitialized variables + `c', `column', and so on. + +Sat Jun 13 03:13:18 1998 Craig Burley <burley@gnu.org> + + * g77spec.c (lang_specific_driver): Print out egcs + version info first, to be compatible with what some + test facilities expect. + +Wed Jun 10 13:17:32 1998 Dave Brolley <brolley@cygnus.com> + + * top.h (ffe_decode_option): New argc/argv interface. + * top.c (ffe_decode_option): New argc/argv interface. + * parse.c (yyparse): New argc/argv interface for ffe_decode_option. + * com.c (lang_decode_option): New argc/argv interface. + +Sun Jun 7 14:04:34 1998 Richard Henderson <rth@cygnus.com> + + * com.c (lang_init_options): New function. + * top.c (ffe_decode_option): Remove all trace of -fset-g77-defaults. + Set ffe_is_do_internal_checks_ with -version. + * lang-options.h: Likewise. + * lang-specs.h: Likewise. + +Fri Jun 5 15:53:17 1998 Per Bothner <bothner@cygnus.com> + + * g77spec.c (lang_specific_pre_link, lang_specific_extra_ofiles): + Define - update needed by gcc.c change. + +Mon Jun 1 19:37:42 1998 Craig Burley <burley@gnu.org> + + * com.c (ffecom_init_0): Fix setup of INTEGER(KIND=7) + pointer type. + * info.c (ffeinfo_type): Don't crash on null type. + * expr.c (ffeexpr_fulfill_call_): Don't special-case + %LOC(expr) or LOC(expr). + Delete FFEGLOBAL_argsummaryPTR. + * global.c, global.h: Delete FFEGLOBAL_argsummaryPTR. + +Thu May 28 21:32:18 1998 Craig Burley <burley@gnu.org> + + Restore circa-0.5.22 capabilities of `g77' driver: + * Make-lang.in (g77spec.o): Depend on f/version.h. + (g77version.o): New rule to compile g77 version info. + (g77$(exeext)): Depend on and link in g77version.o. + * g77spec.c: Rewrite to be more like 0.5.22 version + of g77.c, making filtering of command line smarter + so mixed Fortran and C (etc.) can be compiled, verbose + version info can be obtained, etc. + * lang-specs.h (f77-version): New "language" to support + "g77 -v" command under new gcc 2.8 regime. + * lex.c (ffelex_file_fixed): If -fnull-version, just + substitute a "source file" that prints out version info. + * top.c, top.h: Support -fnull-version. + + * lang-specs.h: Use "%O" instead of OO macro to specify + object extension. Remove old stringizing cruft. + + * Make-lang.in (g77.c, g77spec.o, g77.o, g77$(exeext), + g77-cross$(exeext), f771, + $(srcdir)/f/g77.info, $(srcdir)/f/g77.dvi, + $(srcdir)/f/intdoc.texi, + f77.install-common, f77.install-info, f77.install-man, + f77.uninstall, $(G77STAGESTUFF), f77.stage1, f77.stage2, + f77.stage3, f77.stage4, f77.distdir): Don't do anything + unless user specified "f77" or "F77" in $LANGUAGES either + during configuration or explicitly. For convenience of + various tests and to work around lack of the assignment + "LANGUAGES=$(BOOT_LANGUAGES)" in the "make stage1" command + of "make bootstrap" in gcc, use a touch file named "lang-f77" + to communicate whether this is the case. + + * Make-lang.in (F77_FLAGS_TO_PASS): Delete this macro, + replace with minimal expansion of its former self in + each of the two instances where it was used. + + * Makefile.in (HOST_CC): Delete this definition. + + * com.c (index, rindex): Delete these declarations. + + * proj.h: (isascii): Delete this. + + * Make-lang.in (f77.install-common): Warn if `f77-install-ok' + flag-file exists, since it no longer triggers any activity. + + Rename libf2c.a and f2c.h to libg2c.a and g2c.h, + normalize and simplify g77/libg2c build process: + * Make-lang.in: Remove all support for overwriting + /usr/bin/f77 etc., or whatever the actual names are + via $(prefix) and $(local_prefix). (g++ overwrites + /usr/bin/c++, but then it's often the only C++ compiler + on the system; f77 often exists on systems that are + installing g77.) + (f77.realclean): Remove obsolete target. + (g77.c, g77$(exeext)): Minor changes to look more like g++'s + stuff. + (f771): Now built with srcdir=gcc/f, not srcdir=gcc, to be + more like g++ and such. + (f/Makefile): Removed, as g++ doesn't need this rule. + (f77.install-common): No longer install f77, etc. + (f77.install-man): No longer install f77.1. + (f77.uninstall): No longer uninstall f77, f77.1, etc. + (f77.stage1, f77.stage2, f77.stage3, f77.stage4): Do work + only if "f77" appears in $(LANGUAGES). + (Note: gcc's Makefile.in's bootstrap target should set + LANGUAGES=$(BOOT_LANGUAGES) when making the stage1 target.) + * Makefile.in: Update vis-a-vis gcc/cp/Makefile.in. + (none): Remove. + (g77-only): Relocate. + (all.indirect, f771, *.o): Now assumes current directory + is this dir (gcc/f), not the parent directory. + (TAGS): Remove "echo 'parse.y,0' >> TAGS ;" line. + * config-lang.in: Delete commented-out code. + Fix stagestuff definition. Add more stuff to + diff_excludes definition. Don't create any directories. + Set outputs to f/Makefile, to get variable substition + to happen (what does that really do, anyway?!). + * g77spec.c: Rename libf2c to libg2c. + + * com.h: Remove all of the gcc back-end decls, + since egcs should have all of them correct. + + * com.c: Include "proj.h" before anything else, + as that's how things are supposed to work. + * ste.c: Ditto. + + * bad.c: Include "flags.j" here, since some diagnostics + check flag_pedantic_errors. + + * Makefile.in (f/*.o): Rebuild dependencies via + deps-kinda. + + * output.j: New source file. + * Make-lang.in (F77_SRCS): Update accordingly. + * Makefile.in (OUTPUT_H): Ditto. + (deps-kinda): Ditto. + * com.c: Include "output.j" here. + * lex.c: Ditto. + +Mon May 25 03:34:42 1998 Craig Burley <burley@gnu.org> + + * com.c (ffecom_expr_): Fix D**I and Z**I cases to + not convert (DOUBLE PRECISION) D and (DOUBLE COMPLEX) Z + to INTEGER. (This is dead code here anyway.) + +Sat May 23 06:32:52 1998 Craig Burley <burley@gnu.org> + + * com.c (ffecom_finish_symbol_transform_): Don't transform + statement (nested) functions, to avoid gcc compiling them + and thus producing linker errors if they refer to undefined + external functions. But warn if they're unused and -Wunused. + * bad.def (FFEBAD_SFUNC_UNUSED): New diagnostic. + +Wed May 20 12:12:55 1998 Craig Burley <burley@gnu.org> + + * Version 0.5.23 released. + +Tue May 19 14:52:41 1998 Craig Burley <burley@gnu.org> + + * bad.def (FFEBAD_OPEN_UNSUPPORTED, FFEBAD_INQUIRE_UNSUPPORTED, + FFEBAD_READ_UNSUPPORTED, FFEBAD_WRITE_UNSUPPORTED, + FFEBAD_QUAD_UNSUPPORTED, FFEBAD_BLOCKDATA_STMT, + FFEBAD_TRUNCATING_CHARACTER, FFEBAD_TRUNCATING_HOLLERITH, + FFEBAD_TRUNCATING_NUMERIC, FFEBAD_TRUNCATING_TYPELESS, + FFEBAD_TYPELESS_OVERFLOW): Change these from warnings + to errors. + +Tue May 19 14:51:59 1998 Craig Burley <burley@gnu.org> + + * Make-lang.in (f77.install-info, f77.uninstall): + Use install-info as appropriate. + +Tue May 19 12:56:54 1998 Craig Burley <burley@gnu.org> + + * com.c (ffecom_init_0): Rename xargc to f__xargc, + in accord with same-dated change to f/runtime. + +Fri May 15 10:52:49 1998 Craig Burley <burley@gnu.org> + + * com.c (ffecom_convert_narrow_, ffecom_convert_widen_): + Be even more persnickety in checking for internal bugs. + Also, if precision isn't changing, just return the expr. + + * expr.c (ffeexpr_token_number_): Call + ffeexpr_make_float_const_ to make an integer. + (ffeexpr_make_float_const_): Handle making an integer. + + * intrin.c (ffeintrin_init_0): Distinguish between + crashes on bad arg base and kind types. + +Fri May 15 01:44:22 1998 Mumit Khan <khan@xraylith.wisc.edu> + + * Make-lang.in (f77.mostlyclean): Add missing exeext. + +Thu May 14 13:30:59 1998 Craig Burley <burley@gnu.org> + + * Make-lang.in (f/expr.c): Now depends on f/stamp-str. + * expr.c: Use ffestrOther in place of ffeexprDotdot_. + * str-ot.fin: Add more keywords for expr.c. + + * intdoc.c (dumpimp): Trivial fix. + + * com.c (ffecom_expr_): Add ltkt variable for clarity. + +Wed May 13 13:05:34 1998 Craig Burley <burley@gnu.org> + + * Make-lang.in (G77STAGESTUFF): Add g77.o, g77spec.o, + and g77version.o. + (f77.clean): Add removal of g77.c, g77.o, g77spec.o, + and g77version.o. + (f77.distclean): Delete removal of g77.c. + +Thu Apr 30 18:59:43 1998 Jim Wilson <wilson@cygnus.com> + + * Make-lang.in (g77.info, g77.dvi, BUGS, INSTALL, NEWS): Put -o + option before input file. + +Tue Apr 28 09:23:10 1998 Craig Burley <burley@gnu.org> + + Fix 980427-0.f: + * global.c (ffeglobal_ref_progunit_): When transitioning + from EXT to FUNC, discard hook, since the decl, if any, is + probably wrong. + +Sun Apr 26 09:05:50 1998 Craig Burley <burley@gnu.org> + + * com.c (ffecom_char_enhance_arg_): Wrap the upper bound + (the PARM_DECL specifying the length of the CHARACTER*(*) + dummy arg) in a variable_size invocation, to prevent + dwarf2out.c crashing when compiling code with -g. + +Sat Apr 18 15:26:57 1998 Jim Wilson <wilson@cygnus.com> + + * g77spec.c (lang_specific_driver): New argument in_added_libraries. + New local added_libraries. Increment count when add library to + arglist. + +Sat Apr 18 05:03:21 1998 Craig Burley <burley@gnu.org> + + * com.c (ffecom_check_size_overflow_): Ignore overflow + as well if dummy argument. + +Fri Apr 17 17:18:04 1998 Craig Burley <burley@gnu.org> + + * version.h: Get rid of the overly large headers + here too, as done in version.c. + +Tue Apr 14 15:51:37 1998 Dave Brolley <brolley@cygnus.com> + + * com.c (init_parse): Now returns char* containing filename; + +Tue Apr 14 14:40:40 1998 Craig Burley <burley@gnu.org> + + * com.c (ffecom_start_progunit_): Mark function decl + as used, to avoid spurious warning (-Wunused) for ENTRY. + +Tue Apr 14 14:19:34 1998 Craig Burley <burley@gnu.org> + + * sta.c (ffesta_second_): Check for CASE DEFAULT + as well as CASE, or it won't be recognized. + +Thu Apr 9 00:18:44 1998 Dave Brolley (brolley@cygnus.com) + + * com.c (finput): New variable. + (init_parse): Handle !USE_CPPLIB. + (finish_parse): New function. + (lang_init): No longer declare finput. + +Sat Apr 4 17:45:01 1998 Richard Henderson <rth@cygnus.com> + + * com.c (ffecom_expr_): Revert Oct 22 change. Instead take a WIDENP + argument so that we can respect the signedness of the original type. + (ffecom_init_0): Do sizetype initialization first. + +1998-03-28 Dave Love <d.love@dl.ac.uk> + + * Make-lang.in (f771$(exeext)): Fix typo. + +1998-03-24 Martin von Loewis <loewis@informatik.hu-berlin.de> + + * com.c (lang_print_xnode): New function. + +Mon Mar 23 21:20:35 1998 Craig Burley <burley@gnu.org> + + * version.c: Reduce to a one-line file, like + gcc's version.c, since there's really no content + there. + +Mon Mar 23 11:58:43 1998 Craig Burley <burley@gnu.org> + + * bugs.texi: Various updates. + + * com.c (ffecom_tree_canonize_ptr_): Fix up spacing a bit. + +Sun Mar 22 00:50:42 1998 Nick Clifton <nickc@cygnus.com> + Geoff Noer <noer@cygnus.com> + + * Makefile.in: Various fixes for building cygwin32 native toolchains. + * Make-lang.in: Likewise. + +Mon Mar 16 21:20:35 1998 Craig Burley <burley@gnu.org> + + * expr.c (ffeexpr_sym_impdoitem_): Don't blindly + reset symbol info after calling ffesymbol_error, + to avoid crash. + +Mon Mar 16 15:38:50 1998 Craig Burley <burley@gnu.org> + + * Version 0.5.22 released. + +Mon Mar 16 14:36:02 1998 Craig Burley <burley@gnu.org> + + Make -g work better for ENTRY: + * com.c (ffecom_start_progunit_): Master function + for ENTRY-laden procedure is not really invented, + so it can be debugged. + (ffecom_do_entry_): Push/set/pop lineno for each + entry point. + +Sun Mar 15 05:48:49 1998 Craig Burley <burley@gnu.org> + + * intrin.def: Fix spelling of mixed-case form + of `CPU_Time' (was `Cpu_Time'). + +Thu Mar 12 13:50:21 1998 Craig Burley <burley@gnu.org> + + * lang-options.h: Sort all -f*-intrinsics-* options, + for consistency with other g77 versions. + +Thu Mar 12 09:39:40 1998 Manfred Hollstein <manfred@s-direktnet.de> + + * lang-specs.h: Properly put brackets around array elements in initializer. + +1998-03-09 Dave Love <d.love@dl.ac.uk> + + * Make-lang.in: Set CONFIG_SITE to a non-existent file since + /dev/null loses with bash 2.0/autoconf 2.12. Put + F77_FLAGS_TO_PASS before CC. + +Sun Mar 8 16:35:34 1998 Craig Burley <burley@gnu.org> + + * intrin.def: Use tabs instead of blanks more + consistently (excepting DEFGEN section for now). + +Wed Mar 4 17:38:21 1998 Jeffrey A Law (law@cygnus.com) + + * Make-lang.in: Remove more references to libf77. + +Tue Mar 3 10:52:35 1998 Manfred Hollstein <manfred@s-direktnet.de> + + * g77.texi: Use @url for citing URLs. + +Sat Feb 28 15:24:38 1998 Craig Burley <burley@gnu.org> + + * intrin.def: Make CPU_TIME's arg generic real to be just + like SECOND_subr. + +Fri Feb 20 12:45:53 1998 Craig Burley <burley@gnu.org> + + * expr.c (ffeexpr_token_arguments_): Make sure + outer exprstack isn't null. + +1998-02-16 Dave Love <d.love@dl.ac.uk> + + * Makefile.in (f/fini): Don't use -W -Wall with HOST_CC. + +Fri Feb 13 00:14:56 1998 Kaveh R. Ghazi <ghazi@caip.rutgers.edu> + + * com.c (type_for_mode): Add explicit braces to avoid ambiguous `else'. + + * expr.c (ffeexpr_type_combine): Likewise. + (ffeexpr_reduce_): Likewise. + (ffeexpr_declare_parenthesized_): Likewise. + + * src.c (ffesrc_strcmp_1ns2i): Likewise. + (ffesrc_strcmp_2c): Likewise. + (ffesrc_strncmp_2c): Likewise. + + * stb.c (ffestb_halt1_): Likewise. + (ffestb_R90910_): Likewise. + (ffestb_R9109_): Likewise. + + * stc.c (ffestc_R544_equiv_): Likewise. + + * std.c (ffestd_subr_copy_easy_): Likewise. + (ffestd_R1001dump_): Likewise. + (ffestd_R1001dump_1005_1_): Likewise. + (ffestd_R1001dump_1005_2_): Likewise. + (ffestd_R1001dump_1005_3_): Likewise. + (ffestd_R1001dump_1005_4_): Likewise. + (ffestd_R1001dump_1005_5_): Likewise. + (ffestd_R1001dump_1010_2_): Likewise. + + * ste.c (ffeste_R840): Likewise. + + * sts.c (ffests_puttext): Likewise. + + * symbol.c (ffesymbol_check_token_): Likewise. + + * target.c (ffetarget_real1): Likewise. + (ffetarget_real2): Likewise. + +Wed Feb 11 01:44:48 1998 Richard Henderson (rth@cygnus.com) + + * com.c (ffecom_ptr_to_expr) [FFEBLD_opARRAYREF]: Do upper - lower + in the native type, so as to properly handle negative indices. + +Tue Feb 3 20:13:05 1998 Richard Henderson <rth@cygnus.com> + + * config-lang.in: Remove references to runtime/. + +Sun Feb 1 12:43:49 1998 J"orn Rennecke <amylaar@cygnus.co.uk> + + * com.c (ffecom_tree_canonize_ptr_): Place bitsizetype typed expr + as first agument in MULT_EXPR. + Use bitsize_int (0L, 0L) as zero for bitsizes. + (ffecom_tree_canonize_ref_): + Use bitsize_int (0L, 0L) as zero for bitsizes. + (ffecom_init_0): Use set_sizetype. + +Sun Feb 1 02:26:58 1998 Richard Henderson <rth@cygnus.com> + + * runtime directory -- moved into "libf2c" in the toplevel + directory. + * Make-lang.in: Remove all runtime related stuff. + +Sun Jan 25 12:32:15 1998 Kaveh R. Ghazi <ghazi@caip.rutgers.edu> + + * Make-lang.in (f77.stage1): Depend on stage1-start so parallel + make works better. + * (f77.stage2): Likewise for stage2-start. + * (f77.stage3): Likewise for stage3-start. + * (f77.stage4): Likewise for stage4-start. + +Sat Jan 17 21:28:08 1998 Pieter Nagel <pnagel@epiuse.co.za> + + * Makefile.in (FLAGS_TO_PASS): Pass down gcc_include_dir and + local_prefix to sub-make invocations. + +Tue Jan 13 22:07:54 1998 Jeffrey A Law (law@cygnus.com) + + * lang-options.h: Add missing options. + +Sun Jan 11 02:14:47 1998 Craig Burley <burley@gnu.org> + + Support FORMAT(I<1+2>) (constant variable-FORMAT + expressions): + * bad.def (FFEBAD_FORMAT_VARIABLE): New diagnostic. + * std.c (ffestd_R1001rtexpr_): New function. + (ffestd_R1001dump_, ffestd_R1001dump_1005_1_, + ffestd_R1001dump_1005_2_, ffestd_R1001dump_1005_3_, + ffestd_R1001dump_1005_4_, ffestd_R1001dump_1005_5_, + ffestd_R1001dump_1010_2_, ffestd_R1001dump_1010_3_, + ffestd_R1001dump_1010_4_, ffestd_R1001dump_1010_5_): + Use new function instead of ffestd_R1001error_. + + * stb.c (ffestb_R10014_, ffestb_R10016_, ffestb_R10018_, + ffestb_R100110_): Restructure `for' loop for style. + + Fix 970626-2.f by not doing most back-end processing + when current_function_decl is an ERROR_MARK, and by + making that the case when its type would be an ERROR_MARK: + * com.c (ffecom_start_progunit_, finish_function, + lang_printable_name, start_function, + ffecom_finish_symbol_transform_): Test for ERROR_MARK. + * std.c (ffestd_stmt_pass_): Don't do any downstream + processing if ERROR_MARK. + + * Make-lang.in (f77.install-common): Don't install, and + don't uninstall existing, Info files if f/g77.info + doesn't exit. (This is a somewhat modified version + of an egcs patch on 1998-01-07 12:05:51 by Bruno Haible + <bruno@linuix.mathematik.uni-karlsruhe.de>.) + +Fri Jan 9 19:09:07 1998 Craig Burley <burley@gnu.org> + + Fix -fpedantic combined with `F()' invocation, + also -fugly-comma combined with `IARGC()' invocation: + * bad.def (FFEBAD_NULL_ARGUMENT_W): New diagnostic. + * expr.c (ffeexpr_finished_): Don't reject null expressions + in the argument-expression context -- let outer context + handle that. + (ffeexpr_token_arguments_): Warn about null expressions + here if -fpedantic (as appropriate). + Obey -fugly-comma for only external-procedure invocations. + * intrin.c (ffeintrin_check_): No longer ignore explicit + omitted trailing args. + +Tue Dec 23 14:58:04 1997 Craig Burley <burley@gnu.org> + + * intrin.c (ffeintrin_fulfill_generic): Don't generate + FFEBAD_INTRINSIC_TYPE for CHARACTER*(*) intrinsic. + + * com.c (ffecom_gfrt_basictype): + (ffecom_gfrt_kindtype): + (ffecom_make_gfrt_): + (FFECOM_rttypeVOIDSTAR_): New return type `void *', for + the SIGNAL intrinsic. + * com-rt.def (FFECOM_rttypeSIGNAL): Now returns `void *'. + * intdoc.c: Replace `p' kind specifier with `7'. + * intrin.c (ffeintrin_check_, ffeintrin_init_0): Replace + `p' kind specifier with `7'. + * intrin.def (FFEINTRIN_impLOC, FFEINTRIN_impSIGNAL_func, + FFEINTRIN_impSIGNAL_subr): Replace `p' specifier with `7'. + Also, SIGNAL now returns a `void *' status, not `int'. + + Improve run-time diagnostic for "PRINT '(I1', 42": + * com.c (ffecom_char_args_x_): Renamed from ffecom_char_args_, + which is now a macro (to avoid lots of changes to other code) + with new arg, ffecom_char_args_with_null_ being another new + macro to call same function with different value for new arg. + This function now appends a null byte to opCONTER expression + if the new arg is TRUE. + (ffecom_arg_ptr_to_expr): Support NULL length pointer. + * ste.c (ffeste_io_cilist_): + (ffeste_io_icilist_): Pass NULL length ptr for + FORMAT expression, so null byte gets appended where + feasible. + * target.c (ffetarget_character1): + (ffetarget_concatenate_character1): + (ffetarget_substr_character1): + (ffetarget_convert_character1_character1): + (ffetarget_convert_character1_hollerith): + (ffetarget_convert_character1_integer4): + (ffetarget_convert_character1_logical4): + (ffetarget_convert_character1_typeless): + (ffetarget_hollerith): Append extra phantom null byte as + part of FFETARGET-NULL-BYTE kludge. + + * intrin.def (FFEINTRIN_impCPU_TIME): Point to + FFECOM_gfrtSECOND as primary run-time routine. + +Mon Dec 22 12:41:07 1997 Craig Burley <burley@gnu.org> + + * intrin.c (ffeintrin_init_0): Remove duplicate + check for `!'. + +Fri Dec 19 00:12:01 1997 Richard Henderson <rth@cygnus.com> + + * com.c (ffecom_sym_transform_): Assumed arrays have no upper bound. + +Mon Dec 15 17:35:35 1997 Richard Henderson <rth@cygnus.com> + + * com.c (ffecom_type_vardesc_): Vardesc.dims is a `ftnlen*'. + +Sun Dec 14 02:49:58 1997 Craig Burley <burley@gnu.org> + + * intrin.c (ffeintrin_init_0): Fix up indentation a bit. + Fix bug that prevented checking of arguments other + than the first. + + * intdoc.c: Fix up indentation a bit. + +Tue Dec 9 16:20:57 1997 Richard Henderson <rth@cygnus.com> + + * com.c (ffecom_type_vardesc_): Vardesc.dims is a `ftnlen*'. + +Tue Dec 2 09:57:16 1997 Jeffrey A Law (law@cygnus.com) + + * Make-lang.in (f77.clean): Remove g77.c. + +Mon Dec 1 19:12:36 1997 Craig Burley <burley@gnu.org> + + * intrin.c (ffeintrin_check_): Fix up indentation a bit more. + +Mon Dec 1 16:21:08 1997 Craig Burley <burley@gnu.org> + + * com.c (ffecom_arglist_expr_): Crash if non-supplied + optional arg isn't passed as an address. + Pass null pointer explicitly, instead of via ffecom routine. + If incoming argstring is NULL, substitute pointer to "0". + Recognize '0' as ending the usual arg stuff, just like '\0'. + +Sun Nov 30 22:22:22 1997 Craig Burley <burley@gnu.org> + + * intdoc.c: Minor fix-ups. + + * intrin.c (ffeintrin_check_): Fix up indentation a bit. + + * intrin.def: Fix up spacing a bit. + +Tue Nov 25 15:33:28 1997 Jeffrey A Law (law@cygnus.com) + + * Make-lang.in (f77.all.build): Add $(exeext) to binary files. + (f77.all.cross, f77.start.encap): Simliarly. + +Fri Nov 21 09:35:20 1997 Fred Fish <fnf@cygnus.com> + + * Make-lang.in (stmp-f2c.h): Move inclusion of F77_FLAGS_TO_PASS + to before override of CC so that the override works. + +Thu Nov 20 00:58:14 1997 H.J. Lu (hjl@gnu.ai.mit.edu) + + * Make-lang.in (f77.install-info): Depend on f77.info. + +1997-11-17 Dave Love <d.love@dl.ac.uk> + + * com.c (ffecom_arglist_expr_): Pass null pointers for optional + args which aren't supplied. + +Sun Nov 16 21:45:43 1997 H.J. Lu (hjl@gnu.ai.mit.edu) + + * Make-lang.in (f77.install-info): Depend on f77.info. + +1997-11-14 Dave Love <d.love@dl.ac.uk> + + * intrin.def: Supply gfrt for CPU_TIME. Generalize arg types of + INT2, INT8, per doc. + +1997-11-06 Dave Love <d.love@dl.ac.uk> + + * intrin.def: Allow non-integer args for INT2 and INT8 (per + documentation). + +Sun Nov 2 19:49:51 1997 Richard Henderson <rth@cygnus.com> + + * com.c (ffecom_expr_): Only use TREE_TYPE argument for simple + arithmetic; convert types as necessary; recurse with target tree type. + +Tue Oct 28 02:21:25 1997 Craig Burley <burley@gnu.ai.mit.edu> + + * lang-options.h: Add -fgnu-intrinsics-* and + -fbadu77-intrinsics-* options. + +Sun Oct 26 02:36:21 1997 Craig Burley <burley@gnu.ai.mit.edu> + + * com.c (lang_print_error_function): Fix to more + reliably notice when the diagnosed region changes. + +Sat Oct 25 23:43:36 1997 Craig Burley <burley@gnu.ai.mit.edu> + + Fix 950327-0.f: + * sta.c, sta.h (ffesta_outpooldisp): New function. + * std.c (ffestd_stmt_pass_): Don't kill NULL pool. + (ffestd_R842): If pool already preserved, save NULL + for pool, because it should be killed only once. + + * malloc.c [MALLOC_DEBUG]: Put initializer for `name' + component in braces, to avoid compiler warning. + +Wed Oct 22 11:37:41 1997 Richard Henderson <rth@cygnus.com> + + * com.c (ffecom_expr_): Take an new arg TREE_TYPE that if non-null + specifies the type in which to do the calculation. Change all callers. + [FFEBLD_opARRAYREF]: Force the index expr to use sizetype. + +Thu Oct 16 02:04:08 1997 Paul Koning <pkoning@xedia.com> + + * Make-lang.in (stmp-f2c.h): Don't configure the runtime + directory if LANGUAGES does not include f77. + +Mon Oct 13 12:12:41 1997 Richard Henderson <rth@cygnus.com> + + * Make-lang.in (g77*): Copied from cp/Make-lang.in g++*. + * g77spec.c: New file, mostly copied from g++spec.c + * g77.c: Removed. + +Fri Oct 10 13:00:48 1997 Craig Burley <burley@gnu.ai.mit.edu> + + * ste.c (ffeste_begin_iterdo_): Fix loop setup so iteration + variable is modified only after the #iterations is calculated; + otherwise if the iteration variable is aliased to any of the + operands in the start, end, or increment expressions, the + wrong #iterations might be calculated. + + * com.c (ffecom_save_tree): Fix indentation. + +Mon Oct 6 14:15:03 1997 Jeffrey A Law (law@cygnus.com) + + * Make-lang.in (f77.mostlyclean): Clean up stuff in the + object tree too. + (f77.clean, f77.distclean, f77.maintainer-clean): Likewise. + +1997-10-05 Dave Love <d.love@dl.ac.uk> + + * intrin.def: Make SECOND_subr's arg generic real for people + porting from Cray and making everything double precision. + +Wed Oct 1 01:45:36 1997 Philippe De Muyter <phdm@info.ucl.ac.be> + + * g77.c (pexecute, main): Use unlink, not remove. + +Mon Sep 29 16:18:21 1997 Craig Burley <burley@gnu.ai.mit.edu> + + * stu.c (ffestu_list_exec_transition_, + ffestu_dummies_transition_): Specify `bool' type for + `in_progress' variables. + + * com.h (assemble_string): Declare this routine (instead + of #include'ing "output.h" from gcc) to eliminate warnings + from lex.c. + +Mon Sep 29 10:37:07 1997 Jeffrey A Law (law@cygnus.com) + + * intdoc.c (main): Remove unused attribute for main's arguments. + +Sun Sep 28 01:47:17 1997 Jeffrey A Law (law@cygnus.com) + + * Make-lang.in (G77_FLAGS_TO_PASS): Pass down RANLIB, RANLIB_TEST + and AR instead of the _FOR_TARGET versions. + +Tue Sep 23 00:39:57 1997 Alexandre Oliva <oliva@dcc.unicamp.br> + + * Make-lang.in: install.texi was renamed to g77install.texi + * install0.texi: Likewise. + +Fri Sep 19 01:12:27 1997 Craig Burley <burley@gnu.ai.mit.edu> + + * expr.c (ffeexpr_reduced_eqop2_): + (ffeexpr_reduced_relop2_): Minor fixes to diagnostic code. + + * fini.c (main): Change return type to `int'. + +Thu Sep 18 17:31:38 1997 Jeffrey A Law (law@cygnus.com) + + * proj.h (FFEPROJ_BSEARCH): Delete all references. + (FFEPROJ_STRTOUL): Likewise. + * proj.c (bsearch): Compile this if no bsearch is provided by the + host system. + (strtoul): Similarly. + + * g77install.texi: Renamed from install.texi + * g77.texi: Corresponding changes. + + * fini.c (main): Return type is int. + + * com.c (lang_printable_name): Use verbosity argument. + +Thu Sep 18 16:08:40 1997 Jeffrey A Law (law@cygnus.com) + + * Make-lang.in: Fix merge problems. + +Wed Sep 17 10:47:08 1997 Craig Burley <burley@gnu.ai.mit.edu> + + * com-rt.def (FFECOM_gfrtDSIGN, FFECOM_gfrtISIGN, + FFECOM_gfrtSIGN): Add second argument. + + * expr.c (ffeexpr_cb_comma_c_): Trivial fixes. + +Sun Sep 14 21:01:23 1997 Jeffrey A Law (law@cygnus.com) + + * Make-lang.in: Various changes to build info files + in the object tree rather than the source tree. + + * proj.h: Include ctype.h. + +Sun Sep 14 12:35:20 1997 Fred Fish (fnf@ninemoons.com) + + * proj.h (isascii): Provide a default definition if none is available. + +Thu Sep 11 19:26:10 1997 Dave Love <d.love@dl.ac.uk> + + * config-lang.in: Remove the messages about possible build problems. + +Wed Sep 10 16:39:47 1997 Jim Wilson <wilson@cygnus.com> + + * Make-lang.in (LN, LN_S): New macros, use where appropriate. + +Tue Sep 9 13:20:40 1997 Jim Wilson <wilson@cygnus.com> + + * g77.c (pexecute, doit): Add checks for __CYGWIN32__. + +Tue Sep 9 01:59:35 1997 Craig Burley <burley@gnu.ai.mit.edu> + + * Version 0.5.21 released. + +Tue Sep 9 00:31:01 1997 Craig Burley <burley@gnu.ai.mit.edu> + + * intdoc.c (dumpem): Put appropriate commentary in + output file, so readers know it isn't source. + +Wed Aug 27 20:32:03 1997 Jeffrey A Law (law@cygnus.com) + + * top.c (ffe_decode_option): Turn on flag_move_all_moveables + and flag_reduce_all_givs. + +Wed Aug 27 08:08:25 1997 Craig Burley <burley@gnu.ai.mit.edu> + + * proj.h: Always #include "config.j" first, to pick up + gcc's configuration. + * com.c: Change bcopy() and bzero() calls to memcpy() + and memset() calls, to make more of g77 ANSI C. + +1997-08-26 Dave Love <d.love@dl.ac.uk> + + * Make-lang.in ($(srcdir)/f/runtime/configure, + $(srcdir)/f/runtime/libU77/configure): Fix for when srcdir isn't + relative. + +Tue Aug 26 05:59:21 1997 Craig Burley <burley@gnu.ai.mit.edu> + + * ansify.c (main): Make sure readers of stdout know + it's derived from stdin; omit comment text; get source + line numbers in future stderr output to be correct. + +Tue Aug 26 01:36:01 1997 Craig Burley <burley@gnu.ai.mit.edu> + + Fix 970825-0.f: + * stb.c (ffestb_R5284_): Allow OPEN_PAREN after closing + SLASH as well as NAME. + +Mon Aug 25 23:48:17 1997 Craig Burley <burley@gnu.ai.mit.edu> + + Changes to allow g77 docs to be built entirely from scratch + using any ANSI C compiler, not requiring GNU C: + * Make-lang.in ($(srcdir)/f/intdoc.texi): "Pipe" new + location of intrinsic documentation data base, f/intdoc.in, + through new `ansify' program to append `\n\' to quoted + newlines, into f/intdoc.h0. Do appropriate cleanups. Explain. + (f77.mostlyclean): Add f/ansify and f/intdoc.h0 to cleanups. + * f/ansify.c: New program. + * f/intdoc.c: Fix so it conforms to ANSI C. + #include f/intdoc.h0 instead of f/intdoc.h. + Avoid some warnings. + * f/intdoc.h, f/intdoc.in: Rename the former to the latter; no + changes made to the content in this patch! + * f/intrin.h (ffeintrinFamily): Fix to conform to ANSI C. + +Mon Aug 25 23:24:32 1997 H.J. Lu (hjl@gnu.ai.mit.edu) + + * Make-lang.in ($(srcdir)/f/runtime/configure, + $(srcdir)/f/runtime/libU77/configure, f77.mostlyclean, + f77.clean, f77.distclean, f77.maintainer-clean, f77.realclean): + Handle absolute pathname of $(srcdir). + (stmp-f2c.h): New. + (include/f2c.h, f/runtime/Makefile, f/runtime/libF77/Makefile, + f/runtime/libI77/Makefile, f/runtime/libU77/Makefile): Only + depend on stmp-f2c.h. + (f77.maintainer-clean): Don't make itself. + +Sun Aug 24 17:00:27 1997 Jim Wilson <wilson@cygnus.com> + + * Make-lang.in (f77.install-info): Don't cd into srcdir. Add srcdir + to filenames. Use sed to extract base filename for install. + +Sun Aug 24 06:52:48 1997 Craig Burley <burley@gnu.ai.mit.edu> + + Fix up g77 compiler data base for libf2c routines: + * com-rt.def (FFECOM_gfrtSIGNAL): Change return type to + FTNINT to match actual code. + + * com.c (ffecomRttype_): Replace FFECOM_rttypeINT_ with + FFECOM_rttypeFTNINT_. + Add and fix up comments. + (ffecom_make_gfrt_, ffecom_gfrt_basictype, + ffecom_gfrt_kindtype): Replace FFECOM_rttypeINT_ with + FFECOM_rttypeFTNINT_; add FFECOM_rttypeDOUBLEREAL_. + +Thu Aug 21 13:15:29 1997 Jim Wilson <wilson@cygnus.com> + + * Make-lang.in (f77): Delete f77-runtime. + (f77.all.build, f77.all.cross, f77.rest.encap): Add f77-runtime. + +Wed Aug 20 17:18:40 1997 Craig Burley <burley@gnu.ai.mit.edu> + + * global.c (ffeglobal_ref_progunit_): It's okay to have + a different CHARACTER*n length for a reference if the + existing length is for another reference, not a definition. + +Wed Aug 20 16:36:59 1997 Jim Wilson <wilson@cygnus.com> + + * intdoc.texi: Readd generated file. + +Mon Aug 18 14:27:18 1997 Craig Burley <burley@gnu.ai.mit.edu> + + Fix 970814-0.f: + * global.c (ffeglobal_new_progunit_): Distinguish + between previously defined, versus inferred, filewide + when it comes to diagnostics. + + Fix 970816-1.f: + * global.c (ffeglobal_ref_progunit_): Change BDATA into EXT + right at the beginning, so EXTERNAL FOO followed later + by SUBROUTINE FOO is not diagnosed. + + Fix 970813-0.f: + * com-rt.def (FFECOM_gfrtALARM): Returns `integer', not + `void'. + +Mon Aug 18 09:01:54 1997 Jeffrey A Law (law@cygnus.com) + + * Makefile.in (F77_OBJS): Re-alphabetize. + * Make-lang.in (F77_SRCS): Likewise. + +Sun Aug 17 08:35:11 1997 Jeffrey A Law (law@cygnus.com) + + * INSTALL: Rebuilt. + * install.texi: Remove "Object File Differences" section. Remove + all references to zzz.o failing comparison tests. + * version.c, version.h: Renamed from zzz.c and zzz.h. Remove + date and time stamps so a 3 stage build reports no differences. + * Make-lang.in: Corresponding changes. + * Makefile.in: Likewise. + * g77.c, parse.c: Likewise. + + * intdoc.texi: Remove generated file from distribution. + +Sun Aug 17 03:32:44 1997 Craig Burley <burley@gnu.ai.mit.edu> + + Fix up problems when virtual memory exhausted: + * malloc.c (malloc_new_): Use gcc's xmalloc(), so we + print a nicer message when malloc returns no memory. + (malloc_resize_): Ditto for xrealloc(). + + * Make-lang.in, Makefile.in: Comment out lines containing + just formfeeds. + +Sat Aug 16 19:41:33 1997 Craig Burley <burley@gnu.ai.mit.edu> + + * com.c (ffecom_make_gfrt_): For rttypeREAL_F2C_, return + double_type_node; for rttypeREAL_GNU_, return + _real_type_node. + +1997-08-13 Dave Love <d.love@dl.ac.uk> + + * config-lang.in (diff_excludes): Add some hints about known + problematic platforms. + +1997-08-13 Dave Love <d.love@dl.ac.uk> + + * intdoc.h: Document `alarm'. + +Tue Aug 12 10:23:02 1997 Jeffrey A Law (law@cygnus.com) + + * config-lang.in: Don't demand the backend patch. + * com.c (lang_printable_name): Second argument is now an int. Don't + store into the value of the second argument. + * top.c (ffe_decode_option): Temporarily disable setting + of "Toon" loop options until we figure out how to address + them. + +Mon Aug 11 23:18:35 1997 Jeffrey A Law (law@cygnus.com) + + * g77-0.5.21-19970811 Imported. + This file describes changes to the front end necessary to make + it work with egcs. + +Mon Aug 11 21:19:22 1997 Craig Burley <burley@gnu.ai.mit.edu> + + * Make-lang.in ($(RUNTIMESTAGESTUFF)): Add + f/runtime/stamp-lib. + +Mon Aug 11 01:52:03 1997 Craig Burley <burley@gnu.ai.mit.edu> + + * com.c (ffecom_build_complex_constant_): Go with the + new build_complex() approach used in gcc-2.8. + + * com.c (ffecom_sym_transform_): Don't set + DECL_IN_SYSTEM_HEADER for a tree node that isn't + a VAR_DECL, which happens when var is in common! + + * com.c (ffecom_expr_intrinsic_) (case FFEINTRIN_impALARM): + No need to test codegen_imp -- there's only one valid here. + + * intrin.def (FFEINTRIN_impALARM): Specify `Status' argument + as write-only. + +Fri Aug 8 05:40:23 1997 Craig Burley <burley@gnu.ai.mit.edu> + + Substantial changes to accommodate distinctions among + run-time routines that support intrinsics, and between + routines that compute and return the same type vs. those + that compute one type and return another (or `void'): + * com-rt.def: Specify new return type REAL_F2C_ instead + of many DOUBLE_, COMPLEX_F2C_ instead of COMPLEX_, and + so on. + Clear up the *BES* routines "once and for all". + * com.c: New return types. + (ffecom_convert_narrow_, ffecom_convert_widen_): + New functions that are "safe" variants of convert(), + to catch errors that ffecom_expr_intrinsic_() now + no longer catches. + (ffecom_arglist_expr_): Ensure arguments are not + converted to narrower types. + (ffecom_call_): Ensure return value is not converted + to a wider type. + (ffecom_char_args_): Use new ffeintrin_gfrt_direct() + routine. + (ffecom_expr_intrinsic_): Simplify how run-time + routine is selected (via `gfrt' only now; lose the + redundant `ix' variable). + Eliminate the `library' label; any code that doesn't + return directly just `break's out now with `gfrt' + set appropriately. + Set `gfrt' to default choice initially, either a + fast direct form or, if not available, a slower + indirect-callable form. + (ffecom_make_gfrt_): No longer need to do special + check for complex; it's built into the new return-type + regime. + (ffecom_ptr_to_expr): Use new ffeintrin_gfrt_indirect() + routine. + * intrin.c, intrin.h: `gfrt' field replaced with three fields, + so it is easier to provide faster direct-callable and + GNU-convention indirect-callable routines in the future. + DEFIMP macro adjusted accordingly, along with all its uses. + (ffeintrin_gfrt_direct): New function. + (ffeintrin_gfrt_indirect): Ditto. + (ffeintrin_is_actualarg): If `-fno-f2c' is in effect, + require a GNU-callable version of intrinsic instead of + an f2c-callable version, so indirect calling is still checked. + * intrin.def: Replace one GFRT field with the three new fields, + as appropriate for each DEFIMP intrinsic. + + * com.c (ffecom_stabilize_aggregate_, + ffecom_convert_to_complex_): Make these `static'. + +Thu Aug 7 11:24:34 1997 Craig Burley <burley@gnu.ai.mit.edu> + + Provide means for front end to determine actual + "standard" return type for an intrinsic if it is + passed as an actual argument: + * com.h, com.c (ffecom_gfrt_basictype, + ffecom_gfrt_kindtype): New functions. + (ffecom_gfrt_kind_type_): Replaced with new function. + All callers updated. + (ffecom_make_gfrt_): No longer need do anything + with kind type. + + * intrin.c (ffeintrin_basictype, ffeintrin_kindtype): + Now returns correct type info for specific intrinsic + (based on type of run-time-library implementation). + +Wed Aug 6 23:08:46 1997 Craig Burley <burley@gnu.ai.mit.edu> + + * global.c (ffeglobal_ref_progunit_): Don't reset + number of arguments just due to new type info, + so useful warnings can be issued. + +1997-08-06 Dave Love <d.love@dl.ac.uk> + + * intrin.def: Fix IDATE_vxt argument order. + * intdoc.h: Likewise. + +Thu Jul 31 22:22:03 1997 Craig Burley <burley@gnu.ai.mit.edu> + + * global.c (ffeglobal_proc_ref_arg): If REF/DESCR + disagreement, DESCR is CHARACTER, and types disagree, + pretend the argsummary agrees so the message ends up + being about type disagreement. + (ffeglobal_proc_def_arg): Ditto. + + * expr.c (ffeexpr_token_first_rhs_3_): Set info for LABTOK + to NONE of everything, to avoid misdiagnosing filewide + usage of alternate returns. + +Sun Jul 20 23:07:47 1997 Craig Burley <burley@gnu.ai.mit.edu> + + * com.c (ffecom_sym_transform_): If type gets set + to error_mark_node, just return that for transformed symbol. + (ffecom_member_phase2_): If type gets set to error_mark_node, + just return. + (ffecom_check_size_overflow_): Add `dummy' argument to + flag that type is for a dummy, update all callers. + +Sun Jul 13 17:40:53 1997 Craig Burley <burley@gnu.ai.mit.edu> + + Fix 970712-1.f: + * where.c (ffewhere_set_from_track): If start point + is too large, just use initial start point. 0.6 should + fix all this properly. + + Fix 970712-2.f: + * com.c (ffecom_sym_transform_): Preserve error_mark_node for type. + (ffecom_type_localvar_): Ditto. + (ffecom_sym_transform_): If type is error_mark_node, + don't error-check decl size, because back end responds by + setting that to an integer 0 instead of error_mark_node. + (ffecom_transform_common_): Same as earlier fix to _transform_ + in that size is checked by dividing BITS_PER_UNIT instead of + multiplying. + (ffecom_transform_equiv_): Ditto. + + Fix 970712-3.f: + * stb.c (ffestb_R10014_): Fix flaky fall-through in error + test for FFELEX_typeCONCAT by just replicating the code, + and do FFELEX_typeCOLONCOLON while at it. + +1997-07-07 Dave Love <d.love@dl.ac.uk> + + * intdoc.h: Add various missing pieces; correct GMTIME, LTIME + result ordering. + + * intrin.def, com-rt.def: Add alarm. + + * com.c (ffecom_expr_intrinsic_): Add case for alarm. + +Thu Jun 26 04:19:40 1997 Craig Burley <burley@gnu.ai.mit.edu> + + Fix 970302-3.f: + * com.c (ffecom_sym_transform_): For sanity-check compare + of gbe size of local variable to g77 expectation, + use varasm.c/assemble_variable technique of dividing + BITS_PER_UNIT out of gbe info instead of multiplying + g77 info up, to avoid crash when size in bytes is very + large, and overflows an `int' or similar when multiplied. + + Fix 970626-2.f: + * com.c (ffecom_finish_symbol_transform_): Don't bother + transforming a dummy argument, to avoid a crash. + * ste.c (ffeste_R1227): Don't return a value if the + result decl, or its type, is error_mark_node. + + Fix 970626-4.f: + * lex.c (ffelex_splice_tokens): `-fdollar-ok' is + irrelevant to whether a DOLLAR token should be made + from an initial character of `$'. + + Fix 970626-6.f: + * stb.c (ffestb_do3_): DO iteration variable is an + lhs, not rhs, expression. + + Fix 970626-7.f and 970626-8.f: + * expr.c (ffeexpr_cb_comma_i_1_): Set IMPDO expression + to have clean info, because undefined rank, for example, + caused crash on mangled source on UltraSPARC but not + on Alpha for a series of weird reasons. + (ffeexpr_cb_close_paren_): If not CLOSE_PAREN, push + opANY expression onto stack instead of attempting + to mimic what program might have wanted. + (ffeexpr_cb_close_paren_): Don't wrap opPAREN around + opIMPDO, just warn that it's gratuitous. + * bad.def (FFEBAD_IMPDO_PAREN): New warning. + + Fix 970626-9.f: + * expr.c (ffeexpr_declare_parenthesized_): Must shut down + parsing in kindANY case, otherwise the parsing engine might + decide there's an ambiguity. + (ffeexpr_token_name_rhs_): Eliminate parentypeSUBROUTINE_ + case, so we crash right away if it comes through. + * st.c, st.h, sta.c, sta.h (ffest_shutdown, ffesta_shutdown): + New functions. + +Tue Jun 24 19:47:29 1997 Craig Burley <burley@gnu.ai.mit.edu> + + * com.c (ffecom_check_size_overflow_): New function + catches some cases of the size of a type getting + too large. varasm.c must catch the rest. + (ffecom_sym_transform_): Use new function. + (ffecom_type_localvar_): Ditto. + +Mon Jun 23 01:09:28 1997 Craig Burley <burley@gnu.ai.mit.edu> + + * global.c (ffeglobal_proc_def_arg): Fix comparison + of argno to #args. + (ffeglobal_proc_ref_arg): Ditto. + + * lang-options.h, top.c: Rename `-fdebug' to `-fxyzzy', + since it's an unsupported internals option and some + poor user might guess that it does something. + + * bad.def: Make a warning for each filewide diagnostic. + Put all filewides together. + * com.c (ffecom_sym_transform_): Don't substitute + known global tree for global entities when `-fno-globals'. + * global.c (ffeglobal_new_progunit_): Don't produce + fatal diagnostics about globals when `-fno-globals'. + Instead, produce equivalent warning when `-Wglobals'. + (ffeglobal_proc_ref_arg): Ditto. + (ffeglobal_proc_ref_nargs): Ditto. + (ffeglobal_ref_progunit_): Ditto. + * lang-options.h, top.c, top.h: New `-fno-globals' option. + +Sat Jun 21 12:32:54 1997 Craig Burley <burley@gnu.ai.mit.edu> + + * expr.c (ffeexpr_fulfill_call_): Set array variable + to avoid warning about uninitialized variable. + + * Make-lang.in: Get rid of any setting of HOST_* macros, + since these will break gcc's build! + * makefile: New file to make building derived files + easier. + +Thu Jun 19 18:19:28 1997 Craig Burley <burley@gnu.ai.mit.edu> + + * g77.c (main): Install Emilio Lopes' patch to support + Ratfor, and to fix the printing of the version string + to go to stderr, not stdout. + * lang-specs.h: Install Emilio Lopes' patch to support + Ratfor, and patch the result to support picking up + `*f771' from the `specs' file. + +Thu Jun 12 14:36:25 1997 Craig Burley <burley@gnu.ai.mit.edu> + + * storag.c (ffestorag_update_init, ffestorag_update_save): + Also update parent, in case equivalence processing + has already eliminated pointers to it via the + local equivalence info. + +Tue Jun 10 14:08:26 1997 Craig Burley <burley@gnu.ai.mit.edu> + + * intdoc.c: Add cross-reference to end of description + of any generic intrinsic pointing to other intrinsics + with the same name. + + Warn about explicit type declaration for intrinsic + that disagrees with invocation: + * expr.c (ffeexpr_paren_rhs_let_): Preserve type info + for intrinsic functions. + (ffeexpr_token_funsubstr_): Ditto. + * intrin.c (ffeintrin_fulfill_generic): Warn if type + info of fulfilled intrinsic invocation disagrees with + explicit type info given symbol. + (ffeintrin_fulfill_specific): Ditto. + * stc.c (ffestc_R1208_item): Preserve type info + for intrinsics. + (ffestc_R501_item): Ditto. + +Mon Jun 9 17:45:44 1997 Craig Burley <burley@gnu.ai.mit.edu> + + * com.c (ffecom_expr_intrinsic_): Fix several of the + libU77/libF77-unix handlers to properly convert their + arguments. + + * com-rt.def (FFECOM_gfrtFSTAT): Append missing "i" to + arg string. + +Fri Jun 6 14:37:30 1997 Craig Burley <burley@gnu.ai.mit.edu> + + * com.c (ffecom_expr_intrinsic_): Have a case statement + for every intrinsic implementation, so missing ones + are caught via gcc warnings. + Don't call ffeintrin_codegen_imp anymore. + * intrin.c (ffeintrin_fulfill_generic): Remove cg_imp + stuff from here. + (ffeintrin_codegen_imp): Delete this function. + * intrin.def, intrin.h: Remove DEFIMQ stuff from here + as well. + +Thu Jun 5 13:03:07 1997 Craig Burley <burley@gnu.ai.mit.edu> + + * top.c (ffe_decode_option): New -fbadu77-intrinsics-* + options. + * top.h: Ditto. + * intrin.h: New BADU77 family. + * intrin.c (ffeintrin_state_family): Ditto. + + Implement new scheme to track intrinsic names vs. forms: + * intrin.c (ffeintrin_fulfill_generic), + (ffeintrin_fulfill_specific), (ffeintrin_is_intrinsic), + intrin.def: The documented name is now either in the + generic info or, if no generic, in the specific info. + For a generic, the specific info contains merely the + distinguishing form (usually "function" or "subroutine"), + used for diagnostics about ambiguous references and + in the documentation. + + * intrin.def: Clean up formatting of DEFNAME block. + Convert many libU77 intrinsics into generics that + support both subroutine and function forms. + Put the function forms of side-effect routines into + the new BADU77 family. + Make MCLOCK and TIME return INTEGER*4 again, and add + INTEGER*8 equivalents called MCLOCK8 and TIME8. + Fix up more status return values to be written and + insist on them being I1 as well. + * com.c (ffecom_expr_intrinsic_): Lots of changes to + support new libU77 intrinsic interfaces. + +Mon Jun 2 00:37:53 1997 Craig Burley <burley@gnu.ai.mit.edu> + + * com.c (ffecom_init_0): Pointer type is now INTEGER(KIND=7), + not INTEGER(KIND=0), since we want to reserve KIND=0 for + future use. + +Thu May 29 14:30:33 1997 Craig Burley <burley@gnu.ai.mit.edu> + + Fix bugs preventing CTIME(I*4) from working correctly: + * com.c (ffecom_char_args_): For FUNCREF case, process + args to intrinsic just as they would be in + ffecom_expr_intrinsic_. + * com-rt.def (FFECOM_gfrtCTIME, FFECOM_gfrtTTYNAM): Fix + argument decls to specify `&'. + +Wed May 28 22:19:49 1997 Craig Burley <burley@gnu.ai.mit.edu> + + Fix gratuitous warnings exposed by dophot aka 970528-1: + * global.c (ffeglobal_proc_def_arg, ffeglobal_proc_ref_arg): + Support distinct function/subroutine arguments instead of + just procedures. + * global.h: Ditto. + * expr.c (ffeexpr_fulfill_call_): A SYMTER with kindNONE + also is a procedure (either function or subroutine). + +Mon May 26 20:25:31 1997 Craig Burley <burley@gnu.ai.mit.edu> + + * bad.def: Have several lexer diagnostics refer to + documentation for people who need more info on what Fortran + source code is supposed to look like. + + * expr.c (ffeexpr_reduced_bool1_), bad.def: New diagnostics + specific to .NOT. now mention only one operand instead + of two. + + * g77.c: Recognize -fsyntax-only, similar to -c etc. + (lookup_option): Fix bug that prevented non-`--' options + from being recognized. + +Sun May 25 04:29:04 1997 Craig Burley <burley@gnu.ai.mit.edu> + + * intrin.def (FFEINTRIN_impCTIME): Accept `I*' expression + for STime instead of requiring `I2'. + +Tue May 20 16:14:40 1997 Craig Burley <burley@gnu.ai.mit.edu> + + * symbol.c (ffesymbol_reference): All references to + standard intrinsics are considered explicit, so as + to avoid generating basically useless warnings. + * intrin.c, intrin.h (ffeintrin_is_standard): Returns TRUE + if intrinsic is standard. + +Sun May 18 21:14:59 1997 Craig Burley <burley@gnu.ai.mit.edu> + + * com-rt.def: Changed all external names of the + form `"\([a-z0-9]*\)_' to `"G77_\1_0"' so as to + allow any name valid as an intrinsic to be used + as such and as a user-defined external procedure + name or common block as well. + +Thu May 8 13:07:10 1997 Craig Burley <burley@gnu.ai.mit.edu> + + * expr.c (ffeexpr_cb_end_notloc_): For %VAL, %REF, and + %DESCR, copy arg info into new node. + +Mon May 5 14:42:17 1997 Craig Burley <burley@gnu.ai.mit.edu> + + From Uwe F. Mayer <mayer@math.Vanderbilt.Edu>: + * Make-lang.in (g77-cross): Fix typo in g77.c path. + + From Brian McIlwrath <bkm@star.rl.ac.uk>: + * lang-specs.h: Have g77 pick up options from a section + labeled `*f771' of the `specs' file. + +Sat May 3 02:46:08 1997 Craig Burley <burley@gnu.ai.mit.edu> + + * intrin.def (FFEINTRIN_defSIGNAL): Add optional `Status' + argument that com.c already expects (per Dave Love). + + More changes to support better tracking of (filewide) + globals, in particular, the arguments to procedures: + * bad.def (FFEBAD_FILEWIDE_NARGS, FFEBAD_FILEWIDE_NARGS_W, + FFEBAD_FILEWIDE_ARG, FFEBAD_FILEWIDE_ARG_W): New diagnostics. + * expr.c (ffebad_fulfill_call_): Provide info on each + argument to ffeglobal. + * global.c, global.h (ffeglobal_proc_def_arg, + ffeglobal_proc_def_nargs, ffeglobal_proc_ref_arg, + ffeglobal_proc_ref_args): New functions. + (ffeglobalArgSummary, ffeglobalArgInfo_): New types. + +Tue Apr 29 18:35:41 1997 Craig Burley <burley@gnu.ai.mit.edu> + + More changes to support better tracking of (filewide) + globals: + * expr.c (ffeexpr_fulfill_call_): New function. + (ffeexpr_token_name_lhs_): Call after building procedure + reference expression. Also leave info field for ANY-ized + expression alone. + (ffeexpr_token_arguments_): Ditto. + +Mon Apr 28 20:04:18 1997 Craig Burley <burley@gnu.ai.mit.edu> + + Changes to support better tracking of (filewide) + globals, mainly to avoid crashes due to inlining: + * bad.def: Go back to quoting intrinsic names, + (FFEBAD_FILEWIDE_DISAGREEMENT, FFEBAD_FILEWIDE_TIFF, + FFEBAD_FILEWIDE_TYPE_MISMATCH): New diagnostics. + (FFEBAD_INTRINSIC_EXPIMP, FFEBAD_INTRINSIC_GLOBAL): Reword + for clarity. + * com.c (ffecom_do_entry_, ffecom_start_progunit_, + ffecom_sym_transform_): Accommodate new FFEGLOBAL_typeEXT + possibility. + * expr.c (ffeexpr_sym_lhs_call_, ffeexpr_sym_lhs_extfunc_, + ffeexpr_sym_rhs_actualarg_, ffeexpr_declare_parenthesized_, + ffeexpr_paren_rhs_let_, ffeexpr_token_funsubstr_): + Fill in real kind info instead of leaving NONE where + appropriate. + Register references to intrinsics and globals with ffesymbol + using new ffesymbol_reference function instead of + ffesymbol_globalize. + * global.c (ffeglobal_type_string_): New array for + new diagnostics. + * global.h, global.c: + Replace ->init mechanism with ->tick mechanism. + Move other common-related members into a substructure of + a union, so the proc substructure can be introduced + to include members related to externals other than commons. + Don't complain about ANY-ized globals; ANY-ize globals + once they're complained about, in any case where code + generation could become a problem. + Handle global entries that have NONE type (seen as + intrinsics), EXT type (seen as EXTERNAL), and so on. + Keep track of kind and type of externals, both via + definition and via reference. + Diagnose disagreements about kind or type of externals + (such as functions). + (ffeglobal_ref_intrinsic, ffeglobal_ref_progunit_): New + functions. + * stc.c (ffestc_R1207_item, ffestc_R1208_item, + ffestc_R1219, ffestc_R1226): + Call ffesymbol_reference, not ffesymbol_globalize. + * stu.c (ffestu_sym_end_transition, + ffestu_sym_exec_transition): + Call ffesymbol_reference, not ffesymbol_globalize. + * symbol.c (ffesymbol_globalize): Removed... + (ffesymbol_reference): ...to this new function, + which more generally registers references to symbols, + globalizes globals, and calls on the ffeglobal module + to check globals filewide. + + * global.h, global.c: Rename some macros and functions + to more clearly distinguish common from other globals. + All callers changed. + + * com.c (ffecom_sym_transform_): Trees describing + filewide globals must be allocated on permanent obstack. + + * expr.c (ffeexpr_token_name_lhs_): Don't generate + gratuitous diagnostics for FFEINFO_whereANY case. + +Thu Apr 17 03:27:18 1997 Craig Burley <burley@gnu.ai.mit.edu> + + * global.c: Add support for flagging intrinsic/global + confusion via warnings. + * bad.def (FFEBAD_INTRINSIC_EXPIMP, + FFEBAD_INTRINSIC_GLOBAL): New diagnostics. + * expr.c (ffeexpr_token_funsubstr_): Ditto. + (ffeexpr_sym_lhs_call_): Ditto. + (ffeexpr_paren_rhs_let_): Ditto. + * stc.c (ffestc_R1208_item): Ditto. + +Wed Apr 16 22:40:56 1997 Craig Burley <burley@gnu.ai.mit.edu> + + * expr.c (ffeexpr_declare_parenthesized_): INCLUDE + context can't be an intrinsic invocation either. + +Fri Mar 28 10:43:28 1997 Craig Burley <burley@gnu.ai.mit.edu> + + * expr.c (ffeexpr_token_arguments_): Make sure top of + exprstack is operand before dereferencing operand field. + + * lex.c (ffelex_prepare_eos_): Fill up truncated + hollerith token, so crash on null ->text field doesn't + happen later. + + * stb.c (ffestb_R10014_): If NAMES isn't recognized (or + the recognized part is followed in the token by a + non-digit), don't try and collect digits, as there + might be more than FFEWHERE_indexMAX letters to skip + past to do so -- and the code is diagnosed anyway. + +Thu Mar 27 00:02:48 1997 Craig Burley <burley@gnu.ai.mit.edu> + + * com.c (ffecom_sym_transform_): Force local + adjustable array onto stack. + + * stc.c (ffestc_R547_item_object): Don't actually put + the symbol in COMMON if the symbol has already been + EQUIVALENCE'd to a different COMMON area. + + * equiv.c (ffeequiv_add): Don't actually do anything + if there's a disagreement over which COMMON area is + involved. + +Tue Mar 25 03:35:19 1997 Craig Burley <burley@gnu.ai.mit.edu> + + * com.c (ffecom_transform_common_): If no explicit init + of COMMON area, don't actually init it even though + storage area suggests it. + +Mon Mar 24 12:10:08 1997 Craig Burley <burley@gnu.ai.mit.edu> + + * lex.c (ffelex_image_char_): Avoid overflowing the + column counter itself, as well as the card image. + + * where.c (ffewhere_line_new): Cast ffelex_line_length() + to (size_t) so 255 doesn't overflow to 0! + + * stc.c (ffestc_labeldef_notloop_begin_): Don't gratuitously + terminate loop before processing statement, so block + doesn't disappear out from under EXIT/CYCLE processing. + (ffestc_labeldef_notloop_): Has old code from above + function, instead of just calling it. + + * expr.c (ffeexpr_cb_comma_i_4_): Don't skip over + arbitrary token (such as EOS). + + * com.c (ffecom_init_zero_): Handle RECORD_TYPE and + UNION_TYPE so -fno-zeros works with -femulated-complex. + +1997-03-12 Dave Love <d.love@dl.ac.uk> + + * intrin.def: New intrinsics INT2, INT8, CPU_TIME. Fix AND, OR, + XOR. [Integrated by burley, AND/OR/XOR already fixed, INT8 + implementation changed/fixed.] + +Wed Mar 12 10:40:08 1997 Craig Burley <burley@gnu.ai.mit.edu> + + * Make-lang.in ($(srcdir)/f/intdoc.texi): Simplify rules + so building f/intdoc is not always necessary; remove + f/intdoc after running it if it is built. + +Tue Mar 11 23:42:00 1997 Craig Burley <burley@gnu.ai.mit.edu> + + * intrin.def (FFEINTRIN_impAND, FFEINTRIN_impOR, + FFEINTRIN_impXOR): Use the IAND, IOR, and IEOR implementations + of these, instead of crashing in ffecom_expr_intrinsic_ + or adding case labels there. + +Mon Mar 10 22:51:23 1997 Craig Burley <burley@gnu.ai.mit.edu> + + * intdoc.c: Fix so any C compiler can compile this. + +Fri Feb 28 13:16:50 1997 Craig Burley <burley@gnu.ai.mit.edu> + + * Version 0.5.20 released. + +Fri Feb 28 01:45:25 1997 Craig Burley <burley@gnu.ai.mit.edu> + + * Make-lang.in (RUNTIMESTAGESTUFF, LIBU77STAGESTUFF): + Move some files incorrectly in the former to the latter, + and add another file or two to the latter. + + New meanings for (KIND=n), and new denotations in the + little language describing intrinsics: + * com.c (ffecom_init_0): Assign new meanings. + * intdoc.c: Document new meanings. + Support the new denotations. + * intrin.c: Employ new meanings, mapping them to internal + values (which are the same as they ever were for now). + Support the new denotations. + * intrin.def: Switch DEFIMP table to the new denotations. + + * intrin.c (ffeintrin_check_): Fix bug that was leaving + LOC() and %LOC() returning INTEGER*4 on systems where + it should return INTEGER*8. + + * type.c: Canonicalize function definitions, for etags + and such. + +Wed Feb 26 20:43:03 1997 Craig Burley <burley@gnu.ai.mit.edu> + + * com.c (ffecom_init_0): Choose INTEGER(KIND=n) types, + where n is 2, 3, and 4, according to the new docs + instead of according to the old C correspondences + (which seem less useful at this point). + + * equiv.c (ffeequiv_destroy_): New function. + (ffeequiv_layout_local_): Use this new function + whenever the laying out of a local equivalence chain + is aborted for any reason. + Otherwise ensure that symbols no longer reference + the stale ffeequiv entries that result when they + are killed off in this procedure. + Also, the rooted symbol is one that has storage, + it really is irrelevant whether it has an equiv entry + at this point (though the code to remove the equiv + entry was put in at the end, just in case). + (ffeequiv_kill): When doing internal checks, make + sure the victim isn't named by any symbols it points + to. Not as complete a check as looking through the + entire symbol table (which does matter, since some + code in equiv.c used to remove symbols from the lists + for an ffeequiv victim but not remove that victim as the + symbol's equiv info), but this check did find some + real bugs in the code (that were fixed). + +Mon Feb 24 16:42:13 1997 Craig Burley <burley@gnu.ai.mit.edu> + + * com.c (ffecom_expr_intrinsic_): Fix a couple of + warnings about uninitialized variables. + * intrin.c (ffeintrin_check_): Ditto, but there were + a couple of _real_ uninitialized-variable _bugs_ here! + (ffeintrin_fulfill_specific): Ditto, no real bug here. + +Sun Feb 23 15:01:20 1997 Craig Burley <burley@gnu.ai.mit.edu> + + Clean up diagnostics (especially about intrinsics): + * bad.def (FFEBAD_UNIMPL_STMT): Remove. + (FFEBAD_INTRINSIC_*, FFEBAD_NEED_INTRINSIC): Clean these + up so they're friendlier. + (FFEBAD_INTRINSIC_CMPAMBIG): New. + * intrin.c (ffeintrin_fulfill_generic, + ffeintrin_fulfill_specific, ffeintrin_is_intrinsic): + Always choose + generic or specific name text (which is for doc purposes + anyway) over implementation name text (which is for + internal use). + * intrin.def: Use more descriptive name texts for generics + and specifics in cases where the names themselves are not + enough (e.g. IDATE, which has two forms). + + Fix some intrinsic mappings: + * intrin.def (FFEINTRIN_specIDINT, FFEINTRIN_specAND, + FFEINTRIN_specDFLOAT, FFEINTRIN_specDREAL, FFEINTRIN_specOR, + FFEINTRIN_specXOR): Now have their own implementations, + instead of borrowing from others. + (FFEINTRIN_specAJMAX0, FFEINTRIN_specAJMIN0, FFEINTRIN_specBJTEST, + FFEINTRIN_specDFLOTJ, FFEINTRIN_specFLOATJ, FFEINTRIN_specJIABS, + FFEINTRIN_specJIAND, FFEINTRIN_specJIBCLR, FFEINTRIN_specJIBITS, + FFEINTRIN_specJIBSET, FFEINTRIN_specJIDIM, FFEINTRIN_specJIDINT, + FFEINTRIN_specJIDNNT, FFEINTRIN_specJIEOR, FFEINTRIN_specJIFIX, + FFEINTRIN_specJINT, FFEINTRIN_specJIOR, FFEINTRIN_specJISHFT, + FFEINTRIN_specJISHFTC, FFEINTRIN_specJISIN, FFEINTRIN_specJMAX0, + FFEINTRIN_specJMAX1, FFEINTRIN_specJMIN0, FFEINTRIN_specJMIN1, + FFEINTRIN_specJMOD, FFEINTRIN_specJNINT, FFEINTRIN_specJNOT,): + Turn these implementations off, since it's not clear + just what types they expect in the context of portable Fortran. + (DFLOAT): Now in FVZ family, since f2c supports them + + Support intrinsic inquiry functions (BIT_SIZE, LEN): + * intrin.c: Allow `i' in <arg_extra>. + * intrin.def (FFEINTRIN_impBIT_SIZE, FFEINTRIN_impLEN): + Mark args with `i'. + +Sat Feb 22 13:34:09 1997 Craig Burley <burley@gnu.ai.mit.edu> + + Only warn, don't error, for reference to unimplemented + intrinsic: + * bad.def (FFEBAD_INTRINSIC_UNIMPLW): Warning version + of _UNIMPL. + * intrin.c (ffeintrin_is_intrinsic): Use new warning + version of _UNIMPL (FFEBAD_INTRINSIC_UNIMPLW). + + Complain about REAL(Z) and AIMAG(Z) (Z is DOUBLE COMPLEX): + * bad.def (FFEBAD_INTRINSIC_CMPAMBIG): New diagnostic. + * expr.c: Needed #include "intrin.h" anyway. + (ffeexpr_token_intrincheck_): New function handles delayed + diagnostic for "REAL(REAL(expr)" if next token isn't ")". + (ffeexpr_token_arguments_): Do most of the actual checking here. + * intrin.h, intrin.c (ffeintrin_fulfill_specific): New + argument, check_intrin, to tell caller that intrin is REAL(Z) + or AIMAG(Z). All callers updated, mostly to pass NULL in + for this. + (ffeintrin_check_): Also has new arg check_intrin for same + purpose. All callers updated the same way. + * intrin.def (FFEINTRIN_impAIMAG): Change return type + from "R0" to "RC", to accommodate f2c (and perhaps other + non-F90 F77 compilers). + * top.h, top.c: New option -fugly-complex. + + New GNU intrinsics REALPART, IMAGPART, and COMPLEX: + * com.c (ffecom_expr_intrinsic_): Implement impCOMPLEX + and impREALPART here. (specIMAGPART => specAIMAG.) + * intrin.def: Add the intrinsics here. + + Rename implementations of VXTIDATE and VXTTIME to IDATEVXT + and TIMEVXT, so they sort more consistently: + * com.c (ffecom_expr_intrinsic_): + * intrin.def: + + Delete intrinsic group `dcp', add `gnu', etc.: + * intrin.c (ffeintrin_state_family): FFEINTRIN_familyGNU + replaces FFEINTRIN_familyDCP, and gets state from `gnu' + group. + Get rid of FFEINTRIN_familyF2Z, nobody needs it. + Move FFEINTRIN_specDCMPLX from DCP family to FVZ family, + as f2c has it. + Move FFEINTRIN_specDFLOAT from F2C family to FVZ family. + (FFEINTRIN_specZABS, FFEINTRIN_specZCOS, FFEINTRIN_specZEXP, + FFEINTRIN_specZLOG, FFEINTRIN_specZSIN, FFEINTRIN_specZSQRT): + Move these from F2Z family to F2C family. + * intrin.h (FFEINTRIN_familyF2Z, FFEINTRIN_familyDCP): Remove. + (FFEINTRIN_familyGNU): Add. + * top.h, top.c: Replace `dcp' with `gnu'. + + * com.c (ffecom_expr_intrinsic_): Clean up by collecting + simple conversions into one nice, conceptual place. + Fix up some intrinsic subroutines (MVBITS, KILL, UMASK) to + properly push and pop call temps, to avoid wasting temp + registers. + + * g77.c (doit): Toon says variables should be defined + before being referenced. Spoilsport. + + * intrin.c (ffeintrin_check_): Now Dave's worried about + warnings about uninitialized variables. Okay, so for + basic return values 'g' and 's', they _were_ + uninitialized -- is determinism really _that_ useful? + + * intrin.def (FFEINTRIN_impFGETC): Fix STATUS argument + so that it is INTENT(OUT) instead of INTENT(IN). + +1997-02-21 Dave Love <d.love@dl.ac.uk> + + * intrin.def, com.c: Support Sun-type `short' and `long' + intrinsics. Perhaps should also do Microcruft-style `int2'. + +Thu Feb 20 15:16:53 1997 Craig Burley <burley@gnu.ai.mit.edu> + + * com.c (ffecom_expr_intrinsic_): Clean up indentation. + Support SECONDSUBR intrinsic implementation. + Rename SECOND to SECONDFUNC for direct support via library. + + * g77.c: Fix to return proper status value to shell, + by obtaining it from processes it spawns. + + * intdoc.c: Fix minor typo. + + * intrin.def: Turn SECOND into generic that maps into + function and subroutine forms. + + * intrin.def: Make FLOAT and SNGL into specific intrinsics. + + * intrin.def, intrin.h: Change the way DEFGEN and DEFSPEC + macros work, to save on verbage. + +Mon Feb 17 02:08:04 1997 Craig Burley <burley@gnu.ai.mit.edu> + + New subsystem to automatically generate documentation + on intrinsics: + * Make-lang.in ($(srcdir)/f/g77.info, + $(srcdir)/f/g77.dvi): Move g77 doc rules around. + Add to g77 doc rules the new subsystem. + (f77.mostlyclean, f77.maintainer-clean): Also clean up + after new doc subsystem. + * intdoc.c, intdoc.h: New doc subsystem code. + * intrin.h [FFEINTRIN_DOC]: When 1, don't pull in + stuff not needed by doc subsystem. + + Improve on intrinsics mechanism to both be more + self-documenting and to catch more user errors: + * intrin.c (ffeintrin_check_): Recognize new arg-len + and arg-rank information, and check it. + Move goto and signal indicators to the basic type. + Permit reference to arbitrary argument number, not + just first argument (for BESJN and BESYN). + (ffeintrin_init_0): Check and accept new notations. + * intrin.c, intrin.def: Value in COL now identifies + arguments starting with number 0 being the first. + + Some minor intrinsics cleanups (resulting from doc work): + * com.c (ffecom_expr_intrinsic_): Implement FLUSH + directly once again, handle its optional argument, + so it need not be a generic (awkward to handle in docs). + * intrin.def (BESJ0, BESJ1, BESJN, BESY0, BESY1, BESYN, + CHDIR, CHMOD, CTIME, DBESJ0, DBESJ1, DBESJN, DBESY0, + DBESY1, DBESYN, DDIM, ETIME, FGETC, FNUM, FPUTC, FSTAT, + GERROR, GETCWD, GETGID, GETLOG, GETPID, GETUID, GMTIME, + HOSTNM, IDATE, IERRNO, IIDINT, IRAND, ISATTY, ITIME, JIDINT, + LNBLNK, LSTAT, LTIME, MCLOCK, PERROR, SRAND, SYMLNK, TTYNAM, + UMASK): Change capitalization of initcaps (official) name + to be consistent with Burley's somewhat arbitrary rules. + (BESJN, BESYN): These have return arguments of same type + as their _second_ argument. + (FLUSH): Now a specific, not generic, intrinsic, with one + optional argument. + (FLUSH1): Eliminated. + Add arg-len and arg-rank info to several intrinsics. + (ITIME): Change argument type from REAL to INTEGER. + +Tue Feb 11 14:04:42 1997 Craig Burley <burley@gnu.ai.mit.edu> + + * Make-lang.in (f771): Invocation of Makefile now done + with $(srcdir)=gcc to go along with $(VPATH)=gcc. + ($(srcdir)/f/runtime/configure, + $(srcdir)/f/runtime/libU77/configure): Break these out + so spurious triggers of this rule don't happen (as when + configure.in is more recent than libU77/configure). + (f77.rebuilt): Distinguish source versus build files, + so this target can be invoked from build directory and + still work. + * Makefile.in: This now expects $(srcdir) to be the gcc + source directory, not gcc/f, to agree with $(VPATH). + Accordingly, $(INCLUDES) has been fixed, various cruft + removed, the removal of f771 has been fixed to remove + the _real_ f771 (not the one in gcc's parent directory), + and so on. + + * lex.c: Part of ffelex_finish_statement_() now done + by new function ffelex_prepare_eos_(), so that, in one + popular case, the EOS can be prepared while the pointer + is at the end of the non-continued line instead of the + end of the line that marks no continuation. This improves + the appearance of diagnostics substantially. + +Mon Feb 10 12:44:06 1997 Craig Burley <burley@gnu.ai.mit.edu> + + * Make-lang.in: runtime Makefile's, and include/f2c.h, + also depend on f/runtime/configure and f/runtime/libU77/configure. + + Fix various libU77 routines: + * com-rt.def (FFECOM_gfrtCTIME, FFECOM_gfrtMCLOCK, + FFECOM_gfrtTIME): These now use INTEGER*8 for time values, + for compatibility with systems like Alpha. + (FFECOM_gfrtSYSTEM_CLOCK, FFECOM_gfrtTTYNAM): Delete incorrect + trailing underscore in routine names. + * intrin.c, intrin.def: Support INTEGER*8 return values and + arguments ('4'). Change FFEINTRIN_impCTIME, FFEINTRIN_impMCLOCK, + and FFEINTRIN_impTIME accordingly. + (ffeintrin_is_intrinsic): Don't give caller a clue about + form of intrinsic -- shouldn't be needed at this point. + + Cope with generic intrinsics that are subroutines and functions: + * com.c (ffecom_finish_symbol_transform_, ffecom_expr_transform_): + Don't transform an intrinsic that is not known to be a subroutine + or a function. (Maybe someday have to avoid transforming + any intrinsic with an undecided or unknown implementation.) + * expr.c (ffeexpr_declare_unadorned_, + ffeexpr_declare_parenthesized_): Ok to invoke generic + intrinsic that has at least one subroutine form as a + subroutine. + Ok to pass intrinsic as actual arg if it has a known specific + intrinsic form that is valid as actual arg. + (ffeexpr_declare_parenthesized_): An unknown kind of + intrinsic has a paren_type chosen based on context. + (ffeexpr_token_arguments_): Build funcref/subrref based + on context, not on kind of procedure being called. + * intrin.h, intrin.c (ffeintrin_is_intrinsic): Undo changes of + Tue Feb 4 23:12:04 1997 by me, change all callers to leave + intrinsics as FFEINFO_kindNONE at this point. (Some callers + also had unused variables deleted as a result.) + + Enable all intrinsic groups (especially f90 and vxt): + * target.h (FFETARGET_defaultSTATE_DCP, FFETARGET_defaultSTATE_F2C, + FFETARGET_defaultSTATE_F90, FFETARGET_defaultSTATE_MIL, + FFETARGET_defaultSTATE_UNIX, FFETARGET_defaultSTATE_VXT): + Delete these macros, let top.c set them directly. + * top.c (ffeintrinsic_state_dcp_, ffe_intrinsic_state_f2c_, + ffe_intrinsic_state_f90_, ffe_intrinsic_state_mil_, + ffe_intrinsic_state_unix_, ffe_intrinsic_state_vxt_): + Enable all these directly. + +Sat Feb 8 03:21:50 1997 Craig Burley <burley@gnu.ai.mit.edu> + + * g77.c: Incorporate recent changes to ../gcc.c. + For version magic (e.g. `g77 -v'), instead of compiling + /dev/null, write, compile, run, and then delete a small + program that prints the version numbers of the three + components of libf2c (libF77, libI77, and libU77), + so we get this info with bug reports. + Also, this change reduces the chances of accidentally + linking to an old (complex-alias-problem) libf2c. + Fix `-L' so the argument is expected in `-Larg'. + + * com.h (FFECOM_f2cLONGINT): For INTEGER*8 support in f2c.h, + dynamically determine proper type here, instead of + assuming `long long int' is correct. + +Tue Feb 4 23:12:04 1997 Craig Burley <burley@gnu.ai.mit.edu> + + Add libU77 library from Dave Love <d.love@dl.ac.uk>: + * Make-lang.in (f77-runtime): Depend on new Makefile. + (f/runtime/libU77/Makefile): New rule. + Also configure libU77. + ($(srcdir)/f/runtime/configure: Use Makefile.in, + so configuration doesn't have to have happened. + (f77.mostlyclean, f77.clean, f77.distclean, + f77.maintainer-clean): Some fixups here, but more work + needed. + (RUNTIMESTAGESTUFF): Add libU77's config.status. + (LIBU77STAGESTUFF, f77.stage1, f77.stage2, f77.stage3, + f77.stage4): New macro, appropriate uses added. + * com-rt.def: Add libU77 procedures. + * com.c (ffecom_f2c_ptr_to_integer_type_node, + ffecom_f2c_ptr_to_real_type_node): New type nodes. + (FFECOM_rttypeCHARACTER_): New type of run-time function. + (ffecom_char_args_): Handle CHARACTER*n intrinsics + where n != 1 here, instead of in ffecom_expr_intrinsic_. + (ffecom_expr_intrinsic_): New code to handle new + intrinsics. + In particular, change how FFEINTRIN_impFLUSH is handled. + (ffecom_make_gfrt_): Handle new type of run-time function. + (ffecom_init_0): Initialize new type nodes. + * config-lang.in: New libU77 directory. + * intrin.h, intrin.c (ffeintrin_is_intrinsic): Handle + potential generic for subroutine _and_ function + specifics via two new arguments. All callers changed. + Properly ignore deleted/disabled intrinsics in resolving + generics. + (ffeintrin_check_, ffeintrin_init_0): Handle CHARACTER intrinsics of (*) + length. + * intrin.def: Permission granted by FSF to place this in + public domain, which will allow it to serve as source + for both g77 program and its documentation. + Add libU77 intrinsics. + (FLUSH): Now a generic, not specific, intrinsic. + (DEFIMP): Now support return modifier for CHARACTER intrinsics. + + * com-rt.def (FFECOM_gfrtDIM, FFECOM_gfrtERF, + FFECOM_gfrtERFC, FFECOM_gfrtEXP, FFECOM_gfrtSIGN, + FFECOM_gfrtSIN, FFECOM_gfrtSINH, FFECOM_gfrtTAN, + FFECOM_gfrtTANH, FFECOM_gfrtPOW_RI): Change "&r" to "&f". + +Sat Feb 1 12:15:09 1997 Craig Burley <burley@gnu.ai.mit.edu> + + * Version 0.5.19.1 released. + + * com.c (ffecom_expr_, ffecom_expr_intrinsic_, + ffecom_tree_divide_): FFECOM_gfrtPOW_ZI, + FFECOM_gfrtCONJG, FFECOM_gfrtDCONJG, + FFECOM_gfrtCCOS, FFECOM_gfrtCDCOS, + FFECOM_gfrtCLOG, FFECOM_gfrtCDLOG, + FFECOM_gfrtCSIN, FFECOM_gfrtCDSIN, + FFECOM_gfrtCSQRT, FFECOM_gfrtCDSQRT, + FFECOM_gfrtDIV_CC, FFECOM_gfrtDIV_ZZ: These all require + result to _not_ overlap one or more inputs. + +Sat Feb 1 00:25:55 1997 Craig Burley <burley@gnu.ai.mit.edu> + + * com.c (ffecom_init_0): Do internal checks only if + -fset-g77-defaults not specified. + + Fix %LOC(), LOC() to return sufficiently wide type: + * com.h, com.c (ffecom_pointer_kind_, ffecom_label_kind_, + ffecom_pointer_kind(), ffecom_label_kind()): New globals + and accessor macros hold kind for integer pointers on target + machine. + (ffecom_init_0): Determine narrowest INTEGER type that + can hold a pointer (usually INTEGER*4 or INTEGER*8), + store it in ffecom_pointer_kind_, etc. + * expr.c (ffeexpr_cb_end_loc_): Use right type for %LOC(). + * intrin.c (ffeintrin_check_, ffeintrin_init_0): Support + new 'p' kind for type of intrinsic. + * intrin.def (FFEINTRIN_impLOC): Returns "Ip" instead of "I1", + so LOC() type is correct for target machine. + + Support -fugly-assign: + * lang-options.h, top.h, top.c (ffe_decode_option): + Accept -fugly-assign and -fno-ugly-assign. + * com.c (ffecom_expr_): Handle -fugly-assign. + * expr.c (ffeexpr_finished_): Check right type for ASSIGN + contexts. + +Fri Jan 31 14:30:00 1997 Craig Burley <burley@gnu.ai.mit.edu> + + Remove last vestiges of -fvxt-not-f90: + * stb.c (ffestb_R10012_, ffestb_R10014_, ffestb_V0201_): + top.c, top.h: + +Fri Jan 31 02:13:54 1997 Craig Burley <burley@gnu.ai.mit.edu> + + * top.c (ffe_decode_option): Warn if -fugly is specified, + it'll go away soon. + + * symbol.h: No need to #include "bad.h". + + Reorganize features from -fvxt-not-f90 to -fvxt: + * lang-options.h, top.h, top.c: + Accept -fvxt and -fno-vxt, but not -fvxt-not-f90 or -ff90-not-vxt. + Warn if the latter two are used. + * expr.c (ffeexpr_nil_rhs_): Double-quote means octal constant. + (ffeexpr_token_rhs_): Double-quote means octal constant. + * target.h (FFETARGET_defaultIS_VXT_NOT_90): Delete macro + definition, no longer needed. + + Make some -ff90 features the default: + * data.c (ffedata_value): DATA implies SAVE. + * src.h (ffesrc_is_name_noninit): Underscores always okay. + + Fix up some more #error directives by quoting their text: + * bld.c (ffebld_constant_is_zero): + * target.h: + +Sat Jan 18 18:22:09 1997 Craig Burley <burley@gnu.ai.mit.edu> + + * g77.c (lookup_option, main): Recognize `-Xlinker', + `-Wl,', `-l', `-L', `--library-directory', `-o', + `--output'. + (lookup_option): Don't depend on SWITCH_TAKES_ARG + being correct, it might or might not have `-x' in + it depending on host. + Return NULL argument if it would be an empty string. + (main): If no input files (by gcc.c's definition) + but `-o' or `--output' specified, produce diagnostic + to avoid overwriting output via gcc. + Recognize C++ `+e' options. + Treat -L as another non-magical option (like -B). + Don't append_arg `-x' twice. + +Fri Jan 10 23:36:00 1997 Craig Burley <burley@gnu.ai.mit.edu> + + * top.c [BUILT_FOR_270] (ffe_decode_option): Make + -fargument-noalias-global the default. + +Fri Jan 10 07:42:27 1997 Craig Burley <burley@gnu.ai.mit.edu> + + Enable inlining of previously-compiled program units: + * com.c (ffecom_do_entry_, ffecom_start_progunit_): + Register new public function in ffeglobal database. + (ffecom_sym_transform_): Any GLOBAL or potentially GLOBAL + symbol should be looked up in ffeglobal database and + that tree node used, if found. That way, gcc knows + the references are to those earlier definitions, so it + can emit shorter branches/calls, inline, etc. + (ffecom_transform_common_): Minor change for clarity. + * expr.c (ffeexpr_sym-lhs_call_, ffeexpr_sym_lhs_extfunc_, + ffeexpr_sym_rhs_actualarg_, ffeexpr_paren_rhs_let_, + ffeexpr_token_funsubstr_): Globalize symbol as needed. + * global.c (ffeglobal_promoted): New function to look up + existing local symbol in ffeglobal database. + * global.h: Declare new function. + * name.h (ffename_token): New macro, plus alphabetize. + * stc.c (ffestc_R1207_item): Globalize EXTERNAL symbol. + * stu.c (ffestu_sym_end_transition, ffestu_sym_exec_transition): + Globalize symbol as needed. + * symbol.h, symbol.c (ffesymbol_globalize): New function. + +Thu Jan 9 14:20:00 1997 Craig Burley <burley@gnu.ai.mit.edu> + + * ste.c (ffeste_R809): Produce a diagnostic for SELECT CASE + on CHARACTER type, instead of crashing. + +Thu Jan 9 00:52:45 1997 Craig Burley <burley@gnu.ai.mit.edu> + + * stc.c (ffestc_order_entry_, ffestc_order_format_, + ffestc_R1226): Allow ENTRY and FORMAT before IMPLICIT + NONE, by having them transition only to state 1 instead + of state 2 (which is disallowed by IMPLICIT NONE). + +Mon Jan 6 22:44:53 1997 Craig Burley <burley@gnu.ai.mit.edu> + + Fix AXP bug found by Rick Niles (961201-1.f): + * com.c (ffecom_init_0): Undo my 1996-05-14 change, as + it is incorrect and prevented easily finding this bug. + * target.h [__alpha__] (ffetargetReal1, ffetargetReal2): + Use int instead of long. + (ffetarget_cvt_r1_to_rv_, ffetarget_cvt_rv_to_r1_, + ffetarget_cvt_r2_to_rv_, ffetarget_cvt_rv_to_r2_): + New functions that intercede for callers of + REAL_VALUE_(TO|UNTO)_TARGET_(SINGLE|DOUBLE). + All callers changed, and damaging casts to (long *) removed. + +Sun Jan 5 03:26:11 1997 Craig Burley <burley@gnu.ai.mit.edu> + + * Make-lang.in (g77, g77-cross): Depend on both g77.c and + zzz.c, in $(srcdir)/f/. + + Better design for -fugly-assumed: + * stc.c (ffestc_R501_item, ffestc_R524_item, + ffestc_R547_item_object): Pass new is_ugly_assumed flag. + * stt.c, stt.h (ffestt_dimlist_as_expr, + ffestt_dimlist_type): New is_ugly_assumed flag now + controls whether "1" is treated as "*". + Don't treat "2-1" or other collapsed constants as "*". + +Sat Jan 4 15:26:22 1997 Craig Burley <burley@gnu.ai.mit.edu> + + * stb.c (ffestb_R10012_): Don't confirm on FORMAT(A,) + or even FORMAT(A,,B), as R1229 only warns about the + former currently, and this seems reasonable. + + Improvements to diagnostics: + * sta.c (ffesta_second_): Don't add any ffestb parsers + unless they're specifically called for. + Set up ffesta_tokens[0] before calling ffestc_exec_transition, + else stale info might get used. + (ffesta_save_): Do a better job picking which parser to run + after running all parsers with no confirmed possibles. + (FFESTA_maxPOSSIBLES_): Decrease from 100 now that so few + possibles are ever on the list at a given time. + (struct _ffesta_possible): Add named attribute. + (ffesta_add_possible_exec_, ffesta_add_possible_nonexec_): + Make these into macros that call a single function that now + sets the named attribute. + (ffesta_add_possible_unnamed_exec_, + ffeseta_add_possible_unnamed_nonexec_): New macros. + (ffesta_second_): Designate unnamed possibles as + appropriate. + * stb.c (ffestb_R1229, ffestb_R12291_): Use more general + diagnostic, so things like "POINTER (FOO, BAR)" are + diagnosed as unrecognized statements, not invalid statement + functions. + * stb.h, stb.c (ffestb_unimplemented): Remove function. + +1996-12-30 Dave Love <d.love@dl.ac.uk> + + * com.c: #include libU77/config.h + (ffecom_f2c_ptr_to_integer_type_node, + ffecom_f2c_ptr_to_integer_type_node): New variables. + (ffecom_init_0): Use them. + (ffecom_expr_intrinsic_): Many news cases for libU77 intrinsics. + + * com-rt.def: New definitions for libU77. + * intrin.def: Likewise. Also correct ftell arg spec. + + * Makefile.in (f/runtime/libU77/config.h): New target for com.c + dependency. + * Make-lang.in (f771): Depend on f/runtime/Makefile for the above. + +Sat Dec 28 12:28:29 1996 Craig Burley <burley@gnu.ai.mit.edu> + + * stt.c (ffestt_dimlist_type): Treat ([...,]1) in dimlist + as ([...,]*) if -fugly-assumed, so assumed-size array + detected early enough. + +Thu Dec 19 14:01:57 1996 Craig Burley <burley@gnu.ai.mit.edu> + + * target.h (FFETARGET_REAL_VALUE_FROM_INT_): Conditionalize + definition on BUILT_FOR_280, not BUILT_WITH_280, since + the name of the macro was (properly) changed since 0.5.19. + + Fix warnings/errors resulting from ffetargetOffset becoming + `long long int' instead of `unsigned long' as of 0.5.19, + while ffebitCount remains `unsigned long': + * bld.c (ffebld_constantarray_dump): Avoid warnings by + using loop var of appropriate type, and using casts. + * com.c (ffecom_expr_): Use right type for loop var. + (ffecom_sym_transform_, ffecom_transform_equiv_): + Cast to right type in assertions. + * data.c (ffedata_gather_, ffedata_value_): Cast to right + type in assertions and comparisons. + +Wed Dec 18 12:07:11 1996 Craig Burley <burley@gnu.ai.mit.edu> + + Patch from Alexandre Oliva <oliva@dcc.unicamp.br>: + * Makefile.in (all.indirect): Don't pass -bbigtoc option + to GNU ld. + + Cope with new versions of gcc: + * com.h (BUILT_FOR_280): New macro. + * com.c (ffecom_ptr_to_expr): Conditionalize test of + OFFSET_REF. + (ffecom_build_complex_constant_): Conditionalize calling + sequence for build_complex. + +Sat Dec 7 07:15:17 1996 Craig Burley <burley@gnu.ai.mit.edu> + + * Version 0.5.19 released. + +Fri Dec 6 12:23:55 1996 Craig Burley <burley@gnu.ai.mit.edu> + + * g77.c: Default to assuming "f77" is in $LANGUAGES, since + the LANGUAGE_F77 macro isn't defined by anyone anymore (but + might as well leave the no-f77 code in just in case). + * Make-lang.in (g77, g77-cross): Don't define LANGUAGE_F77 + anymore. + +1996-12-06 Dave Love <d.love@dl.ac.uk> + + * Make-lang.in (g77, g77-cross): Revert to building `g77' or not + conditional on `f77' in LANGUAGES. + +Wed Dec 4 13:08:44 1996 Craig Burley <burley@gnu.ai.mit.edu> + + * Make-lang.in (g77, g77-cross): No libs or lib dependencies + in case where "f77" is not in $LANGUAGES. + + * lex.c (ffelex_image_char_, ffelex_file_fixed, + ffelex_file_free): Fixes to properly handle lines with + null character, and too-long lines as well. + + * lex.c: Call ffebad_start_msg_lex instead of + ffebad_start_msg throughout. + +Sun Dec 1 21:19:55 1996 Craig Burley <burley@gnu.ai.mit.edu> + + Fix-up for 1996-11-25 changes: + * com.c (ffecom_member_phase2_): Subtract out 0 offset for + elegance and consistency with EQUIVALENCE aggregates. + (ffecom_sym_transform_): Ditto for LOCAL/COMMON, and + ensure we get the same parent storage area. + * data.c (ffedata_gather_, ffedata_value_): Subtract out + aggregate offset. + +Wed Nov 27 13:55:57 1996 Craig Burley <burley@gnu.ai.mit.edu> + + * proj.h: Quote the text of the #error message, to avoid + strange-looking diagnostics from non-gcc ANSI compilers. + + * top.c: Make -fno-debug-kludge the default. + +Mon Nov 25 20:13:45 1996 Craig Burley <burley@gnu.ai.mit.edu> + + Provide more info on EQUIVALENCE mismatches: + * bad.def (FFEBAD_EQUIV_MISMATCH): More detailed message. + * equiv.c (ffeequiv_layout_local_, ffeequiv_layout_cblock): + More details for FFEBAD_EQUIV_MISMATCH. + + Fix problem with EQUIVALENCE handling: + * equiv.c (ffeequiv_layout_local_): Redesign algorithm -- + old one was broken, resulting in rejection of good code. + (ffeequiv_offset_): Add argument, change callers. + Clean up the code, fix up the (probably unused) negative-value + case for SYMTER. + * com.c (ffecom_sym_transform_): For local EQUIVALENCE + member, subtract out aggregate offset (which is <= 0). + +Thu Nov 21 12:44:56 1996 Craig Burley <burley@gnu.ai.mit.edu> + + Change type of ffetargetOffset from `unsigned long' to `long long': + * bld.c (ffebld_constantarray_dump): Change printf formats. + * storag.c (ffestorag_dump): Ditto. + * symbol.c (ffesymbol_report): Ditto. + * target.h (ffetargetOffset_f): Ditto and change type itself. + + Handle situation where list of languages does not include f77: + * Make-lang.in: Define LANGUAGE_F77 to 1 only if `f77' is in + the $LANGUAGES macro for the build. + * g77.c: Compile to a (nearly) no-op program if LANGUAGE_F77 + is not defined to 1. + + Fixes to delay confirmation of READ, WRITE, and GOTO statements + so the corresponding assignments to same-named CHAR*(*) arrays + work: + * stb.c (ffestb_R90915_, ffestb_91014_): New functions. + (ffestb_goto3_, ffestb_goto5_): Move confirmation from 3 to 5 + for the OPEN_PAREN case. + (ffestb_R9091_, ffestb_R9094_, ffestb_R90913_, ffestb_R90914_, + ffestb_R91012_, ffestb_R91013_): Use new functions, and confirm + except for the OPEN_PAREN case. + + Fixes to not confirm declarations with an open paren where + an equal sign or other assignment-like token might be, so the + corresponding assignments to same-named CHAR*(*) arrays work: + (ffestb_decl_entsp_5_): Move assertion so we crash on that first, + if it turns out to be wrong, before the less-debuggable crash + on mistaken confirmation. + (ffestb_decl_entsp_6_, ffestb_decl_entsp_7_, ffestb_decl_entsp_8_): + Include OPEN_PAREN in list of assignment-only tokens. + + Fix more diagnosed-crash bugs: + * stu.c (ffestu_sym_end_transition): ANY-ize an adjustable array + with bad dimension expressions even if still stateUNCERTAIN. + (ffestu_symter_end_transition_, ffestu_symter_exec_transition_): + Return TRUE for opANY as well. + For code elegance, move opSYMTER case into first switch. + +1996-11-17 Dave Love <d.love@dl.ac.uk> + + * lex.c: Fix last change. + +1996-11-14 Dave Love <d.love@dl.ac.uk> + + * Make-lang.in, config-lang.in: Remove the (broken) libU77 stuff, + pending 0.5.20. + +Thu Nov 14 15:40:59 1996 Craig Burley <burley@gnu.ai.mit.edu> + + * bad.def (FFEBAD_UNIMPL_STMT): Explain that invalid + intrinsic references can trigger this message, too. + +1996-11-12 Dave Love <d.love@dl.ac.uk> + + * lex.c: Declare dwarfout routines. + + * config-lang.in: Sink grep o/p. + +Mon Nov 11 14:21:13 1996 Craig Burley <burley@gnu.ai.mit.edu> + + * g77.c (main): Might as well print version number + for --verbose as well. + +Thu Nov 7 18:41:41 1996 Craig Burley <burley@gnu.ai.mit.edu> + + * expr.c, lang-options.h, target.h, top.c, top.h: Split out + remaining -fugly stuff into -fugly-logint and -fugly-comma, + leaving -fugly as simply a `macro' that expands into other + options, and eliminate defaults for some of the ugly stuff + in target.h. + + * Make-lang.in (gcc-cross): Compile zzz.c, not version.o (!), + in to get version info for this target. + + * config-lang.in: Test for GBE patch application based + on whether 2.6.x or 2.7.x GBE is detected. + +Wed Nov 6 14:19:45 1996 Craig Burley <burley@gnu.ai.mit.edu> + + * Make-lang.in (g77): Compile zzz.c in to get version info. + * g77.c: Add support for --help and --version. + + * g77.c (lookup_option): Short-circuit long-winded tests + when second char is not hyphen, just to save a spot of time. + +Sat Nov 2 13:50:31 1996 Craig Burley <burley@gnu.ai.mit.edu> + + * intrin.def: Add FTELL and FSEEK intrinsics, plus new + `g' codes for alternate-return (GOTO) arguments. + * intrin.c (ffeintrin_check_): Support `g' codes. + * com-rt.def: Add ftell_() and fseek_() to database. + * com.c (ffecom_expr_intrinsic_): Ditto. Also, let each + subroutine intrinsic decide for itself what to do with + tree_type, the default being NULL_TREE once again (so + ffecom_call_ doesn't think it's supposed to cast the + function call to the type in the fall-through case). + + * ste.c (ffeste_R909_finish): Don't special-case list-directed + I/O, now that libf2c can return non-zero status codes. + (ffeste_R910_finish): Ditto. + (ffeste_io_call_): Simplify logic. + (ffeste_io_impdo_): + (ffeste_subr_beru_): + (ffeste_R904): + (ffeste_R907): + (ffeste_R909_start): + (ffeste_R909_item): + (ffeste_R909_finish): + (ffeste_R910_start): + (ffeste_R910_item): + (ffeste_R910_finish): + (ffeste_R911_start): + (ffeste_R923A): Ditto all the above. + +Thu Oct 31 20:56:28 1996 Craig Burley <burley@gnu.ai.mit.edu> + + * config-lang.in, Make-lang.in: Rename flag file + build-u77 to build-libu77, for consistency with + install-libf2c and such. + + * config-lang.in: Don't complain about failure to patch + if pre-2.7.0 gcc is involved (since our patch for that + doesn't add support for tooning). + +Sat Oct 26 05:56:51 1996 Craig Burley <burley@gnu.ai.mit.edu> + + * bad.def (FFEBAD_TYPELESS_TOO_LARGE): Remove this + unused and redundant diagnostic. + +Sat Oct 26 00:45:42 1996 Craig Burley <burley@gnu.ai.mit.edu> + + * target.c (ffetarget_integerhex): Fix dumb bug. + +1996-10-20 Dave Love <d.love@dl.ac.uk> + + * gbe/2.7.2.1.diff: New file. + + * Makefile.in (F771_LDFLAGS): Add -bbigtoc for AIX4.1 up, suggested by + endo@material.tohoku.ac.jp [among others!]. + +Sat Oct 19 03:11:14 1996 Craig Burley <burley@gnu.ai.mit.edu> + + * bad.def, bld.c, bld.h, expr.c, lang-options.h, target.c, + target.h, top.c, top.h (ffebld_constant_new_integerbinary, + ffebld_constant_new_integerhex, ffebld_constant_new_integeroctal, + ffeexpr_token_name_apos_name_, ffetarget_integerbinary, + ffetarget_integerhex, ffetarget_integeroctal): Support + new -fno-typeless-boz option with new functions, mods to + existing octal-handling functions, new macros, new error + messages, and so on. + + * com.c, lang-options.h, top.c, top.h (ffecom_notify_primary_entry): + Print program unit name on stderr if -fno-silent (new option). + + * lang-options.h, top.c, top.h, stt.c (ffestt_dimlist_as_expr): + Treat ([...,]1) in dimlist as ([...,]*) if -fugly-assumed + (new option). + + * lang-options.h: Comment out options duplicated in gcc/toplev.c, + because, somehow, having them commented in and building on my + DEC Alpha results in a cc1 that always segfaults, and gdb that + also segfaults whenever it debugs it up to init_lex() calling + xmalloc() or so. + +Thu Oct 17 00:39:27 1996 Craig Burley <burley@gnu.ai.mit.edu> + + * stb.c (ffestb_R10013_): Don't change meaning of .sign until + after previous meaning/value used to set sign of value + (960507-1.f). + +Sun Oct 13 22:15:23 1996 Craig Burley <burley@gnu.ai.mit.edu> + + * top.c (ffe_decode_option): Don't set back-end flags + that are nonexistent prior to gcc 2.7.0. + +Sun Oct 13 12:48:45 1996 Craig Burley <burley@gnu.ai.mit.edu> + + * com.c (convert): Don't convert emulated complex expr to + real (via REALPART_EXPR) if the target type is (emulated) + complex. + +Wed Oct 2 21:57:12 1996 Craig Burley <burley@gnu.ai.mit.edu> + + * com.c (ffecom_debug_kludge_): Set DECL_IN_SYSTEM_HEADER so + -Wunused doesn't complain about these manufactured decls. + (ffecom_expr_): Ditto, for original (non-ASSIGN'ed) variable. + (ffecom_transform_equiv_): Clear DECL_IGNORED_P for aggregate + area so it shows up as a debug-accessible symbol. + (pushdecl): Default for "invented" identifiers (a g77-specific + concept for now) is that they are artificial, in system header, + ignored for debugging purposes, used, and (for types) suppressed. + This ought to be overkill. + +Fri Sep 27 23:13:07 1996 Craig Burley <burley@gnu.ai.mit.edu> + + * ste.c (ffeste_begin_iterdo_, ffeste_end_iterdo_): Support + one-trip DO loops (F66-style). + * lang-options.h, top.c, top.h (-fonetrip): New option. + +Thu Sep 26 00:18:40 1996 Craig Burley <burley@gnu.ai.mit.edu> + + * com.c (ffecom_debug_kludge_): New function. + (ffecom_sym_transform_): Use new function for COMMON and EQUIVALENCE + members. + + * lang-options.h, top.c, top.h (-fno-debug-kludge): + New option. + +1996-09-24 Dave Love <d.love@dl.ac.uk> + + * Make-lang.in (include/f2c.h): + Remove dependencies on xmake_file and tmake_file. + They expand inconsistently in 2.8 c.f. 2.7; $(GCC_PARTS) depends on + them anyhow. + +1996-09-22 Dave Love <d.love@dl.ac.uk> + + * config-lang.in: Add --enable-libu77 option handling. + + * Make-lang.in: + Conditionally add --enable-libu77 when running runtime configure. + Define LIBU77STAGESTUFF and use it in relevant rules. + +1996-08-21 Dave Love <d.love@dl.ac.uk> + + * Make-lang.in (f77-runtime): + `stmp-hdrs' should have been `stmp-headers'. + +1996-08-20 Dave Love <d.love@dl.ac.uk> + + * Make-lang.in (f77-runtime): + Depend on stmp-hdrs, not stmp-int-hdrs, since libF77 + needs float.h. + +Sat Jun 22 18:17:11 1996 Craig Burley <burley@gnu.ai.mit.edu> + + * com.c (ffecom_tree_divide_): Fix RECORD_TYPE case to + look at type of first field, properly, to determine + whether to call c_div or z_div. + +Tue Jun 4 04:27:18 1996 Craig Burley <burley@gnu.ai.mit.edu> + + * com.c (ffecom_build_complex_constant_): Explicitly specify + TREE_PURPOSE. + (ffecom_expr_): Fix thinko. + (ffecom_2): For COMPLEX_EXPR, explicitly specify TREE_PURPOSE. + +Mon May 27 16:23:43 1996 Craig Burley <burley@gnu.ai.mit.edu> + + Changes to optionally avoid gcc's back-end complex support: + * com.c (ffecom_stabilize_aggregate_): New function. + (ffecom_convert_to_complex_): New function. + (ffecom_make_complex_type_): New function. + (ffecom_build_complex_constant_): New function. + (ffecom_expr_): For opCONVERT of non-COMPLEX to COMPLEX, + don't bother explicitly converting to the subtype first, + because gcc does that anyway, and more code would have + to be added to find the subtype for the emulated-complex + case. + (ffecom_f2c_make_type_): Use ffecom_make_complex_type_ + instead of make_node etc. to make a complex type. + (ffecom_1, ffecom_2): Translate operations on COMPLEX operands + to appropriate operations when emulating complex. + (ffecom_constantunion): Use ffecom_build_complex_constant_ + instead of build_complex to build a complex constant. + (ffecom_init_0): Change point at which types are laid out + for improved consistency. + Use ffecom_make_complex_type_ instead of make_node etc. + to make a complex type. + Always calculate storage sizes from TYPE_SIZE, never TYPE_PRECISION. + (convert): Use e, not expr, since we've copied into that anyway. + For RECORD_TYPE cases, do emulated-complex conversions. + (ffecom_f2c_set_lio_code_): Always calculate storage sizes + from TYPE_SIZE, never TYPE_PRECISION. + (ffecom_tree_divide_): Allow RECORD_TYPE to also be handled + by run-time library. + (ffecom_expr_intrinsic_): Handle possible RECORD_TYPE as argument + to AIMAG intrinsic. + + * top.h, top.c, lang-options.h: Support new -f(no-)emulate-complex option. + + * com.c (ffecom_sym_transform_): Clarify and fix typos in comments. + +Mon May 20 02:06:27 1996 Craig Burley <burley@gnu.ai.mit.edu> + + * target.h: Use new REAL_VALUE_UNTO_TARGET_* macros instead + of REAL_VALUE_FROM_TARGET_DOUBLE and _SINGLE. + Explicitly use long instead of HOST_WIDE_INT for emulation + of ffetargetReal1 and ffetargetReal2. + +1996-05-20 Dave Love <d.love@dl.ac.uk> + + * config-lang.in: + Test for patch being applied with flag_move_all_movables in toplev.c. + + * install.texi (Patching GNU Fortran): + Mention overriding X_CFLAGS rather than + editing proj.h on SunOS4. + + * Make-lang.in (F77_FLAGS_TO_PASS): + Add X_CFLAGS (convenient for SunOS4 kluge, in + particular). + (f77.{,mostly,dist}clean): Reorder things, in particular not to delete + Makefiles too early. + + * g77.c (DEFAULT_SWITCH_TAKES_ARG): Define a la gcc.c in the + current GCC snapshot. + +Tue May 14 00:24:07 1996 Craig Burley <burley@gnu.ai.mit.edu> + + Changes for DEC Alpha AXP support: + * com.c (ffecom_init_0): REAL_ARITHMETIC means internal + REAL/DOUBLE PRECISION might well have a different size + than the compiled type, so don't crash if this is the + case. + * target.h: Use `int' for ffetargetInteger1, + ffetargetLogical1, and magical tests. Set _f format + strings accordingly. + +Tue Apr 16 14:08:28 1996 Craig Burley <burley@gnu.ai.mit.edu> + + * top.c (ffe_decode_option): -Wall no longer implies + -Wsurprising. + +Sat Apr 13 14:50:06 1996 Craig Burley <burley@gnu.ai.mit.edu> + + * com.c (ffecom_char_args_): If item is error_mark_node, + set *length that way, too. + + * com.c (ffecom_expr_power_integer_): If either operand + is error_mark_node, return that. + + * com.c (ffecom_intrinsic_len_): If item is error_mark_node, + return that for length. + + * expr.c (ffeexpr_declare_unadorned_, + ffeexpr_declare_parenthesized_): Instead of crashing + on unexpected contexts, produce a diagnostic. + + * intrin.c (ffeintrin_check_), intrin.def (impSIGNAL): + Allow procedure as second arg to SIGNAL intrinsic. + + * stu.c (ffestu_symter_end_transition_): New function. + (ffestu_symter_exec_transition_): Return bool arg. + Always transition symbol (don't inhibit when !whereNONE). + (ffestu_sym_end_transition): If DUMMY/LOCAL arg has any + opANY exprs in its dimlist, diagnose it so it doesn't + make it through to later stages that try to deal with + dimlist stuff. + (ffestu_sym_exec_transition): If sym has any opANY exprs + in its dimlist, diagnose it so it becomes opANY itself. + + * symbol.c (ffesymbol_error): If token arg is NULL, + just ANY-ize the symbol -- don't produce diagnostic. + +Mon Apr 1 10:14:02 1996 Craig Burley <burley@gnu.ai.mit.edu> + + * Version 0.5.18 released. + +Mon Mar 25 20:52:24 1996 Craig Burley <burley@gnu.ai.mit.edu> + + * com.c (ffecom_expr_power_integer_): Don't generate code + that compares COMPLEX (or, as it happens, REAL) via "LT_EXPR", + since the back end crashes on that. (This code would never + be executed anyway, but the test that avoids it has now been + translated to control whether the code gets generated at all.) + Fixes 960323-3.f. + + * com.c (ffecom_type_localvar_): Handle variable-sized + dimension bounds expressions here, so they get calculated + and saved on procedure entry. Fixes 960323-4.f. + + * com.c (ffecom_notify_init_symbol): Symbol has no init + info at all if only zeros have been used to initialize it. + Fixes 960324-0.f. + + * expr.c, expr.h (ffeexpr_type_combine): Renamed from + ffeexpr_type_combine_ and now a public procedure; last arg now + a token, instead of an internal structure used to extract a token. + Now allows the outputs to be aliased with the inputs. + Now allows a NULL token to mean "don't report error". + (ffeexpr_reduced_bool2_, ffeexpr_reduced_eqop2_, + ffeexpr_reduced_math2_, ffeexpr_reduced_power_, + ffeexpr_reduced_relop2_): Handle new calling sequence for + ffeexpr_type_combine. + * (ffeexpr_convert): Don't put an opCONVERT node + in just because the size is unknown; all downstream code + should be able to deal without it being there anyway, and + getting rid of it allows new intrinsic code to more easily + combine types and such without generating bad code. + * info.c, info.h (ffeinfo_kindtype_max): Rewrite to do + proper comparison of size of types, not just comparison + of their internal kind numbers (so I2.eq.I1 doesn't promote + I1 to I2, rather the other way around). + * intrin.c (ffeintrin_check_): Combine types of arguments + in COL a la expression handling, for greater flexibility + and permissiveness (though, someday, -fpedantic should + report use of this kind of thing). + Make sure Hollerith/typeless where CHARACTER expected is + rejected. This all fixes 960323-2.f. + + * ste.c (ffeste_begin_iterdo_): Fix some more type conversions + so INTEGER*2-laden DO loops don't crash at compile time on + certain machines. Believed to fix 960323-1.f. + + * stu.c (ffestu_sym_end_transition): Certainly reject + whereDUMMY not in any dummy list, whether stateUNCERTAIN + or stateUNDERSTOOD. Fixes 960323-0.f. + +Tue Mar 19 13:12:40 1996 Craig Burley <burley@gnu.ai.mit.edu> + + * data.c (ffedata_value): Fix crash on opANY, and simplify + the code at the same time. + + * Make-lang.in (f77-runtime): Also depends on lib[FI]77/Makefile... + (include/f2c.h...): ...which in turn depend on */Makefile.in. + (f77.rebuilt): Rebuild runtime stuff too. + + * intrin.c (ffeintrin_check_): Accommodate TYPELESS/HOLLERITH + types, convert args as necessary, etc. + + * expr.c (ffeexpr_convert): Fix test for TYPELESS/HOLLERITH + to obey the docs; crash if no source token when error. + (ffeexpr_collapse_convert): Crash if no token when error. + +Mon Mar 18 15:51:30 1996 Craig Burley <burley@gnu.ai.mit.edu> + + * com.c (ffecom_init_zero_): Renamed from + ffecom_init_local_zero_; now handles top-level + (COMMON) initializations too. + + * bld.c (ffebld_constant_is_zero): + * com.c (ffecom_symbol_transform_, ffecom_sym_transform_assign_, + ffecom_transform_common_, ffecom_transform_equiv_): + * data.c: + * equiv.c: + * equiv.h: + * lang-options.h: + * stc.c: + * storag.c: + * storag.h: + * symbol.c: + * symbol.h: + * target.c: + * target.h: + * top.c: + * top.h: All of this is mostly housekeeping-type changes + to support -f(no-)zeros, i.e. not always stuff zero + values into the initializer fields of symbol/storage objects, + but still track that they have been given initial values. + + * bad.def: Fix wording for DATA-related diagnostics. + + * com.c (ffecom_sym_transform_assign_): Don't check + any EQUIVALENCE stuff for local ASSIGN, the check was + bad (crashing), and it's not necessary, anyway. + + * com.c (ffecom_expr_intrinsic_): For MAX and MIN, + ignore null arguments as far arg[123], and fix handling + of ANY arguments. (New intrinsic support now allows + spurious trailing null arguments.) + + * com.c (ffecom_init_0): Add HOLLERITH (unsigned) + equivalents for INTEGER*2, *4, and *8, so shift intrinsics + and other things that need unsigned versions of signed + types work. + +Sat Mar 16 12:11:40 1996 Craig Burley <burley@gnu.ai.mit.edu> + + * storag.c (ffestorag_exec_layout): Treat adjustable + local array like dummy -- don't create storage object. + * com.c (ffecom_sym_transform_): Allow for NULL storage + object in LOCAL case (adjustable array). + +Fri Mar 15 13:09:41 1996 Craig Burley <burley@gnu.ai.mit.edu> + + * com.c (ffecom_sym_transform_): Allow local symbols + with nonconstant sizes (adjustable local arrays). + (ffecom_type_localvar_): Allow dimensions with nonconstant + component (adjustable local arrays). + * expr.c: Various minor changes to handle adjustable + local arrays (a new case of stateUNCERTAIN). + * stu.c (ffestu_sym_end_transition, + ffestu_sym_exec_transition): Ditto. + * symbol.def: Update docs to reflect these changes. + + * com.c (ffecom_expr_): Reduce space/time needed for + opACCTER case by handling it here instead of converting + it to opARRTER earlier on. + (ffecom_notify_init_storage): Don't convert ACCTER to ARRTER. + (ffecom_notify_init_symbol): Ditto. + + * com.c (ffecom_init_0): Crash and burn if any of the types' + sizes, according to the GBE, disagrees with the sizes of + the FFE's internal implementation. This might catch + Alpha/SGI bugs earlier. + +Fri Mar 15 01:09:41 1996 Craig Burley <burley@gnu.ai.mit.edu> + + * com-rt.def, com.c, com.h: Changes for rewrite of intrinsic + handling. + * com.c (ffecom_arglist_expr_): New function. + (ffecom_widest_expr_type_): New function. + (ffecom_expr_intrinsic_): Reorganize, some rewriting. + (ffecom_f2c_make_type_): Layout complex types. + (ffecom_gfrt_args_): New function. + (ffecom_list_expr): Trivial change for consistency. + + * expr.c (ffeexpr_token_name_rhs_): Go back to getting + type from specific, not implementation, info. + (ffeexpr_token_funsubstr_): Set intrinsic implementation too! + * intrin.c: Major rewrite of most portions. + * intrin.def: Major rearchitecting of tables. + * intrin.h (ffeintrin_basictype, ffeintrin_kindtype): + Now (once again) take ffeintrinSpec as arg, not ffeintrinImp; + for now, these return NONE, since they're not really needed + and adding the necessary info to the tables is not trivial. + (ffeintrin_codegen_imp): New function. + * stc.c (ffestc_R1208_item): Change way ffeintrin funcs called, + back to original per above; but comment out the code anyway. + + * intrin.c (ffe_init_0): Do internal checks only if + -fset-g77-defaults not specified. + + * lang-options.h: Add -fset-g77-defaults option. + * lang-specs.h: Always pass -fset-g77-defaults. + * top.c, top.h: New option. + +Sat Mar 9 17:49:50 1996 Craig Burley <burley@gnu.ai.mit.edu> + + * Make-lang.in (stmp-int-hdrs): Use --no-validate when + generating the f77.rebuilt files (BUGS, INSTALL, NEWS) + so cross-references can work properly in g77.info + without a lot of hassle. Users can probably deal with + the way they end up looking in the f77.rebuilt files. + + * bld.c (ffebld_constant_new_integer4_val): INTEGER*8 + support -- new function. + (ffebld_constant_new_logical4_val): New function. + * com.c (ffecom_f2c_longint_type_node): New type. + (FFECOM_rttypeLONGINT_): New return type code. + (ffecom_expr_): Add code to invoke pow_qq instead + of pow_ii for INTEGER4 (INTEGER*8) case. + If ffecom_expr_power_integer_ returns NULL_TREE, just do + the usual work. + (ffecom_make_gfrt_): Handle new type. + (ffecom_expr_power_integer_): Let caller do the work if in + dummy-transforming case, since + caller now knows about INTEGER*8 and such, by returning + NULL_TREE. + * expr.c (ffeexpr_reduced_power_): Complain about non-INTEGER + raised to INTEGER4 (INTEGER*8) power. + + * target.c (ffetarget_power_integerdefault_integerdefault): + Fix any**negative. + * com.c (ffecom_expr_power_integer_): Fix (-1)**(-8) and similar + to ABS() the integral result if the exponent is negative + and even. + + * ste.c (ffeste_begin_iterdo_): Clean up a type ref. + Always convert iteration count to _default_ INTEGER. + + * sta.c (ffesta_second_): Add BYTE and WORD type/stmts; + changes by Scott Snyder <snyder@d0sgif.fnal.gov>. + * stb.c (ffestb_decl_recursive): Ditto. + (ffestb_decl_recursive): Ditto. + (ffestb_decl_entsp_2_): Ditto. + (ffestb_decl_entsp_3_): Ditto. + (ffestb_decl_funcname_2_): Ditto. + (ffestb_decl_R539): Ditto. + (ffestb_decl_R5395_): Ditto. + * stc.c (ffestc_establish_declstmt_): Ditto. + * std.c (ffestd_R539item): Ditto. + (ffestd_R1219): Ditto. + * stp.h: Ditto. + * str-1t.fin: Ditto. + * str-2t.fin: Ditto. + + * expr.c (ffeexpr_finished_): For DO loops, allow + any INTEGER type; convert LOGICAL (assuming -fugly) + to corresponding INTEGER type instead of always default + INTEGER; let later phases do conversion of DO start, + end, incr vars for implied-DO; change checks for non-integral + DO vars to be -Wsurprising warnings. + * ste.c (ffeste_io_impdo_): Convert start, end, and incr + to type of DO variable. + + * com.c (ffecom_init_0): Add new types for [IL][234], + much of which was done by Scott Snyder <snyder@d0sgif.fnal.gov>. + * target.c: Ditto. + * target.h: Ditto. + +Wed Mar 6 14:08:45 1996 Craig Burley <burley@gnu.ai.mit.edu> + + * top.c (ffe_init_gbe_): Make -frerun-loop-opt the default. + +Mon Mar 4 12:27:00 1996 Craig Burley <burley@gnu.ai.mit.edu> + + * expr.c (ffeexpr_exprstack_push_unary_): Really warn only + about two successive _arithmetic_ operators. + + * stc.c (ffestc_R522item_object): Allow SAVE of (understood) + local entity. + + * top.c (ffe_decode_option): New -f(no-)second-underscore options. + * top.h: New options. + * com.c (ffecom_get_external_identifier_, ffecom_get_identifier_): + New options. + + * Make-lang.in (f77.maintainer-clean): Clean f/BUGS, f/INSTALL, + f/NEWS. + ($(srcdir)/f/BUGS, $(srcdir)/f/INSTALL, $(srcdir)/f/NEWS): + New rules. + ($(srcdir)/f/g77.info, $(srcdir)/f/g77.dvi): Depend on + f/bugs.texi and f/news.texi. + (f77.install-man): Install f77 man pages (if enabled). + (f77.uninstall): Uninstall info docs, f77 man pages (if enabled). + + * top.c (ffe_init_gbe_): New function. + (ffe_decode_option, ffe_file): Call ffe_init_gbe_ to + set defaults for gcc options. + +Sat Jan 20 13:57:19 1996 Craig Burley <burley@gnu.ai.mit.edu> + + * com.c (ffecom_get_identifier_): Eliminate needless + comparison of results of strchr. + +Tue Dec 26 11:41:56 1995 Craig Burley <burley@gnu.ai.mit.edu> + + * Make-lang.in: Add rules for new files g77.texi, g77.info, + and g77.dvi. + Reorganize the *clean rules to more closely parallel gcc's. + + * config-lang.in: Exclude g77.info from diffs. + +Sun Dec 10 02:29:13 1995 Craig Burley <burley@gnu.ai.mit.edu> + + * expr.c (ffeexpr_declare_unadorned_, + ffeexpr_declare_parenthesized_): Break out handling of + contextDATAIMPDO[INDEX,CTRL] so it's independent of symbol state. + Don't exec-transition these here (let ffeexpr_sym_impdoitem_ + handle that when appropriate). Don't "declare" them twice. + +Tue Dec 5 06:48:26 1995 Craig Burley <burley@gnu.ai.mit.edu> + + * stc.c (ffestc_promote_sfdummy_): Allow whereNONE parent + symbol, since it is not necessarily known whether it will + become LOCAL or DUMMY. + +Mon Dec 4 03:46:55 1995 Craig Burley <burley@gnu.ai.mit.edu> + + * lex.c (ffelex_display_token, ffelex_type_string_): Resurrect + these from their old versions and update them for possible invocation + from debugger. + * lex.h (ffelex_display_token): Declare this in case anyone + else wants to call it. + + * lex.c (ffelex_total_tokens_): Have this reflect actual allocated + tokens, no longer include outstanding "uses" of tokens. + + * malloc.c, malloc.h (MALLOC_DEBUG): New macro to control + checking of whether callers follow rules, now defaults to 0 + for "no checking" to improve compile times. + + * malloc.c (malloc_pool_kill): Fix bug that could prevent + subpool from actually being killed (wasn't setting its use + count to 1). + + * proj.h, *.c (dmpout): Replace all occurrences of `stdout' + and some of `stderr' with `dmpout', so where to dump debugging + output can be easily controlled during build; add default + for `dmpout' of `stderr' to proj.h. + +Sun Dec 3 00:56:29 1995 Craig Burley <burley@gnu.ai.mit.edu> + + * com.c (ffecom_return_expr): Eliminate attempt at warning + about unset return values, since the back end does this better, + with better wording, and is not triggered by clearly working + (but spaghetti) code as easily as this test. + +Sat Dec 2 08:28:56 1995 Craig Burley <burley@gnu.ai.mit.edu> + + * target.c (ffetarget_power_*_integerdefault): Raising 0 to + integer constant power should not be an error condition; + if so, other code should catch 0 to any power, etc. + + * bad.def (FFEBAD_BAD_POWER): 0**integer now a warning instead + of an error. + +Fri Dec 1 00:12:03 1995 Craig Burley (burley@gnu.ai.mit.edu) + + * bad.def: Clarify diagnostic regarding complex constant elements. + * expr.c (ffeexpr_cb_comma_c_): Capitalize real/imaginary + for clarified diagnostic. + + * com.c (ffecom_close_include_): Close the file! + + * lex.c (ffelex_file_fixed): Update line info if the line + has any content, not just if it finishes a previous line + or has a label. + (ffelex_file_free): Clarify switch statement code. + +Sat Nov 18 19:37:22 1995 Craig Burley (burley@gnu.ai.mit.edu) + + * Version 0.5.17 released. + +Fri Nov 17 14:27:24 1995 Craig Burley (burley@gnu.ai.mit.edu) + + * Make-lang.in: Fix typo in comment. + + * Makefile.in (f/fini.o, f/proj-h.o): Don't use `$<' since + not all makes support it (e.g. NeXT make), use explicit + source name instead (with $(srcdir) and munging). + (ASSERT_H): assert.h lives in source dir, not build dir. + +Thu Nov 16 12:47:50 1995 Craig Burley (burley@gnu.ai.mit.edu) + + * com.c (ffecom_init_0): Fix dumb bug in code to produce + warning message about non-32-bit-systems. + + * stc.c (ffestc_R501_item): Parenthesize test to make + warning go away (and perhaps fix bug). + +Thu Nov 16 03:43:33 1995 Craig Burley (burley@gnu.ai.mit.edu) + + * g77.c: Upgrade to 2.7.0's gcc.c. + Fix -v to pass a temp name instead of "/dev/null" for "-o". + +Fri Nov 10 19:16:05 1995 Craig Burley (burley@gnu.ai.mit.edu) + + * ste.c (ffeste_begin_iterdo_): Add Toon's change to + make loops faster on some machines (implement termination + condition as "--i >= 0" instead of "i-- > 0"). + +Thu Nov 2 03:58:17 1995 Craig Burley (burley@gnu.ai.mit.edu) + + * Make-lang.in: Remove unnecessary $(exeext) a la cp/Make-lang.in. + + * com.c (ffecom_expr_): Restore old strategy for assignp variant + of opSYMTER case...always return the ASSIGN version of var. + That way, `-O -Wuninitialized' will catch "I=3;GOTO I;END" + (though the diagnostic will refer to `__g77_ASSIGN_i'). + + * com.c (ffecom_expr_power_integer_): For constant rhs case, + wrap every new eval of lhs in save_expr() so it is clear to + back end that MULT_EXPR(lhs,lhs) has identical operands, + otherwise for an rhs like 32767 it generates around 65K pseudo + registers, with which stupid_life_analysis cannot cope + (due to reg_renumber in regs.h being `short *' instead of + `int *'). + + * com.c (ffecom_expr_): Speed up implementation of LOGICAL + versions of opNOT, opAND, opOR, opXOR/opNEQV, and opEQV by + assuming the values actually are kosher LOGICAL bit patterns. + Also simplify code that implements some of the INTEGER versions + of these. + + * com.c (skip_redundant_dir_prefix, read_name_map, + ffecom_open_include_, signed_type, unsigned_type): Fold in + changes to cccp.c made from 2.7.0 through ss-950826. + + * equiv.c (ffeequiv_layout_local_): Kill the equiv list + if no syms in list. + + * expr.c (ffeexpr_reduced_eqop2_): Issue specific diagnostic + regarding usage of .EQV./.NEQV. in preference to .EQ./.NE.. + + * intrin.c: Add ERF and ERFC as generic intrinsics. + intrin.def: Same. + + * sta.c (ffesta_save_, ffesta_second_): Whoever calls + ffestd_exec_begin must also set ffesta_seen_first_exec = TRUE, + and anytime stc sees an exec transition, it must do both. + stc.c (ffestc_eof): Same. + + * stc.c (ffestc_promote_sfdummy_): If failed implicit typing + or CHARACTER*(*) arg, after calling ffesymbol_error, don't + reset info to ENTITY/DUMMY, because ffecom_sym_transform_ + doesn't expect such a thing with ANY/ANY type. + + * target.h (*logical*): Change some of these so they parallel + changes in com.c, e.g. for _eqv_, use (l)==(r) instead of + !!(l)==!!(r), to get a more faithful result. + +Fri Oct 27 07:06:59 1995 Craig Burley (burley@gnu.ai.mit.edu) + + * com.c (ffecom_sym_transform_): Simplify code for local + EQUIVALENCE case. + + * expr.c (ffeexpr_exprstack_push_unary_): Warn about two + successive operators. + (ffeexpr_exprstack_push_binary_): Warn about "surprising" + operator precedence, as in "-2**2". + + * lang-options.h: Add -W(no-)surprising options. + + * parse.c (yyparse): Don't reset -fpedantic if not -pedantic. + + * top.c (ffe_decode_option): Support new -Wsurprising option. + * top.h: Ditto. + +Mon Oct 23 09:14:15 1995 Craig Burley (burley@gnu.ai.mit.edu) + + * com.c (ffecom_finish_symbol_transform_): Don't transform + NONE/NONE (CHARACTER*(*)) vars, as these don't mean anything + in debugging terms, and can't be turned into anything + in the back end (so ffecom_sym_transform_ crashes on them). + + * com.c (ffecom_expr_): Change strategy for assignp variant + of opSYMTER case...always return the original var unless + it is not wide enough. + + * ste.c (ffeste_io_cilist_): Clarify diagnostic for ASSIGN + involving too-narrow variable. This shouldn't happen, though. + (ffeste_io_icilist_): Ditto. + (ffeste_R838): Ditto. + (ffeste_R839): Ditto. + +Thu Oct 19 03:21:20 1995 Craig Burley (burley@gnu.ai.mit.edu) + + * com.c (ffecom_sym_transform_assign_): Set TREE_STATIC + using the same decision-making process as used for their twin + variables, so ASSIGN can last across RETURN/CALL as appropriate. + +Fri Sep 22 20:21:18 1995 Craig Burley (burley@gnu.ai.mit.edu) + + * Makefile.in: fini is a host program, so it needs a host-compiled + version of proj.o, named proj-h.o. f/fini, f/fini.o, and + f/proj-h.o targets updated accordingly. + + * com.c (__eprintf): New function. + +Wed Sep 20 02:26:36 1995 Craig Burley (burley@gnu.ai.mit.edu) + + * lang-options.h: Add omitted -funix-intrinsics-* options. + + * malloc.c (malloc_find_inpool_): Check for infinite + loop, crash if detected (user reports encountering + them in some large programs, this might help track + down the bugs). + +Thu Sep 7 13:00:32 1995 Craig Burley (burley@gnu.ai.mit.edu) + + * com.c (lang_print_error_function): Don't dereference null + pointer when outside any program unit. + (ffecom_let_char_, ffecom_arg_ptr_to_expr): If catlist + item or length ever error_mark_node, don't continue processing, + since back-end functions like build_pointer_type crash on + error_mark_node's (due to pushing bad obstacks, etc.). + +Wed Aug 30 15:58:35 1995 Craig Burley (burley@gnu.ai.mit.edu) + + * Version 0.5.16 released. + +Mon Aug 28 12:24:20 1995 Craig Burley (burley@gnu.ai.mit.edu) + + * bad.c (ffebad_finish): Fix botched message when no places + are printed (due to unknown line info, etc.). + + * std.c (ffestd_subr_labels_): Do a better job finding + line info in the case of typeANY and diagnostics. + +Fri Aug 25 15:19:29 1995 Craig Burley (burley@gnu.ai.mit.edu) + + * com.c (DECL_ARTIFICIAL): Surround all references to this + macro with #if !BUILT_FOR_270 and #endif. + (init_lex): Surround print_error_function decl with + #if !BUILT_FOR_270 and #endif. + (lang_init): Call new ffelex_hash_kludge function to solve + problem with preprocessed files that have INCLUDE statements. + + * lex.c (ffelex_getc_): New function. + (ffelex_cfelex_): Use ffelex_getc_ instead of getc in any + paths of code that can be affected by ffelex_hash_kludge. + Don't make an EOF token for unrecognized token; set token + to NULL instead, to avoid problems when not initialized. + (ffelex_hash_): Use ffelex_getc_ instead of getc in any + paths of code that can be affected by ffelex_hash_kludge. + Test token returned by ffelex_cfelex_ for NULL, meaning + unrecognized token. + Get rid of useless used_up variable. + Don't do ffewhere stuff or kill any tokens if in + ffelex_hash_kludge. + (ffelex_file_fixed, ffelex_file_free): Use ffelex_getc_ + instead of getc in any paths of code that can be affected + by ffelex_hash_kludge. + (ffelex_hash_kludge): New function. + + * lex.h (ffelex_hash_kludge): New function. + +Wed Aug 23 15:17:40 1995 Craig Burley (burley@gnu.ai.mit.edu) + + * com.c: Implement -f(no-)underscoring options by always + compiling in code to do it, and having that code inhibit + itself when -fno-underscoring is in effect. This option + overrides -f(no-)f2c for this purpose; -f(no-)f2c returns + to it's <=0.5.15 behavior of affecting only how code + is generated, not how/whether names are mangled. + + * target.h: Redo specification of appending underscores so + the macros are named "_default" instead of "_is" and the + two-underscore macro defaults to 1. + + * top.c, top.h (underscoring): Add appropriate stuff + for the -f(no-)underscoring options. + +Tue Aug 22 10:25:01 1995 Craig Burley (burley@gnu.ai.mit.edu) + + * bad.c (ffebad_finish): Call report_error_function (in toplev.c) + to better identify location of problem. + Say "(continued):" instead of "(continued:)" for consistency. + + * com.c (ffecom_gen_sfuncdef_): Set and reset new + ffecom_nested_entry_ variable to hold ffesymbol being compiled. + (lang_print_error_function): New function from toplev.c. + Use ffecom_nested_entry_ to help determine which name + and kind-string to print. + (ffecom_expr_intrinsic_): Handle EXIT and FLUSH invocations + with different calling sequences than library functions. + Have SIGNAL and SYSTEM push and pop calltemps, and convert + their return values to the destination type (just in case). + (FFECOM_rttypeINT_): New return type for `int', in case + gcc/f/runtime/libF77/system_.c(system_) is really supposed + to return `int' instead of `ftnint'. + + * com.h (report_error_function): Declare this. + + * equiv.c (ffeequiv_layout_local_): Don't forget to consider + root variable itself as possible "first rooted variable", + else might never set symbol and then crash later. + + * intrin.c (ffeintrin_check_exit_): Change to allow no args + and rename to ffeintrin_check_int_1_o_ for `optional'. + #define ffeintrin_check_exit_ and _flush_ to this new + function, so intrin.def can refer to the appropriate names. + + * intrin.def (FFEINTRIN_impFLUSH): Validate using + ffeintrin_check_flush_ so passing an INTEGER arg is allowed. + + * lex.c (ffelex_file_push_, ffelex_file_pop_): New functions + to manage input_file_stack in gbe. + (ffelex_hash_): Call new functions (instead of doing code). + (ffelex_include_): Call new functions to update stack for + INCLUDE (_hash_ handles cpp output of #include). + +Mon Aug 21 08:09:04 1995 Craig Burley (burley@gnu.ai.mit.edu) + + * Makefile.in: Put `-W' in front of every `-Wall', since + 2.7.0 requires that to engage `-Wunused' for parameters. + + * com.c: Mark all parameters as artificial, so + `-W -Wunused' doesn't complain about unused ones (since + there's no way right not to individually specify attributes + like `unused'). + + * proj.h: Don't #define UNUSED if already defined, regardless + of host compiler. + +Sun Aug 20 16:03:56 1995 Craig Burley (burley@gnu.ai.mit.edu) + + * gbe/2.7.0.diff: Regenerate. + + * lang-options.h, lang-specs.h: If not __STDC__ (ANSI C), + avoid doing anything, especially the stringizing in -specs.h. + +Thu Aug 17 03:36:12 1995 Craig Burley (burley@gnu.ai.mit.edu) + + * lang-specs.h: Remove useless optional settings of -traditional, + since -traditional is always set anyway. + +Wed Aug 16 16:56:46 1995 Craig Burley (burley@gnu.ai.mit.edu) + + * Make-lang.in (F2C_INSTALL_FLAG, F2CLIBOK): More + control over whether to install f2c-related stuff. + (install-f2c-*): New targets to install f2c-related + stuff in system, not just gcc, directories. + + * com.c: Change calls to ffecom_get_invented_identifier + to use generally more predictable names. + Change calls to build_range_type to ensure consistency + of types of operands. + (ffecom_get_external_identifier_): Change to accept + symbol info, not just text, so it can use f2c flag for + symbol to decide whether to append underscore(s). + (ffecom_get_identifier_): Don't change names if f2c flag + off for compilation. + (ffecom_type_permanent_copy_): Use same type for new max as + used for min. + (ffecom_notify_init_storage): Offline fixups for stand-alone. + + * data.c (ffedata_gather): Explicitly test for common block, + since it's no longer always the case that a local EQUIVALENCE + group has no symbol ptr (it now can, if a user-predictable + "rooted" symbol has been identified). + + * equiv.c: Add some debugging stuff. + (ffeequiv_layout_local_): Set symbol ptr with user-predictable + "rooted" symbol, for giving the invented aggregate a + predictable name. + + * g77.c (append_arg): Allow for 20 extra args instead of 10. + (main): For version-only case, add `-fnull-version' and, unless + explicitly omitted, `-lf2c -lm'. + + * lang-options.h: New "-fnull-version" option. + + * lang-specs.h: Support ".fpp" suffix for preprocessed source + (useful for OS/2, MS-DOS, other case-insensitive systems). + + * stc.c (ffestc_R544_equiv_): Swap way lists are merged so this + is consistent with the order in which lists are built, making + user predictability of invented aggregate name much higher. + + * storag.c, storag.h (FFESTORAG_typeDUMMY): Delete this enum. + + * top.c: Accept, but otherwise ignore, `-fnull-version'. + +Tue Aug 15 07:01:07 1995 Craig Burley (burley@gnu.ai.mit.edu) + + * DOC, INSTALL, PROJECTS: Extensive improvements to documentation. + +Sun Aug 13 01:55:18 1995 Craig Burley (burley@gnu.ai.mit.edu) + + * INSTALL (f77-install-ok): Document the use of this file. + + * Make-lang.in (F77_INSTALL_FLAG): New flag to control + whether to install an `f77' command (based on whether + a file named `f77-install-ok' exists in the source or + build directory) to replace the broken attempt to use + comment lines to avoid installing `f77' (broken in the + sense that it prevented installation of `g77'). + +Mon Aug 7 06:14:26 1995 Craig Burley (burley@gnu.ai.mit.edu) + + * DOC: Add new sections for g77 & gcc compiler options, + source code form, and types, sizes and precisions. + Remove lots of old "delta-version" info, or at least + summarize it. + + * INSTALL: Add info here that used to be in DOC. + Other changes. + + * g77.c (lookup_option, main): Check for --print-* options, + so we avoid adding version-determining stuff. + +Wed Jul 26 15:51:03 1995 Craig Burley (burley@gnu.ai.mit.edu) + + * Make-lang.in, Makefile.in (input.j, INPUT_H): New file. + Update dependencies accordingly. + + * bad.c (ffebad_here): Okay to use unknown line/col. + + * compilers.h (@f77-cpp-input): Remove -P option now that + # directives are handled by f771. Update other options + to be more consistent with @c in gcc/gcc.c. Don't run f771 + if -E specified, etc., a la @c. + (@f77): Don't run f771 if -E specified, etc., a la @c. + + * config-lang.in: Avoid use of word "guaranteed". + + * input.j: New file to wrap around gcc/input.h. + + * lex.j: Add support for parsing # directives output by cpp. + (ffelex_cfebackslash_): New function. + (ffelex_cfelex_): New function. + (ffelex_get_directive_line_): New function. + (ffelex_hash_): New function. + (ffelex_include_): Change to not use ffewhere_file_(begin|end). + Also fix bug in pointing to next line (for diagnostics, &c) + following successful INCLUDE. + (ffelex_next_line_): New function that does chunk of code + seen in several places elsewhere in the lexers. + (ffelex_file_fixed): Delay finishing statement until source + line is registered with ffewhere, so INCLUDE processing + picks up the info correctly. + Okay to kill or use unknown line/col objects now. + Handle HASH (#) lines. + Reorder tests for insubstantial lines to put most frequent + occurrences at top, for possible minor speedup. + Some general consolidation of code. + (ffelex_file_free): Handle HASH (#) lines. + Okay to kill or use unknown line/col objects now. + Some general consolidation of code. + (ffelex_init_1): Detect HASH (#) lines. + (ffelex_set_expecting_hollerith): Okay to kill or use unknown + line/col objects now. + + * lex.h (FFELEX_typeHASH): New enum. + + * options-lang.h (-fident, -fno-ident): New options. + + * stw.c (ffestw_update): Okay to kill unknown line/col objects + now. + + * target.h (FFETARGET_okREALQUAD, FFETARGET_okCOMPLEXDOUBLE, + FFETARGET_okCOMPLEXQUAD): #define these appropriately. + + * top.c: Include flag.j wrapper, not flags.h directly. + (ffe_is_ident_): New flag. + (ffe_decode_option): Handle -fident and -fno-ident. + (ffe_file): Replace obsolete ffewhere_file_(begin|end) with + ffewhere_file_set. + + * top.h (ffe_is_ident_, ffe_is_ident, ffe_set_is_ident): + New flag and access functions. + + * where.c, where.h: Remove all tracking of parent file. + (ffewhere_file_begin, ffewhere_file_end): Delete these. + (ffewhere_line_use): Make it work with unknown line object. + +Mon Jul 17 03:04:09 1995 Craig Burley (burley@gnu.ai.mit.edu) + + * com.c (ffecom_sym_transform_): Set DECL_IN_SYSTEM_HEADER + flag for any local vars used as stmtfunc dummies or DATA + implied-DO iter vars, so no -Wunused warnings are produced + for them (a la f2c). + (ffecom_init_0): Do "extern int xargc;" for IARGC() intrinsic. + Warn if target machine not 32 bits, since g77 isn't yet + working on them at all well. + + * expr.c (ffeexpr_sym_lhs_call_, ffeexpr_sym_lhs_data_, + ffeexpr_sym_lhs_extfunc_, ffeexpr_sym_rhs_actualarg_, + ffeexpr_sym_rhs_let_, ffeexpr_paren_rhs_let_): Don't + gratuitously set attr bits that don't apply just + to avoid null set meaning error; instead, use explicit + error flag, and allow null attr set, to + fix certain bugs discovered by looking at this code. + + * g77.c: Major changes to improve support for gcc long options, + to make `g77 -v' report more useful info, and so on. + +Mon Jul 3 14:49:16 1995 Craig Burley (burley@gnu.ai.mit.edu) + + * DOC, com.c, intrin.h, intrin.c, intrin.def, target.h, top.c, + top.h: Add new `unix' group of intrinsics, which includes the + newly added ERF, ERFC, EXIT, plus even newer ABORT, DERF, DERFC, + FLUSH, GETARG, GETENV, SIGNAL, and SYSTEM. + +Tue Jun 27 23:01:05 1995 Craig Burley (burley@gnu.ai.mit.edu) + + * bld.c, bld.h (ffebld_constant_pool, + ffebld_constant_character_pool): Use a single macro (the + former) to access the pool for allocating constants, instead + of latter in public and FFEBLD_CONSTANT_POOL_ internally + in bld.c (which was the only one that was correct before + these changes). Add verification of integrity of certain + heap-allocated areas. + + * com.c (ffecom_overlap_, ffecom_args_overlap_, + ffecom_tree_canonize_ptr_, ffecom_tree_canonize_ref_): New + functions to optimize calling COMPLEX and, someday, CHARACTER + functions requiring additional argument to be passed. + (ffecom_call_, ffecom_call_binop_, ffecom_expr_, + ffecom_expr_intrinsic_): Change calling + sequences to include more info on possible destination. + (ffecom_expr_intrinsic_): Add ERF(), ERFC(), and EXIT() + intrinsic code. + (ffecom_sym_transform_): For assumed-size arrays, set high + bound to highest possible value instead of low bound, to + improve validity of overlap checking. + (duplicate_decls): If olddecl and newdecl are the same, + don't do any munging, just return affirmative. + + * expr.c: Change ffecom_constant_character_pool() to + ffecom_constant_pool(). + + * info.c (ffeinfo_new): Compile this version if not being + compiled by GNU C. + + * info.h (ffeinfo_new): Don't define macro if not being + compiled by GNU C. + + * intrin.c, intrin.def: Add ERF(), ERFC(), and EXIT() intrinsics. + (ffeintrin_check_exit_): New for EXIT() subroutine intrinsic. + + * malloc.c, malloc.h (malloc_verify_*): New functions to verify + integrity of heap-storage areas. + + * stc.c (ffestc_R834, ffestc_R835): Handle possibility that + an enclosing DO won't have a construct name even when the + CYCLE/EXIT does (i.e. without dereferencing NULL). + + * target.c, target.h (ffetarget_verify_character1): New function + to verify integrity of heap storage used to hold character constant. + +Thu Jun 22 15:36:39 1995 Howard Gordon (flash@super.org) + + * stp.h (ffestpVxtcodeIx): Fix typo in typedef for this. + +Mon May 29 15:22:31 1995 Craig Burley (burley@gnu.ai.mit.edu) + + * *: Make all sorts of changes to accommodate upcoming gcc-2.7.0. + I didn't keep track of them, nor just when I made them, nor + when I (much later, probably in early August 1995) modified + them so they could properly handle both 2.7.0 and 2.6.x. + + * com.c (ffecom_expr_power_integer_): Don't expand_start_stmt_expr + if transforming dummy args, because the back end cannot handle + that (it's rejected by the gcc front end), just generate + call to run-time library. + Back out changes in 0.5.15 because more temporaries might be + needed anyway (for COMPLEX**INTEGER). + (ffecom_push_tempvar): Remove inhibitor. + Around start_decl and finish_decl (in particular, arround + expand_decl, which is called by them), push NULL_TREE into + sequence_rtl_expr, an external published by gcc/function.c. + This makes sure the temporary is truly in the function's + context, not the inner context of a statement-valued expression. + (I think the back end is inconsistent here, but am not + interested in convincing the gbe maintainers about this now.) + (pushdecl): Make sure that when pushing PARM_DECLs, nothing + other than them are pushed, as happened for 0.5.15 and which, + if done for other reasons not fixed here, might well indicate + some other problem -- so crash if it happens. + + * equiv.c (ffeequiv_layout_local_): If the local equiv group + has a non-nil COMMON field, it should mean that an error has + occurred and been reported, so just trash the local equiv + group and do nothing. + + * stc.c (ffestc_promote_sfdummy_): Set sfdummy arg state to + UNDERSTOOD so above checking for duplicate args actually + works, and so we don't crash later in pushdecl. + + * ste.c (ffeste_R1001): Set initial value only for VAR_DECLs, + not for, e.g., LABEL_DECLs, which the FORMAT label can be + if it was previously treated as an executable label. + +Sat May 20 01:53:53 1995 Craig Burley (burley@gnu.ai.mit.edu) + + * com.c (ffecom_sym_transform_): For adjustable arrays, + pass high bound through variable_size in case its primaries + are changed (dumb0.f, and this might also improve + performance so it approaches f2c|gcc). + +Fri May 19 11:00:36 1995 Craig Burley (burley@gnu.ai.mit.edu) + + * Version 0.5.15 released. + + * com.c (ffecom_expr_power_integer_): Push temp vars + before expanding a statement expression, since that seems + to cause temp vars to be "forgotten" after the end of the + expansion in the back end. Disallow more temp-var + pushing during such an expansion, just in case. + (ffecom_push_tempvar): Crash if a new variable needs to be + pushed but cannot be at this point (should never happen). + +Wed May 17 12:26:16 1995 Craig Burley (burley@gnu.ai.mit.edu) + + * expr.c (ffeexpr_collapse_convert): Add code to convert + LOGICAL to CHARACTER. Reject conversion of REAL or COMPLEX + to CHARACTER entirely, as it cannot be supported with all + configurations. + + * target.h, target.c (ffetarget_convert_character1_logical1): + New function. + +Sun May 14 00:00:09 1995 Craig Burley (burley@gnu.ai.mit.edu) + + * com.c (ffecom_do_entry_, ffecom_gen_sfuncdef_, + ffecom_start_progunit_, ffecom_sym_transform_, + ffecom_init_0, start_function): Changes to have REAL + external functions return same type as DOUBLE PRECISION + external functions when -ff2c is in force; while at it, + some code cleanups done. + + * stc.c (ffestc_R547_item_object): Disallow array declarator + if one already exists for symbol. + + * ste.c (ffeste_R1227): Convert result variable to type + of function result as seen by back end (e.g. for when REAL + external function actually returns result as double). + + * target.h (FFETARGET_defaultFIXED_LINE_LENGTH): New + macro for default for -ffixed-line-length-N option. + + * top.c (ffe_fixed_line_length_): Initialize this to new + target.h macro instead of constant 72. + +Tue May 9 01:20:03 1995 Craig Burley (burley@gnu.ai.mit.edu) + + * lex.c (ffelex_send_token_): If sending CHARACTER token with + null text field, put a single '\0' in it and set length/size + fields to 0 (to fix 950508-0.f). + (ffelex_image_char_): When setting ffelex_bad_line_ to TRUE, + always "close" card image by appending a null char and setting + ffelex_card_length_. As part of this, append useful text + to identify the two kinds of problems that involve this. + (ffelex_file_fixed): Reset ffelex_bad_line_ to FALSE after + seeing a line with invalid first character (fixes 950508-1.f). + If final nontab column is zero, assume tab seen in line. + (ffelex_card_image_): Always make this array 8 characters + longer than reflected by ffelex_card_size_. + (ffelex_init_1): Get final nontab column info from top instead + of assuming 72. + + * options-lang.h: Add -ffixed-line-length- prefix. + + * top.h: Add ffe_fixed_line_length() and _set_ version, plus + corresponding extern. + + * top.c: Handle -ffixed-line-length- option prefix. + +Fri Apr 28 05:40:25 1995 Craig Burley (burley@gnu.ai.mit.edu) + + * Version 0.5.14 released. + + * Make-lang.in: Add assert.j. + + * Makefile.in: Add assert.j. + + * assert.j: New file. + +Thu Apr 27 16:24:22 1995 Craig Burley (burley@gnu.ai.mit.edu) + + * bad.h (ffebad_severity): New function. + + * bad.c (ffebad_severity): New function. + + * bad.def (FFEBAD_OPEN_INCLUDE): Change severity from SEVERE + to FATAL, since processing continues, and that seems fine. + + * com.c: Add facility to handle -I. + (ffecom_file, ffecom_close_include, ffecom_open_include, + ffecom_decode_include_option): New global functions for -I. + (ffecom_file_, ffecom_initialize_char_syntax_, + ffecom_close_include_, ffecom_decode_include_option_, + ffecom_open_include_, append_include_chain, open_include_file, + print_containing_files, read_filename_string, file_name_map, + savestring): New internal functions for -I. + + * compilers.h: Pass -I flag(s) to f771 (via "%{I*}"). + + * lex.c (ffelex_include_): Call ffecom_close_include + to close include file, for its tracking needs for -I, + instead of using fclose. + + * options-lang.h: Add -I prefix. + + * parse.c (yyparse): Call ffecom_file for main input file, + so -I handling works (diagnostics). + + * std.c (ffestd_S3P4): Have ffecom_open_include handle + opening and diagnosing errors with INCLUDE files. + + * ste.c (ffeste_begin_iterdo_): Use correct algorithm for + calculating # of iterations -- mathematically similar but + computationally different algorithm was not handling cases + like "DO I=6,5,2" correctly, because (5-6)/2+1 => 1, not 0. + + * top.c (ffe_decode_option): Allow -I, restructure a bit + for clarity and, maybe, speed. + +Mon Apr 17 13:31:11 1995 Craig Burley (burley@gnu.ai.mit.edu) + + * g77.c: Remove -lc, turns out not all systems has it, but + leave other changes in for clarity of code. + +Sun Apr 16 21:50:33 1995 Craig Burley (burley@gnu.ai.mit.edu) + + * com.c (ffecom_expr_): Implement ARRAY_EXPR as INDIRECT_REF + of appropriate PLUS_EXPRs of ptr_to_expr of array, to see + if this generates better code. (Conditional on + FFECOM_FASTER_ARRAY_REFS.) + +Sun Apr 16 00:22:48 1995 Craig Burley (burley@gnu.ai.mit.edu) + + * Make-lang.in (F77_SRCS): Remove g77.c, since it doesn't + contribute to building f771. + + * Makefile.in (dircheck): Remove/replace with f/Makefile, because + phony targets that are referenced in other real targets get run + when those targets are specified, which is a waste of time (e.g. + when rebuilding and only g77.c has changed, f771 was being linked + anyway). + + * g77.c: Include -lc between -lf2c and -lm throughout. + + * implic.c (ffeimplic_establish_symbol): If -Wimplicit, warn if + implicit type given to symbol. + + * lex.c (ffelex_include_): Don't gratuitously increment line + number here. + + * top.h, top.c (ffe_is_warn_implicit_): New global variable and + related access macros. + (ffe_decode_option): Handle -W options, including -Wall and + -Wimplicit. + + * where.c (ffewhere_line_new): Don't muck with root line (was + crashing on null input since lexer changes over the past week + or so). + +Thu Apr 13 16:48:30 1995 Craig Burley (burley@gnu.ai.mit.edu) + + * com.c (ffecom_init_0): Register built-in functions for cos, + sin, and sqrt. + (ffecom_tree_fun_type_double): New variable. + (ffecom_expr_intrinsic_): Update f2c input and output files + to latest version of f2c (no important g77-related changes + noted, just bug fixes to f2c and such). + (builtin_function): New function from c-decl.c. + + * com-rt.def: Refer to built-in functions for cos, sin, and sqrt. + +Thu Apr 13 10:25:09 1995 Craig Burley (burley@gnu.ai.mit.edu) + + * com.c (ffecom_expr_intrinsic_): Convert 0. to appropriate + type to keep DCMPLX(I) from crashing the compiler. + (ffecom_expr_): Don't convert result from ffecom_tree_divide_. + (ffecom_tree_divide_): Add tree_type argument, have all callers + pass one, and don't convert right-hand operand to it (this is + to make this new function work as much like the old in-line + code used in ffecom_expr_ as possible). + + * lex.c: Maintain lineno and input_filename the way the gcc + lexer does. + + * std.c (ffestd_exec_end): Save and restore lineno and + input_filename around the second pass, which sets them + appropriately for each saved statement. + +Wed Apr 12 09:44:45 1995 Craig Burley (burley@gnu.ai.mit.edu) + + * com.c (ffecom_expr_power_integer_): New function. + (ffecom_expr_): Call new function for power op with integer second + argument, for generating better code. Also replace divide + code with call to new ffecom_tree_divide_ function. + Canonicalize calls to ffecom_truth_value(_invert). + (ffecom_tree_divide_): New function. + +Wed Apr 5 14:15:44 1995 Craig Burley (burley@gnu.ai.mit.edu) + + * lex.c: Change to allocate text for tokens only when actually + needed, which should speed compilation up somewhat. + Change to allow INCLUDE at any point where a statement + can end, i.e. in ffelex_finish_statement_ or when a SEMICOLON + token is sent. + Remove some old, obsolete code. + Clean up layout of entire file to improve formatting, + readability, etc. + (ffelex_set_expecting_hollerith): Remove include argument. + +Fri Mar 31 23:19:08 1995 Craig Burley (burley@gnu.ai.mit.edu) + + * bad.h, bad.c (ffebad_start_msg, ffebad_start_msg_lex): + New functions to generate arbitrary messages. + (FFEBAD_severityPEDANTIC): New severity, to correspond + to toplev's pedwarn() function. + + * lex.c (ffelex_backslash_): New function to implement + backslash processing. + (ffelex_file_fixed, ffelex_file_free): Implement new + backslash processing. + + * std.c (ffestd_R1001dump_): Don't assume CHARACTER and + HOLLERITH tokens stop at '\0' characters, now that backslash + processing is supported -- use their advertised lengths instead, + and double up the '\002' character for libf2c. + +Mon Mar 27 17:10:33 1995 Craig Burley (burley@gnu.ai.mit.edu) + + * com.c (ffecom_init_local_zero_): Implement -finit-local-zero. + (ffecom_sym_transform_): Same. + (ffecom_transform_equiv_): Same. + + * options-lang.h: Add -f(no-)(init-local-zero,backslash,ugly-init). + + * stb.c (ffestb_V020): Reject "TYPEblah(...", which might be + an array assignment. + + * target.h, top.h, top.c: Implement -finit-local-zero. + +Fri Mar 24 19:56:22 1995 Craig Burley (burley@gnu.ai.mit.edu) + + * Make-lang.in, Makefile.in: Remove conf-proj(.in) and + proj.h(.in) rules, plus related config.log, config.cache, + and config.status stuff. + + * com.c (ffecom_init_0): Change messages when atof(), bsearch(), + or strtoul() do not work as expected in the start-up test. + + * conf-proj, conf-proj.in: Delete. + + * lex.c (ffelex_file_fixed): Allow f2c's '&' in column 1 + to mean continuation line. + + * options-lang.h: New file, #include'd by ../toplev.c. + + * proj.h.in: Rename back to proj.h. + + * proj.h (LAME_ASSERT): Remove. + (LAME_STDIO): Remove. + (NO_STDDEF): Remove. + (NO_STDLIB): Remove. + (NO_BSEARCH): Remove auto detection, rename to !FFEPROJ_BSEARCH. + (NO_STRTOUL): Remove auto detection, rename to !FFEPROJ_STRTOUL. + (USE_HOST_LIMITS): Remove (maybe still needed by stand-alone?). + (STR, STRX): Do only ANSI C definitions. + +Mon Mar 13 10:46:13 1995 Craig Burley (burley@gnu.ai.mit.edu) + + * BUGS: Add item about g77 requiring gcc to compile it. + + * NEWS: New file listing user-visible changes in the release. + + * PROJECTS: Update to include a new item or two, and modify + or delete items that are addressed in this or previous releases. + + * bad.c (ffebad_finish): Don't crash if missing string &c, + just substitute obviously distressed string "[REPORT BUG!!]" + for cases where the message/caller are fudgy. + + * bad.def: Clean up error messages in a major way, add new ones + for use by changes in target.c. + + * com.c (ffecom_expr_): Handle opANY in opCONVERT. + (ffecom_let_char_): Disregard destinations with ERROR_MARK. + (ffecom_1, ffecom_1_fn, ffecom_2, ffecom_2s, ffecom_3, + ffecom_3s, &c): Check all inputs for error_mark_node. + (ffecom_start_progunit_): Don't transform all symbols + in BLOCK DATA, since it never executes, and it is silly + to, e.g., generate all the structures for NAMELIST. + (ffecom_char_length_expr_): Rename to ffecom_intrinsic_len_. + (ffecom_intrinsic_ichar_): New function to handle ICHAR of + arbitrary expression with possible 0-length operands. + (ffecom_expr_intrinsic_): Use ffecom_intrinsic_char_. + For MVBITS, set tree_type to void_type_node. + (ffecom_start_progunit_): Name master function for entry points + after primary entry point so users can easily guess it while + debugging. + (ffecom_arg_ptr_to_expr): Change treatment of Hollerith, + Typeless, and %DESCR. + (ffecom_expr_): Change treatment of Hollerith. + + * data.c (ffedata_gather_): Handle opANY in opCONVERT. + + * expr.c (ffeexpr_token_apostrophe_): Issue FFEBAD_NULL_CHAR_CONST + warning as necessary. + (ffeexpr_token_name_rhs_): Set context for args to intrinsic + so that assignment-like concatenation is allowed for ICHAR(), + IACHAR(), and LEN() intrinsics. + (ffeexpr_reduced_*_): Say "an array" instead of "an entity" in + diagnostics, since it's more informative. + (ffeexpr_finished_): For many contexts, check for null expression + and array before trying to do a conversion, to avoid redundant + diagnostics. + + * g77.1: Fix typo for preprocessed suffix (.F, not .f). + + * global.c (ffeglobal_init_common): Warn if initializing + blank common. + (ffeglobal_pad_common): Enable code to warn if initial + padding needed. + (ffeglobal_size_common): Complain if enlarging already- + initialized common, since it won't work right anyway. + + * intrin.c: Add IMAG() intrinsic. + (ffeintrin_check_loc_): Allow opSUBSTR in LOC(). + + * intrin.def: Add IMAG() intrinsic. + + * lex.c: Don't report FFEBAD_NULL_CHAR_CONST errors. + + * sta.c, sta.h, stb.c: Changes to clean up error messages (see + bad.def). + + * stb.c (ffestb_R100113_): Issue FFEBAD_NULL_CHAR_CONST + warning as necessary. + + * stc.c (ffestc_shriek_do_): Don't try to reference doref_line + stuff in ANY case, since it won't be valid. + (ffestc_R1227): Allow RETURN in main program unit, with + appropriate warnings/errors. + (ffestc_subr_format_): Array of any type is a CHAREXPR (F77 C5). + + * ste.c (ffeste_begin_doiter_): Couple of fixes to accurately + determine if loop never executes. + + * target.c (ffetarget_convert_*_hollerith_): Append spaces, + not zeros, to follow F77 Appendix C, and to warn when + truncation of non-blanks done. + (ffetarget_convert_*_typeless): Rewrite to do typeless + conversions properly, and warn when truncation done. + (ffetarget_print_binary, ffetarget_print_octal, + ffetarget_print_hex): Rewrite to use new implementation of + typeless. + (ffetarget_typeless_*): Rewrite to use new implementation + of typeless, and to warn about overflow. + + * target.h (ffetargetTypeless): New implementation of + this type. + + * type.h, type.c (ffetype_size_typeless): Remove (incorrect) + implementation of this function and its extern. + +Sun Mar 5 18:46:42 1995 Craig Burley (burley@gnu.ai.mit.edu) + + * BUGS: Clarify that constant handling would also fix lack of + adequate IEEE-754/854 support to some degree, and typeless + and non-decimal constants. + + * com.c (ffecom_type_permanent_copy_): Comment out to avoid + warnings. + (duplicate_decls): New function a la gcc/c-decl.c. + (pushdecl): Use duplicate_decls to decide whether to return + existing decl or new one, instead of always returning existing + decl. + (ffecom_expr_): opPERCENT_LOC now supports CHARACTER arguments. + (ffecom_init_0): Give f2c I/O code 0 for basictypeANY/kindtypeANY. + (ffecom_sym_transform_): For adjustable arrays, pass low bound + through variable_size in case its primaries are changed (950302-1.f). + + * com.h: More decls that belong in tree.h &c. + + * data.c (ffedata_eval_integer1_): Fix opPAREN case to not + treat value of expression as an error code. + + * expr.c (ffeexpr_finished_): Allow opSUBSTR in contextLOC case. + + * proj.c: Add "const" as appropriate. + +Mon Feb 27 10:04:03 1995 Craig Burley (burley@gnu.ai.mit.edu) + + * bad.def (FFEBAD_BAD_SUBSTR): Fix bad grammar in message. + +Fri Feb 24 16:21:31 1995 Craig Burley (burley@gnu.ai.mit.edu) + + * Version 0.5.13 released. + + * INSTALL: Warn that f/zzz.o will compare differently between + stages, since it puts the __TIME__ macro into a string. + + * com.c (ffecom_sym_transform_): Transform kindFUNCTION/whereDUMMY + to pointer-to-function, not function. + (ffecom_expr_): Use ffecom_arg_ptr_to_expr instead of + ffecom_char_args_ to handle comparison between CHARACTER + types, so either operand can be a CONCATENATE. + (ffecom_transform_common_): Set size of initialized common area + to global (largest-known) size, even though size of init might + be smaller. + + * equiv.c (ffeequiv_offset_): Check symbol info for ANY. + + * expr.c (ffeexpr_find_close_paren_, ffeexpr_nil_*): New functions + to handle following the contour of a rejected expression, so + statements like "PRINT(I,I,I)=0" don't cause the PRINT statement + code to get the second passed back to it as if there was a + missing close-paren before it, the comma causing the PRINT code + to confirm the statement, resulting in an ambiguity vis-a-vis + the let statement code. + Use the new ffecom_find_close_paren_ handler when an expected + close-paren is missing. + (ffeexpr_isdigits_): New function, use in all places that + currently use isdigit in repetitive code. + (ffeexpr_collapse_symter): Collapse to ANY if init-expr is ANY, + so as to avoid having symbol get "transformed" if used to + dimension an array. + (ffeexpr_token_real_, ffeexpr_token_number_real_): Don't issue + diagnostic about exponent, since it'll be passed along the + handler path, resulting in a diagnostic anyway. + (ffeexpr_token_apos_char_): Use consistent handler path + regardless of whether diagnostics inhibited. + (ffeexpr_token_name_apos_name_): Skip past closing quote/apos + even if not a match or other diagnostic issued. + (ffeexpr_sym_impdoitem_): Exec-transition local SEEN symbol. + + * lex.c (ffelex_image_char_): Set ffelex_saw_tab_ if TAB + seen, not if anything other than TAB seen! + + * stc.c (ffestc_R537_item): If source is ANY but dest isn't, + set dest symbol's init expr to ANY. + (ffestc_R501_attrib, ffestc_R522, ffestc_R522start): Complain + about conflict between "SAVE" by itself and other uses of + SAVE only in pedantic mode. + + * ste.c (ffeste_R1212): Fix loop over labels to always + increment caseno, to avoid pushcase returning 2 for duplicate + values when one of the labels is invalid. + +Thu Feb 23 12:42:04 1995 Craig Burley (burley@gnu.ai.mit.edu) + + * Version 0.5.12 released. + + * Make-lang.in (f77.install-common): Add "else true;" before outer + "fi" per Makefile.in patch. + + * Makefile.in (dircheck): Add "else true;" before "fi" per + patch from chs1pm@surrey.ac.uk. + + * com.c (ffecom_push_tempvar): If type desired is ERROR_MARK, + return error_mark_node, to avoid crash that results from + making a VAR_DECL with error_mark_node as its type. + + * ste.c (ffeste_begin_iterdo_): Convert itercount to INTEGER + anytime calculation of number of iterations ends up with type + other than INTEGER (e.g. DOUBLE PRECISION, REAL). + +Thu Feb 23 02:48:38 1995 Craig Burley (burley@gnu.ai.mit.edu) + + * Version 0.5.11 released. + + * DOC: Explain -fugly-args. + + * bad.def (FFEBAD_ACTUALARG): Explain -fugly-args and how to + rewrite code to not require it. + + * com.c (ffecom_vardesc_): Handle negative type code, just in + case. + (ffecom_arg_ptr_to_expr): Let ffecom_expr handle hollerith + and typeless constants (move code to ffecom_constantunion). + (ffecom_constantunion): Handle hollerith and typeless constants. + + * expr.c (ffecom_finished_): Check -fugly-args in actual-arg + context where hollerith/typeless provided. + + * intrin.def (FFEINTRIN_genDFLOAT): Add FFEINTRIN_specDFLOAT. + (FFEINTRIN_specDFLOAT): Add as f2c intrinsic. + + * target.h (ffetarget_convert_real[12]_integer, + ffetarget_convert_complex[12]_integer): Pass -1 for high integer + value if low part is negative. + (FFETARGET_defaultIS_UGLY_ARGS): New macro. + + * top.c (ffe_is_ugly_args_): New variable. + (ffe_decode_option): Handle -fugly-args and -fno-ugly-args. + + * top.h (ffe_is_ugly_args_, ffe_is_ugly_args(), + ffe_set_is_ugly_args()): New variable and macros. + +Thu Feb 23 02:48:38 1995 Pedro A M Vazquez (vazquez@iqm.unicamp.br) + + * g77.c (sys_errlist): Use const for __FreeBSD__ systems + as well. + +Wed Feb 22 13:33:43 1995 Craig Burley (burley@gnu.ai.mit.edu) + + * Version 0.5.10 released. + + * CREDITS: Add Rick Niles. + + * INSTALL: Note how to get around lack of makeinfo. + + * Make-lang.in (f/proj.h): Remove # comment. + + * Makefile.in (f/proj.h): Remove # comment. + + * com.c (ffecom_expr_): Simplify opFUNCREF/opSUBRREF conversion. + (ffecom_sym_transform_): For whereGLOBAL and whereDUMMY + kindFUNCTION, use ffecom_tree_fun_type[][] only for non-constant + (non-statement-function) f2c functions. + (ffecom_init_0): ffecom_tree_fun_type[][] and _ptr_to_*_* are + really f2c-interface arrays, so use base type void for COMPLEX + (like CHARACTER). + +Tue Feb 21 19:01:18 1995 Dave Love <d.love@dl.ac.uk> + + * Make-lang.in (f77.install-common): Expurgate the test for and + possible installation of f2c in line with elsewhere. Seems to have + been missing a semicolon anyhow! + +Tue Feb 21 11:45:25 1995 Craig Burley (burley@gnu.ai.mit.edu) + + * Version 0.5.9 released. + + * Make-lang.in (f/proj.h): touch file to register update, + because the previous commands won't necessarily modify it. + + * Makefile.in (f/proj.h): touch file to register update, + because the previous commands won't necessarily modify it. + + * Makefile.in (f/str-*.h, f/str-*.j): Explicitly specify + output file names, so these targets go in build, not source, + directory. + + * bits.c, bits.h: Switch to valid ANSI C replacement for + ARRAY_ZERO. + + * com.c (ffecom_expr_): Add assignp arg to support ASSIGN better. + If assignp is TRUE, use different tree for FFEBLD_opSYMTER case. + (ffecom_sym_transform_assign_): New function. + (ffecom_expr_assign): New function. + (ffecom_expr_assign_w): New function. + + * com.c (ffecom_f2c_make_type_): Do make_signed_type instead + of make_unsigned_type throughout. + + * com.c (ffecom_finish_symbol_transform_): Expand scope of + commented-out code to probably produce faster compiler code. + + * com.c (ffecom_gen_sfuncdef_): Push/pop calltemps so + COMPLEX works right. + Remove obsolete comment. + + * com.c (ffecom_start_progunit_): If non-multi alt-entry + COMPLEX function, primary (static) entry point returns result + directory, not via extra arg -- to agree with ffecom_return_expr + and others. + Pretransform all symbols so statement functions are defined + before any code emitted. + + * com.c (ffecom_finish_progunit): Don't posttransform all + symbols here -- pretransform them instead. + + * com.c (ffecom_init_0): Don't warn about possible ASSIGN + crash, as this shouldn't happen now. + + * com.c (ffecom_push_tempvar): Fix to handle temp vars + pushed while context is a statement (nested) function, and + add appropriate commentary. + + * com.c (ffecom_return_expr): Check TREE_USED to determine + where return value is unset. + + * com.h (struct _ffecom_symbol_): Add note about length_tree + now being used to keep tree for ASSIGN version of symbol. + + * com.h (ffecom_expr_assign, ffecom_expr_assign_rw): New decls. + (error): Add this prototype for back-end function. + + * fini.c (main): Grab input, output, and include names + directly off the command line instead of making the latter + two out of the first. + + * lex.c: Improve tab handling for both fixed and free source + forms, and ignore carriage-returns on input, while generally + improving the code. ffelex_handle_tab_ has been renamed and + reinvented as ffelex_image_char_, among other things. + + * malloc.c, malloc.h: Switch to valid ANSI C replacement for + ARRAY_ZERO, and kill the full number of bytes in pools and + areas. + + * proj.h.in (ARRAY_ZERO, ARRAY_ZERO_SIZE): Remove. + + * ste.c (ffeste_io_cilist_, ffeste_io_icilist_, ffeste_R838, + ffeste_R839): Issue diagnostic if a too-narrow variable used in an + ASSIGN context despite changes to this code and code in com.c. + + * where.c, where.h: Switch to valid ANSI C replacement for + ARRAY_ZERO. + +Fri Feb 17 03:35:19 1995 Craig Burley (burley@gnu.ai.mit.edu) + + * Version 0.5.8 released. + + * INSTALL: In quick-build case, list g77 target first so g77 + gets installed. Also, explain that gcc gets built and installed + as well, even though this isn't really what we want (and maybe + we'll find a way around this someday). + +Fri Feb 17 02:35:41 1995 Craig Burley (burley@gnu.ai.mit.edu) + + * Version 0.5.7 released. + + * Makefile.in (CONFIG_H, HCONFIG_H, TCONFIG_H, TM_H): Remove + ../ prefix in front of .h files, since they're in the cd. + +Fri Feb 17 01:50:48 1995 Craig Burley (burley@gnu.ai.mit.edu) + + * Version 0.5.6 released. + +Thu Feb 16 20:26:54 1995 Craig Burley (burley@gnu.ai.mit.edu) + + * ../README.g77: Remove description of g77 as "not-yet-published". + + * CREDITS: More changes. + + * Make-lang.in (G77STAGESTUFF): Remove cktyps stuff. + + * Makefile.in (CONFIG_H, HCONFIG_H, TCONFIG_H, TM_H): Don't + prefix gcc dir with $(srcdir) since these don't live there, + they are created in the build dir by gcc's configure. Add + a note explaining what these macros are about. + Update dependencies via deps-kinda. + + * README.NEXTSTEP: Credit Toon, and per his request, add his + email address. + + * com.h (FFECOM_DETERMINE_TYPES): #include "config.j". + + * config.j, convert.j, flags.j, hconfig.j, rtl.j, tconfig.j, + tm.j, tree.j: Don't #include if already done. + + * convert.j: #include "tree.j" first, as convert.h clearly depends + on trees being defined. + + * rtl.j: #include "config.j" first, since there's some stuff + in rtl.h that assumes it has been #included. + + * tree.j: #include "config.j" first, or real.h makes inconsistent + decision about return type of ereal_atof, leading to bugs, and + because tree.h/real.h assume config.h already included. + +Wed Feb 15 14:40:20 1995 Craig Burley (burley@gnu.ai.mit.edu) + + * Version 0.5.5 released. + + * Copyright notices updated to be FSF-style. + + * INSTALL: Some more clarification regarding building just f77. + + * Make-lang.in (F77_SRCS): Update wrt changing some .h to .j. + (install-libf77): Fix typo in new parenthetical note. + + * Makefile.in (f/*.o): Update. + (CONFIG_H, CONVERT_H, FLAGS_H, GLIMITS_H, HCONFIG_H, RTL_H, + TCONFIG_H, TM_H, TREE_H): Update/new symbols. + (deps-kinda): More fixes wrt changing some .h to .j. + Document and explain this rule a bit better. + Accommodate changes in output of gcc -MM. + + * *.h, *.c: Change #include's so proj.h not assumed to #include + malloc.h or config.h (now config.j), and so new .j files are + used instead of old .h ones. + + * com.c (ffecom_init_0): Use FLOAT_TYPE_SIZE for f2c's + TYLONG/TYLOGICAL type codes, to get g77 working on Alpha. + + * com.h: Make all f2c-related integral types "int", not "long + int". + + * config.j, convert.j, flags.j, glimits.j, hconfig.j, rtl.j, + tconfig.j, tm.j, tree.j: New files wrapping around gbe + .h files. + + * config.h, convert.h, flags.h, glimits.h, hconfig.h, rtl.h, + tconfig.h, tm.h, tree.h: Deleted so new .j files + can #include the gbe files directly, instead of using "../", + and thus do better with various kinds of builds. + + * proj.h: Delete unused NO_STDDEF and related stuff. + +Tue Feb 14 08:28:08 1995 Craig Burley (burley@gnu.ai.mit.edu) + + * BUGS: Remove item #12, cross-compiling & autoconf scripts + reportedly expected to work properly (according to d.love). + + * INSTALL: Add explanation of d.love's patch to config-lang.in. + Add explanation of how to install just g77 when gcc already installed. + Add note about usability of "-Wall". Add note about bug- + reporting. + + * Make-lang.in ($(srcdir)/f/conf-proj): Add comment about why + conf-proj.out. + (install-libf77): Echo parenthetical note to user about how to do + just the (aborted) libf2c installation. + (deps-kinda): Update to work with new configuration/build stuff. + + * bad.c (ffebad_finish): Put capitalized "warning:" &c message + as prefix on any diagnostic without pointers into source. + + * bad.def (FFEBAD_TOO_BIG_INIT): Add this warning message. + + * config-lang.in: Add Dave Love's patch to catch case where + back-end patches not applied and abort configuration. + + * data.c (ffedata_gather_, ffedata_value_): Warn when about + to initialize a large aggregate area, due to design flaw resulting + in too much time/space used to handle such cases. + Use COMMON area name, and first notice of symbol, for multiple- + initialization diagnostic, instead of member symbol and unknown + location. + (FFEDATA_sizeTOO_BIG_INIT_): New macro per above. + +Mon Feb 13 13:54:26 1995 Dave Love <d.love@dl.ac.uk> + + * Make-lang.in (F77_SRCS): Use $(srcdir)/f/proj.h.in, not + $(srcdir)/f/proj.h for build outside srcdir. + +Sun Feb 12 13:37:11 1995 Craig Burley (burley@gnu.ai.mit.edu) + + * ../README.g77: Clarify procedures for unpacking, add asterisks + to mark important things the user must do. + + * Fix dates in/add dates to ../README.g77, BUGS, CREDITS, DOC, + INSTALL, PROJECTS, README. + +Sun Feb 12 00:26:10 1995 Craig Burley (burley@gnu.ai.mit.edu) + + * Version 0.5.4 released. + + * Make-lang.in (f/proj.h): Reproduce this rule here from + Makefile.in. + ($(srcdir)/f/conf-proj): Put autoconf's stdout in temp file + conf-proj.out, then mv to conf-proj only if successful, so + conf-proj not touched if autoconf not installed. + + * Makefile.in ($(srcdir)/conf-proj): See Make-lang.in's similar + rule. + +Sat Feb 11 20:56:02 1995 Craig Burley (burley@gnu.ai.mit.edu) + + * BUGS: Clarify some bugs. + + * DOC: Many improvements and fixes. + + * README: Move bulk of text, edited, to ../README.g77, and + replace with pointer to that file. + + * com.c (ffecom_init_0): Comment out warning about sizeof(ftnlen) + as per ste.c change. Add text about ASSIGN to help user understand + what is being warned about. + + * conf-proj.in: Fix typos in comments. + + * proj.h.in: Add ARRAY_ZERO_SIZE to parallel malloc.h's version, + in case it proves to be needed. + + * ste.c: Comment out assertions requiring sizeof(ftnlen) >= + sizeof(char *), in the hopes that overflow will never happen. + (ffeste_R838): Change assertion to fatal() with at least + partially helpful message. + +Sat Feb 11 12:38:00 1995 Craig Burley (burley@gnu.ai.mit.edu) + + * com.c (ffecom_vardesc_): Crash if typecode is -1. + + * ste.c (ffeste_io_dolio_): Crash if typecode is -1. + +Sat Feb 11 09:51:57 1995 Craig Burley (burley@gnu.ai.mit.edu) + + * ste.c: In I/O code tests for item arrayness, sort of revert + to much earlier code that tests original exp, but also check + in newer way just in case. Newer way alone treated FOO(1:40) + as an array, not sure why older way alone didn't work, but I + think maybe it was when diagnosed code was involved, and + since there are now checks for error_mark_node, maybe the old + way alone would work. But better to be safe; both original + ffebld exp _and_ the transformed tree must indicate an array + for the size-determination code to be used, else just 1/2 elements + assumed. And this text is for EMACS: (foo at bar). + +Fri Feb 10 11:05:50 1995 Craig Burley (burley@gnu.ai.mit.edu) + + * ste.c: In many cases, surround statement-expansion code + with ffecom_push_calltemps () and ffecom_pop_calltemps () + so COMPLEX-returning functions can have temporaries pushed + in "auto-pop" mode and have them auto-popped at the end of + the statement. + +Wed Feb 8 14:35:10 1995 Dave Love <d.love@dl.ac.uk> + + * runtime/f2c.h.in (ftnlen, ftnint): Make same size as integer. + + * runtime/libI77/err.c (f_init): Thinko in MISSING_FILE_ELEMS + conditional. + * runtime/libI77/wrtfmt.c (mv_cur): Likewise. + * runtime/libI77/wsfe.c (x_putc): Likewise. + + * runtime/libF77/signal_.c (signal_): Return 0 (this is a + subroutine). + + * Makefile.in (f/proj.h): Depend on com.h. + * Make-lang.in (include/f2c.h): Likewise (and proj.h). + (install-libf77): Also install f2c.h. + + * runtime/libI77/Makefile.in (*.o): Add f2c.h dependency. + * runtime/libF77/Makefile.in: Likewise. + +Wed Feb 8 13:56:47 1995 Craig Burley (burley@gnu.ai.mit.edu) + + * stc.c (ffestc_R501_item): Don't reset kind/where to NONE when + setting basictype/kindtype info for symbol, or especially + its function/result twin, because kind/where might not be NONE. + +Tue Feb 7 14:47:26 1995 Dave Love <d.love@dl.ac.uk> + + * Make-lang.in (include/f2c.h:): Set shell variable src more + robustly (independent of whether srcdir is relative or absolute). + * Makefile.in (f/proj.h:): Likewise. + + * conf-proj.in: Check need for LAME_ASSERT. Fix indentation in + check for LAME_STDIO (cosmetic only with ANSI C). + + * com.h: Extra ...SIZE stuff taken from com.c. + + * com.c (FFECOM_DETERMINE_TYPES): Define before including com.h. + (BITS_PER_WORD etc.) Remove and use conditional definitions to com.h. + + * runtime/configure.in: #define FFECOM_DETERMINE_TYPES for com.h in + f2c type determination. + + * tm.h: Remove (at least pro tem) because of relative path and use + top-level one. + + * Make-lang.in (include/f2c.h:): Set shell variable src more + robustly (independent of whether srcdir is relative or absolute). + * Makefile.in (f/proj.h:): Likewise. + +Mon Feb 6 19:58:32 1995 Dave Love <d.love@dl.ac.uk> + + * g77.c (append_arg): Use K&R declaration for, e.g. SunOS4 build. + +Fri Feb 3 20:33:14 1995 Craig Burley (burley@gnu.ai.mit.edu) + + * g77.c (main): Treat -l like filename in terms of -x handling. + Rewrite arglist mechanism for ease of maintenance. + Make sure every -lf2c is followed by -lm and vice versa. + + * Make-lang.in: Put complete list of sources in F77_SRCS def + so changing a .h file, for example, causes rebuild. + + * Makefile.in: Change test for nextstep to m68k-next-nextstep* so + all versions of nextstep on m68k get the necessary flag. + +Fri Feb 3 19:10:32 1995 Dave Love <d.love@dl.ac.uk> + + * INSTALL: Note about possible conflict with existing libf2c.a and + f2c.h. + + * Make-lang.in (f77.distclean): Tidy and move deletion of + f/config.cache to mostlyclean. + (install-libf77): Test for $(libdir)/libf2c.* and barf if found + unless F2CLIBOK defined. + + * runtime/Makefile.in (all): Change path to include directory (and + elsewhere). + (INCLUDES): Remove (unused/misleading). + (distclean): Include f2c.h. + (clean): Include config.cache. + + * runtime/libF77/Makefile.in (.SUFFIXES): Correct typo. + (ALL_CFLAGS) Fix up include search path to find f2c.h in top level + includes always. + (all): Depend on f2c.h. + * runtime/libI77/Makefile.in (.SUFFIXES): Likewise. + +Thu Feb 2 17:17:06 1995 Dave Love <d.love@dl.ac.uk> + + * INSTALL: Note about --srcdir and GNU make. + + * runtime/f2c.h.in (Pad_UDread, ALWAYS_FLUSH): Reomve the #defines + per below. + + * runtime/configure.in (Pad_UDread, ALWAYS_FLUSH): Define these + here, not in f2c.h as they'r eonly relevant for building. + * runtime/configure: Regenerated. + + * config-lang.in: Warn about using GNU make outside source tree + since I can't get Irix5 or SunOS4 makes to work in this case. + + * Makefile.in (VPATH): Don't set it here. + (srcdir): Make it the normal `.' (overridden) at top level. + (all.indirect): New dependency `dircheck'. + (f771): Likewise + (dircheck): New target for foolproofing. + (f/proj.h:): Change finding source. + (CONFIG_H): Don't use this as the relative path in the include loses + f builddir != srcdir. + + * config.h: Remove per CONFIG_H change above. + + * Make-lang.in (F77_FLAGS_TO_PASS): Remove GCC_FOR_TARGET. + (f771:): Pass VPATH, srcdir to sub-make. + (f/Makefile:): New target. + (stmp-int-hdrs): new variable for cheating build. + (f77-runtime:): Alter GCC_FOR_TARGET treatment. + (include/f2c.h f/runtime/Makefile:) Likewise. + (f77-runtime-unsafe:): New (cheating) target. + +Thu Feb 2 12:09:51 1995 Craig Burley (burley@gnu.ai.mit.edu) + + * BUGS: Update regarding losing EQUIVALENCE members in -g, and + regarding RS/6000 problems in the back end. + + * CREDITS: Make some changes as requested. + + * com.c (ffecom_member_trunk_): Remove unused static variable. + (ffecom_finish_symbol_transform_): Improve comments. + (ffecom_let_char_): Fix size of temp address-type var. + (ffecom_member_phase2_): Try fixing problem fixed by change + to ffecom_transform_equiv_ (f_m_p2_ function currently not used). + (ffecom_transform_equiv_): Remove def of unused static variable. + Comment-out use of ffecom_member_phase2_, until problems with + back end fixed. + (ffecom_push_tempvar): Fix assertion to not crash okay code. + + * com.h: Remove old, commented-out code. + Add prototype for warning() in back end. + + * ste.c (ffeste_io_dofio_, ffeste_io_dolio_, ffeste_io_douio_, + ffeste_io_icilist_): Check correct type of variable for arrayness. + +Sun Jan 29 14:41:42 1995 Dave Love <d.love@dl.ac.uk> + + * BUGS: Remove references to my configure bugs; add another. + + * runtime/Makefile.in (AR_FLAGS): Provide default value. + + * runtime/f2c.h.in (integer, logical): Take typedefs from + F2C_INTEGER configuration parameter again. + (NON_UNIX_STDIO): don't define it. + + * runtime/configure.in: Bring type checks for f2c.h in line with + com.h. + (MISSING_FILE_ELEMS): New variable to determine whether the relevant + elements of the FILE struct exist, independent of NON_UNIX_STDIO. + * runtime/libI77/{err,wrtfmt,wsfe}.c (MISSING_FILE_ELEMS): Use new + parameter. + + * config-lang.in: Comment out more of f2c rules (c.f. Make-lang.in). + (This stuff is relevant iff you gave configure --enable-f2c.) + Create f/runtime directory tree iff not building in source + directory. + + * Makefile.in (srcdir): Append slash so we get the right value when + not building in the source directory. This is a consequence of not + building the `f' sources in `f'. + (VPATH): Override configure's value for reasons above. + (f/proj.h f/conf-proj): New rules to build proj.h by + autoconfiguration. + + * proj.h: Rename to proj.h.in for autoconfiguration. + * proj.h.in: New as above. + * conf-proj conf-proj.in: New files for autoconfiguration. + + * Make-lang.in (include/f2c.h f/runtime/Makefile:): Change the order + of setting the sh variables so that the right GCC_FOR_TARGET is + used. + (f77.*clean:) Add products of new configuration files and make sure + all the *clean targets do something (unlike the ones in + cp/Make-lange.in). + + * com.h (FFECOM_f2cINTEGER, FFECOM_f2cLOGICAL): Define as long or + int appropriately to ensure sizeof(real) == sizeof(integer). + + * PROJECTS: Library section. + + * runtime/libI77/endfile.c: Don't #include sys/types.h conditional + on NON_UNIX_STDIO since rawio.h needs size_t. + * runtime/libI77/uio.c: #include <sys/types.h> for size_t if not + KR_headers. + +Wed Jan 25 03:31:51 1995 Craig Burley (burley@gnu.ai.mit.edu) + + * Version 0.5.3 released. + + * INSTALL: Revise. + + * Make-lang.in: Comment out rules for building f2c itself (f/f2c/). + + * README: Revise. + + * com.c (ffecom_init_0): Warn if ftnlen or INTEGER not big enough + to hold a char *. + + * gbe/2.6.2.diff: Update. + +Mon Jan 23 17:10:49 1995 Craig Burley (burley@gnu.ai.mit.edu) + + * TODO: Remove. + BUGS: New file. + PROJECTS: New file. + CREDITS: New file. + + * cktyps*: Remove. + Make-lang.in: Remove cktyps stuff. + Makefile.in: Remove cktyps stuff. + + * DOC: Add info on changes for 0.5.3. + + * bad.c: Put "warning:" &c on diagnostic messages. + Don't output informational messages if warnings disabled. + +Thu Jan 19 12:38:13 1995 Craig Burley (burley@gnu.ai.mit.edu) + + * g77.c: Avoid putting out useless "-xnone -xf77" pairs so + larger command lines can be accommodated. + Recognize both `-xlang' and `-x lang'. + Recognize `-xnone' and `-x none' to mean what it does, instead + of treating "none" as any other language. + Some minor, slight improvements in the way args are handled + (hopefully for clearer, more maintainable code), including + consistency checks on arg count just in case. + +Wed Jan 18 16:41:57 1995 Craig Burley (burley@gnu.ai.mit.edu) + + * DOC: Explain -fautomatic better. + + * INSTALL: Describe libf2c.a better. + + * Make-lang.in, Makefile.in: Build f771 &c with gcc/ as cd instead + of gcc/f/ so debugging info is better (source file tracking). + Add new source file type.c. + + * Makefile.in: For nextstep3, link f771 with -segaddr __DATA + 6000000. Fix typo. Change deps-kinda target to handle building + from gcc/. Update dependencies. + + * bld-op.def, bld.h, bld.c: Remove opBACKEND and all related + stuff. + Remove consistency tests that cause compiler warnings. + + * cktyps.c: Remove all typing checking. + + * com-rt.def: Change all rttypeFLOAT_ intrinsics to rttypeDOUBLE_, + to precisely match how they're declared in libf2c. + + * com.h, com.c: Revise to more elegantly track related stuff + in the version of f2c.h used to build libf2c. + + * com.c: Increase FFECOM_sizeMAXSTACKITEM, and if 0 or undefined + when checked to determine where to put entity, treat as infinite. + Rewrite temporary mechanism to be based on trees instead of + ffeinfo stuff, and make it much simpler. Change interface + accordingly. + Fixes to better track types of things, make appropriate + conversions, etc. E.g. when making an arg for a libf2c + function, make sure it's of the right type (such as ftnlen). + Delete opBACKEND transformation code. + (ffecom_init_0): Smoother initialization of types, especially + paying attention to using consistent rules for making INTEGER, + REAL, DOUBLE PRECISION, etc., and for deciding their "*N" + and kind values that will work across all g77 platforms. + No longer require per-target configuration info in target.h + or config/*/*; use new type module to store size, alignment. + (ffecom_member_phase2): Declare COMMON/EQUIVALENCE group members + so debugger sees them. + (ffecom_finish_progunit): Transform all symbols in program unit, + so -g will show they all exist. + + * expr.c (ffeexpr_collapse_substr): Handle strange substring + range values. + + * info.h, info.c: Provide connection to new type module. + Remove tests that yield compiler warnings. + + * intrin.c (ffeintrin_is_intrinsic): Properly handle deleted + intrinsic. + + * lex.c (ffelex_file_fixed): Remove redundant/buggy code. + + * stc.c (ffestc_kindtype_kind_, ffestc_kindtype_star_): Replace + boring switch stmt with simple call to new type module. This + sort of thing is a reason to get up in the morning. + + * ste.c: Update to handle new interface for + ffecom_push/pop_tempvar. + Fixes to better track types of things. + Fixes to not crash for certain diagnosed constructs. + (ffeste_begin_iterdo_): Check only constants for overflow to avoid + spurious diagnostics. + Don't convert larger integer (say, INTEGER*8) to canonical integer + for iteration count. + + * stw.h: Track DO iteration count temporary variable. + + * symbol.c: Remove consistency tests that cause compiler warnings. + + * target.c (ffetarget_aggregate_info): Replace big switch with + little call to new type module. + (ffetarget_layout): Remove consistency tests that cause + compiler warnings. + (ffetarget_convert_character1_typeless): Pick up length of + typeless type from new type module. + + * target.h: Crash build if target float bit pattern cannot be + precisely determined. + Remove all the type cruft now determined by ffecom_init_0 + at invocation time and maintained in new type module. + Put casts on second arg of all REAL_VALUE_TO_TARGET_DOUBLE + uses so compiler warnings avoided (requires target float bit + pattern to be precisely determined, hence code to crash build). + + * top.c: Add inits/terminates for new type module. + + * type.h, type.c: New module. + + * gbe/2.6.2.diff: Remove all patches to files in gcc/config/ + directory and its subdirectories. + +Mon Jan 9 19:23:25 1995 Dave Love <d.love@dl.ac.uk> + + * com.h (FFECOM_F2C_INTEGER_TYPE_NODE): Define and use instead of + long_integer_type_node where appropriate. + +Tue Jan 3 14:56:18 1995 Dave Love <d.love@dl.ac.uk> + + * com.h: Make ffecom_f2c_logical_type_node long, consistent with + integer. + +Fri Dec 2 20:07:37 1994 Dave Love <d.love@dl.ac.uk> + + * config-lang.in (stagestuff): Add f2c conditionally. + * Make-lang.in: Add f2c and related targets. + * f2c: Add the directory. + +Fri Nov 25 22:17:26 1994 Dave Love <d.love@dl.ac.uk> + + * Makefile.in (FLAGS_TO_PASS): pass $(CROSS) + * Make-lang.in: more changes to runtime targets + +Thu Nov 24 18:03:21 1994 Dave Love <d.love@dl.ac.uk> + + * Makefile.in (FLAGS_TO_PASS): define for sub-makes + + * g77.c (main): change f77-cpp-output to f77-cpp-input (.F files) + +Wed Nov 23 15:22:53 1994 Dave Love <d.love@dl.ac.uk> + + * bad.c (ffebad_finish): kluge to fool emacs19 into finding errors: + add trailing space to <file>:<line>: + +Tue Nov 22 11:30:50 1994 Dave Love <d.love@dl.ac.uk> + + * runtime/libF77/signal_.c (RETSIGTYPE): added + +Mon Nov 21 13:04:13 1994 Dave Love <d.love@dl.ac.uk> + + * Makefile.in (compiler): add runtime + + * config-lang.in (stagestuff): add libf2c.a to stagestuff + + * Make-lang.in: + G77STAGESTUFF <- MORESTAGESTUFF + f77-runtime: new target, plus supporting ones + + * runtime: add the directory, containing libI77, libF77 and autoconf + stuff + + * g++.1: remove + + * g77.1: minor fixes + +Thu Nov 17 15:18:05 1994 Craig Burley (burley@gnu.ai.mit.edu) + + * Version 0.5.2 released. + + * bad.def: Modify wording of FFEBAD_UNIMPL_STMT to indicate + that it covers a wide array of possible problems (that, someday, + should be handled via separate diagnostics). + + * lex.c: Allow $ in identifiers if -fdollar-ok. + * top.c: Support -fdollar-ok. + * top.h: Support -fdollar-ok. + * target.h: Support -fdollar-ok. + * DOC: Describe -fdollar-ok. + + * std.c (ffestd_R1229_finish): Fix bug so stand-alone build works. + * ste.c (ffeste_R819A): Fix bug so stand-alone build works. + + * Make: Improvements for stand-alone build. + + * Makefile.in: Fix copyright text at top of file. + + * LINK, SRCS, UNLINK: Removed. Not particularly useful now that + g77 sources live in their own subdirectory. + + * g77.c (main): Cast arg to bzero to avoid warning. (This is + identical to Kenner's fix to cp/g++.c.) + + * gbe/: New subdirectory, to contain .diff files for various + versions of the GNU CC back end. + + * gbe/README: New file. + * gbe/2.6.2.diff: New file. + +Tue Nov 8 10:23:10 1994 Dave Love <d.love@dl.ac.uk> + + * Make-lang.in: don't install as f77 as well as g77 to avoid + confusion with system's compiler (especially while testing) + + * g77.c (main): use -lf2c and -lm; fix sense of test for .f/.F files + +Fri Oct 28 09:45:00 1994 Craig Burley (burley@gnu.ai.mit.edu) + + * Version 0.5.1 released. + + * gcc.c: Invoke f771 instead of f-771. + +Fri Oct 28 02:00:44 1994 Craig Burley (burley@gnu.ai.mit.edu) + + * Version 0.5.0 released. + +Fri Oct 14 15:03:35 1994 Craig Burley (burley@gnu.ai.mit.edu) + + * Makefile.in: Handle the Fortran-77 front-end in a subdirectory. + * f-*: Move Fortran-77 front-end to f/*. + +Local Variables: +add-log-time-format: current-time-string +End: diff --git a/gcc/f/RELEASE-PREP b/gcc/f/RELEASE-PREP new file mode 100644 index 00000000000..7069ea596f5 --- /dev/null +++ b/gcc/f/RELEASE-PREP @@ -0,0 +1,5 @@ +1999-03-13 RELEASE-PREP + +Things to do to prepare a g77 release (FSF, egcs, whatever). + +- Update root.texi: clear DEVELOPMENT flag, set version info. diff --git a/gcc/f/root.texi b/gcc/f/root.texi new file mode 100644 index 00000000000..25032bf5e31 --- /dev/null +++ b/gcc/f/root.texi @@ -0,0 +1,33 @@ +@c DEVELOPMENT is set to indicate an in-development version, +@c as compared to a release version. When making a release +@c (e.g. a release branch in the CVS repository for egcs), +@c clear this and set the version information correctly. +@set DEVELOPMENT +@set version-g77 0.5.24 +@set version-egcs 1.2 + +@c EGCS-G77 is set to indicate this is the EGCS version of g77. +@set EGCS-G77 + +@ifclear EGCS-G77 +@c FSF-G77 is set to indicate this is the FSF version of g77. +@set FSF-G77 +@end ifclear + +@ifset EGCS-G77 +@set email-general egcs@@egcs.cygnus.com +@set email-bugs egcs-bugs@@egcs.cygnus.com +@set path-g77 egcs/gcc/f +@set path-libf2c egcs/libf2c +@set which-g77 EGCS-@value{version-egcs} +@end ifset + +@ifset FSF-G77 +@set email-general fortran@@gnu.org +@set email-bugs fortran@@gnu.org +@set path-g77 gcc/f +@set path-libf2c gcc/f/runtime +@set which-g77 FSF-@value{version-g77} +@end ifset + +@set email-burley craig@@jcb-sc.com diff --git a/gcc/fixinc.interix b/gcc/fixinc.interix new file mode 100644 index 00000000000..e0a7a47a930 --- /dev/null +++ b/gcc/fixinc.interix @@ -0,0 +1,157 @@ +#!/bin/sh +# +# fixinc.interix -- Install modified versions of Interix system include +# files. +# +# Based on fixinc.sco script by Ian Lance Taylor (ian@airs.com)). +# With modifications by Douglas 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. +# +# ?????? fixup comment +# This script munges the native include files provided with Windows NT +# 3.5 SDK systems so as to provide a reasonable namespace when +# compiling with gcc. The header files by default do not +# provide many essential definitions and declarations if +# __STDC__ is 1. This script modifies the header files to check +# for __STRICT_ANSI__ being defined instead. Once munged, the +# resulting new system include files are placed in a directory +# that GNU C will search *before* searching the Include +# directory. +# +# See README-fixinc for more information. + +ORIG_DIR=$(pwd) + +# Fail if no arg to specify a directory for the output. +if [ x$1 = x ]; then + echo fixincludes: no output directory specified + echo usage $0 output input + exit 1 +fi + +# Fail if no arg to specify a directory for the input +if [ x$2 = x ]; then + echo fixincludes: no input directory specified + echo usage $0 output input + exit 1 +fi + +INPUT=$2 + +# Directory in which to store the results. +LIB=$1 + +mkdir -p $LIB || exit 1 + +# Make LIB absolute if it is relative. +# Don't do this if not necessary, since may screw up automounters. +case $LIB in +/*) + ;; +*) + cd $LIB; LIB=$(pwd) + ;; +esac + +echo 'Building fixincludes in' ${LIB} + +# Determine whether this filesystem has symbolic links. +if ln -s X $LIB/ShouldNotExist 2>/dev/null; then + rm -f $LIB/ShouldNotExist + LINKS=true +else + LINKS=false +fi + +cd ${INPUT} +if $LINKS; then + files=`ls -LR | sed -n s/:$//p` +else + files=`find . -type d -print | sed '/^.$/d'` +fi + +if [ "x$files" = x ]; then + echo No files found in $INPUT\; skipped + exit 0 +fi + +echo 'Making directories:' + +for file in $files; do + rm -rf $LIB/$file + if [ ! -d $LIB/$file ]; then + echo $LIB/$file + mkdir $LIB/$file + fi +done + +# treetops gets an alternating list +# of old directories to copy +# and the new directories to copy to. +treetops="${INPUT} ${LIB}" + +set - $treetops +while [ $# != 0 ]; do + # $1 is an old directory to copy, and $2 is the new directory to copy to. + echo "Finding header files in $1:" + cd ${INPUT} + cd $1 + files=`find . -name '*.[hH]' -type f -print` + echo "Checking header files in $1; transforming into directory $2:" + for file in $files; do + echo " " $file + if [ -r $file ]; then + cp $file $2/$file >/dev/null 2>&1 || echo "Can't copy $file" + chmod +w,a+r $2/$file + +# The following have been removed from the sed command below +# because it is more useful to leave these things in. +# The only reason to remove them was for -pedantic, +# which isn't much of a reason. -- rms. +# ??? above/below +# /^[ ]*#[ ]*ident/d +# s/!__STDC__/!defined (__STRICT_ANSI__)/g + + sed -e '/#[ ]*include.*[<"][A-Za-z]:\\/ s,\\,/,g' \ + -e '/#[ ]*include.*[<"][A-Za-z]:\// s,\([A-Za-z]\):/,//\1/,' \ + -e '\,#[ ]*include.*[<"]//[A-Za-z]/, y,abcdefghijklmnopqrstuvwxyz,ABCDEFGHIJKLMNOPQRSTUVWXYZ,' \ + -e '\,#[ ]*INCLUDE.*[<"]//[A-Za-z]/, s,INCLUDE,include,' \ + $2/$file > $2/$file.sed + + mv $2/$file.sed $2/$file + if cmp $file $2/$file >/dev/null 2>&1; then + rm $2/$file + else + echo Fixed $file + flip -u $2/$file + fi + fi + done + shift; shift +done + +echo 'Removing unneeded directories:' +# (Rmdir leaf to root, and if the rmdir fails, who cares....) +cd $LIB +files=`find . -type d -print | sort -r` +for file in $files; do + rmdir $LIB/$file > /dev/null 2>&1 +done + +exit 0 diff --git a/gcc/fixinc.x86-linux-gnu b/gcc/fixinc.x86-linux-gnu new file mode 100644 index 00000000000..9e32586ef2b --- /dev/null +++ b/gcc/fixinc.x86-linux-gnu @@ -0,0 +1,140 @@ +#! /bin/sh +# +# The script is created for Cygnus by vmakarov@cygnus.com and based on +# fixinc.wrap +# +# This script is designed for x86 with gnulibc of version 2.0 and less +# for solution of problems with invalid asm-statements by creating +# small wrappers around the include files containg the asm-statements. +# +# See README-fixinc for more information. + + +# Directory in which to store the results. +LIB=${1?"fixincludes: output directory not specified"} + +# Make sure it exists. +if [ ! -d $LIB ]; then + mkdir $LIB || exit 1 +fi + +# Make LIB absolute if it is relative. +# Don't do this if not necessary, since may screw up automounters. +case $LIB in +/*) + ;; +*) + cd $LIB; LIB=`${PWDCMD-pwd}` + ;; +esac + +echo Building fixed headers in ${LIB} + +file=selectbits.h +echo Fixed $file for glibc-2.0.x +rm -f $LIB/$file +cat <<'__EOF__' >$LIB/$file +/* This file fixes __FD_ZERO bug for glibc-2.0.x. */ +#ifndef _SELECTBITS_H_WRAPPER +#include <features.h> +#include_next <selectbits.h> + +#if defined(__FD_ZERO) && defined(__GLIBC__) && defined(__GLIBC_MINOR__) && __GLIBC__ == 2 && __GLIBC_MINOR__ == 0 +#undef __FD_ZERO +#define __FD_ZERO(fdsetp) \ + do { \ + int __d0, __d1; \ + __asm__ __volatile__ ("cld; rep; stosl" \ + : "=m" (((__fd_mask *) \ + (fdsetp))[__FDELT (__FD_SETSIZE)]), \ + "=&c" (__d0), "=&D" (__d1) \ + : "a" (0), "1" (sizeof (__fd_set) \ + / sizeof (__fd_mask)), \ + "2" ((__fd_mask *) (fdsetp)) \ + : "memory"); \ + } while (0) +#endif + +#define _SELECTBITS_H_WRAPPER +#endif /* _SELECTBITS_H_WRAPPER */ +__EOF__ +# Define _SELECTBITS_H_WRAPPER at the end of the wrapper, not +# the start, so that if #include_next gets another instance of +# the wrapper, this will follow the #include_next chain until +# we arrive at the real <selectbits.h>. +chmod a+r $LIB/$file + +# asm/posix_types.h for libc version 1.x +file=asm/posix_types.h +echo Fixed $file for glibc-1.x +rm -f $LIB/$file +dir=`dirname $LIB/$file` +if [ ! -d $dir ]; then + mkdir -p $dir || exit 1 +fi +cat <<'__EOF__' >$LIB/$file +/* This file fixes __FD_ZERO bug for glibc-1.x. */ +#ifndef _POSIX_TYPES_H_WRAPPER +#include <features.h> +#include_next <asm/posix_types.h> + +#if defined(__FD_ZERO) && !defined(__GLIBC__) +#undef __FD_ZERO +#define __FD_ZERO(fdsetp) \ + do { \ + int __d0, __d1; \ + __asm__ __volatile__("cld ; rep ; stosl" \ + : "=m" (*(__kernel_fd_set *) (fdsetp)), \ + "=&c" (__d0), "=&D" (__d1) \ + : "a" (0), "1" (__FDSET_LONGS), \ + "2" ((__kernel_fd_set *) (fdsetp)) :"memory"); \ + } while (0) +#endif + +#define _POSIX_TYPES_H_WRAPPER +#endif /* _POSIX_TYPES_H_WRAPPER */ +__EOF__ +# Define _POSIX_TYPES_H_WRAPPER at the end of the wrapper, not +# the start, so that if #include_next gets another instance of +# the wrapper, this will follow the #include_next chain until +# we arrive at the real <asm/posix_types.h>. +chmod a+r $LIB/$file + +# gnu/types.h for libc version 1.x +file=gnu/types.h +echo Fixed $file for glibc-1.x +rm -f $LIB/$file +dir=`dirname $LIB/$file` +if [ ! -d $dir ]; then + mkdir -p $dir || exit 1 +fi +cat <<'__EOF__' >$LIB/$file +/* This file fixes __FD_ZERO bug for glibc-1.x. */ +#ifndef _TYPES_H_WRAPPER +#include <features.h> +#include_next <gnu/types.h> + +#if defined(__FD_ZERO) && !defined(__GLIBC__) +#undef __FD_ZERO +# define __FD_ZERO(fdsetp) \ + do { \ + int __d0, __d1; \ + __asm__ __volatile__("cld ; rep ; stosl" \ + : "=m" (*(__fd_set *) (fdsetp)), \ + "=&c" (__d0), "=&D" (__d1) \ + : "a" (0), "1" (__FDSET_LONGS), \ + "2" ((__fd_set *) (fdsetp)) :"memory"); \ + } while (0) +#endif + +#define _TYPES_H_WRAPPER +#endif /* _TYPES_H_WRAPPER */ +__EOF__ +# Define _TYPES_H_WRAPPER at the end of the wrapper, not the start, +# so that if #include_next gets another instance of the wrapper, +# this will follow the #include_next chain until we arrive at +# the real <gnu/types.h>. +chmod a+r $LIB/$file + +exit 0 + diff --git a/gcc/gccspec.c b/gcc/gccspec.c new file mode 100644 index 00000000000..78c67d2cec8 --- /dev/null +++ b/gcc/gccspec.c @@ -0,0 +1,43 @@ +/* Specific flags and argument handling of the C front-end. + Copyright (C) 1999 Free Software Foundation, Inc. + +This file is part of GNU CC. + +GNU CC is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU CC is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU CC; see the file COPYING. If not, write to +the Free Software Foundation, 59 Temple Place - Suite 330, +Boston, MA 02111-1307, USA. */ + +#include "config.h" +#include "system.h" + +/* Filter argc and argv before processing by the gcc driver proper. */ +void +lang_specific_driver (fn, in_argc, in_argv, in_added_libraries) + void (*fn)() ATTRIBUTE_UNUSED; + int *in_argc ATTRIBUTE_UNUSED; + char ***in_argv ATTRIBUTE_UNUSED; + int *in_added_libraries ATTRIBUTE_UNUSED; +{ + return; /* Not used for C. */ +} + +/* Called before linking. Returns 0 on success and -1 on failure. */ +int +lang_specific_pre_link () +{ + return 0; /* Not used for C. */ +} + +/* Number of extra output files that lang_specific_pre_link may generate. */ +int lang_specific_extra_outfiles = 0; /* Not used for C. */ diff --git a/gcc/graph.c b/gcc/graph.c new file mode 100644 index 00000000000..95149449964 --- /dev/null +++ b/gcc/graph.c @@ -0,0 +1,479 @@ +/* Output routines for graphical representation. + Copyright (C) 1998, 1999 Free Software Foundation, Inc. + Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998. + + 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 <config.h> +#include "system.h" + +#include "rtl.h" +#include "flags.h" +#include "output.h" +#include "hard-reg-set.h" +#include "basic-block.h" +#include "toplev.h" + +static const char *graph_ext[] = +{ + /* no_graph */ "", + /* vcg */ ".vcg", +}; + +/* Output text for new basic block. */ +static void +start_fct (fp) + FILE *fp; +{ + + switch (graph_dump_format) + { + case vcg: + fprintf (fp, "\ +graph: { title: \"%s\"\nfolding: 1\nhidden: 2\nnode: { title: \"%s.0\" }\n", + current_function_name, current_function_name); + break; + case no_graph: + break; + } +} + +static void +start_bb (fp, bb) + FILE *fp; + int bb; +{ + switch (graph_dump_format) + { + case vcg: + fprintf (fp, "\ +graph: {\ntitle: \"%s.BB%d\"\nfolding: 1\ncolor: lightblue\n\ +label: \"basic block %d", + current_function_name, bb, bb); + break; + case no_graph: + break; + } + +#if 0 + /* FIXME Should this be printed? It makes the graph significantly larger. */ + + /* Print the live-at-start register list. */ + fputc ('\n', fp); + EXECUTE_IF_SET_IN_REG_SET (basic_block_live_at_start[bb], 0, i, + { + fprintf (fp, " %d", i); + if (i < FIRST_PSEUDO_REGISTER) + fprintf (fp, " [%s]", + reg_names[i]); + }); +#endif + + switch (graph_dump_format) + { + case vcg: + fputs ("\"\n\n", fp); + break; + case no_graph: + break; + } +} + +static int +node_data (fp, tmp_rtx) + FILE *fp; + rtx tmp_rtx; +{ + int result; + + if (PREV_INSN (tmp_rtx) == 0) + { + /* This is the first instruction. Add an edge from the starting + block. */ + switch (graph_dump_format) + { + case vcg: + fprintf (fp, "\ +edge: { sourcename: \"%s.0\" targetname: \"%s.%d\" }\n", + current_function_name, + current_function_name, XINT (tmp_rtx, 0)); + break; + case no_graph: + break; + } + } + + switch (graph_dump_format) + { + case vcg: + fprintf (fp, "node: {\n title: \"%s.%d\"\n color: %s\n \ +label: \"%s %d\n", + current_function_name, XINT (tmp_rtx, 0), + GET_CODE (tmp_rtx) == NOTE ? "lightgrey" + : GET_CODE (tmp_rtx) == INSN ? "green" + : GET_CODE (tmp_rtx) == JUMP_INSN ? "darkgreen" + : GET_CODE (tmp_rtx) == CALL_INSN ? "darkgreen" + : GET_CODE (tmp_rtx) == CODE_LABEL ? "\ +darkgrey\n shape: ellipse" : "white", + GET_RTX_NAME (GET_CODE (tmp_rtx)), XINT (tmp_rtx, 0)); + break; + case no_graph: + break; + } + + /* Print the RTL. */ + if (GET_CODE (tmp_rtx) == NOTE) + { + static const char *note_names[] = + { + NULL, + "deleted", + "block_beg", + "block_end", + "loop_beg", + "loop_end", + "function_end", + "setjmp", + "loop_cont", + "loop_vtop", + "prologue_end", + "epilogue_beg", + "deleted_label", + "function_beg", + "eh_region_beg", + "eh_region_end", + "repeated_line_number", + "range_start", + "range_end", + "live", + "basic_block" + }; + + fprintf (fp, " %s", + XINT (tmp_rtx, 4) < 0 ? note_names[-XINT (tmp_rtx, 4)] : ""); + } + else if (GET_RTX_CLASS (GET_CODE (tmp_rtx)) == 'i') + result = print_rtl_single (fp, PATTERN (tmp_rtx)); + else + result = print_rtl_single (fp, tmp_rtx); + + switch (graph_dump_format) + { + case vcg: + fputs ("\"\n}\n", fp); + break; + case no_graph: + break; + } + + return result; +} + +static void +draw_edge (fp, from, to, bb_edge, class) + FILE *fp; + int from; + int to; + int bb_edge; + int class; +{ + char * color; + switch (graph_dump_format) + { + case vcg: + color = ""; + if (class == 2) + color = "color: red "; + else if (bb_edge) + color = "color: blue "; + else if (class == 3) + color = "color: green "; + fprintf (fp, + "edge: { sourcename: \"%s.%d\" targetname: \"%s.%d\" %s", + current_function_name, from, + current_function_name, to, color); + if (class) + fprintf (fp, "class: %d ", class); + fputs ("}\n", fp); + break; + case no_graph: + break; + } +} + +static void +end_bb (fp, bb) + FILE *fp; + int bb ATTRIBUTE_UNUSED; +{ + switch (graph_dump_format) + { + case vcg: + fputs ("}\n", fp); + break; + case no_graph: + break; + } +} + +static void +end_fct (fp) + FILE *fp; +{ + switch (graph_dump_format) + { + case vcg: + fprintf (fp, "node: { title: \"%s.999999\" label: \"END\" }\n}\n", + current_function_name); + break; + case no_graph: + break; + } +} + +/* Like print_rtl, but also print out live information for the start of each + basic block. */ +void +print_rtl_graph_with_bb (base, suffix, rtx_first) + const char *base; + const char *suffix; + rtx rtx_first; +{ + register rtx tmp_rtx; + size_t namelen = strlen (base); + size_t suffixlen = strlen (suffix); + size_t extlen = strlen (graph_ext[graph_dump_format]) + 1; + char *buf = (char *) alloca (namelen + suffixlen + extlen); + FILE *fp; + + if (basic_block_info == NULL) + return; + + memcpy (buf, base, namelen); + memcpy (buf + namelen, suffix, suffixlen); + memcpy (buf + namelen + suffixlen, graph_ext[graph_dump_format], extlen); + + fp = fopen (buf, "a"); + if (fp == NULL) + return; + + if (rtx_first == 0) + fprintf (fp, "(nil)\n"); + else + { + int i; + enum bb_state { NOT_IN_BB, IN_ONE_BB, IN_MULTIPLE_BB }; + int max_uid = get_max_uid (); + int *start = (int *) alloca (max_uid * sizeof (int)); + int *end = (int *) alloca (max_uid * sizeof (int)); + enum bb_state *in_bb_p = (enum bb_state *) + alloca (max_uid * sizeof (enum bb_state)); + basic_block bb; + + for (i = 0; i < max_uid; ++i) + { + start[i] = end[i] = -1; + in_bb_p[i] = NOT_IN_BB; + } + + for (i = n_basic_blocks - 1; i >= 0; --i) + { + rtx x; + bb = BASIC_BLOCK (i); + start[INSN_UID (bb->head)] = i; + end[INSN_UID (bb->end)] = i; + for (x = bb->head; x != NULL_RTX; x = NEXT_INSN (x)) + { + in_bb_p[INSN_UID (x)] + = (in_bb_p[INSN_UID (x)] == NOT_IN_BB) + ? IN_ONE_BB : IN_MULTIPLE_BB; + if (x == bb->end) + break; + } + } + + /* Tell print-rtl that we want graph output. */ + dump_for_graph = 1; + + /* Start new function. */ + start_fct (fp); + + for (tmp_rtx = NEXT_INSN (rtx_first); NULL != tmp_rtx; + tmp_rtx = NEXT_INSN (tmp_rtx)) + { + int did_output; + int edge_printed = 0; + rtx next_insn; + + if (start[INSN_UID (tmp_rtx)] < 0 && end[INSN_UID (tmp_rtx)] < 0) + { + if (GET_CODE (tmp_rtx) == BARRIER) + continue; + if (GET_CODE (tmp_rtx) == NOTE + && (1 || in_bb_p[INSN_UID (tmp_rtx)] == NOT_IN_BB)) + continue; + } + + if ((i = start[INSN_UID (tmp_rtx)]) >= 0) + { + /* We start a subgraph for each basic block. */ + start_bb (fp, i); + + if (i == 0) + draw_edge (fp, 0, INSN_UID (tmp_rtx), 1, 0); + } + + /* Print the data for this node. */ + did_output = node_data (fp, tmp_rtx); + next_insn = next_nonnote_insn (tmp_rtx); + + if ((i = end[INSN_UID (tmp_rtx)]) >= 0) + { + edge e; + + bb = BASIC_BLOCK (i); + + /* End of the basic block. */ + end_bb (fp, bb); + + /* Now specify the edges to all the successors of this + basic block. */ + for (e = bb->succ; e ; e = e->succ_next) + { + if (e->dest != EXIT_BLOCK_PTR) + { + rtx block_head = e->dest->head; + + draw_edge (fp, INSN_UID (tmp_rtx), + INSN_UID (block_head), + next_insn != block_head, + (e->flags & EDGE_ABNORMAL ? 2 : 0)); + + if (block_head == next_insn) + edge_printed = 1; + } + else + { + draw_edge (fp, INSN_UID (tmp_rtx), 999999, + next_insn != 0, + (e->flags & EDGE_ABNORMAL ? 2 : 0)); + + if (next_insn == 0) + edge_printed = 1; + } + } + } + + if (!edge_printed) + { + /* Don't print edges to barriers. */ + if (next_insn == 0 + || GET_CODE (next_insn) != BARRIER) + draw_edge (fp, XINT (tmp_rtx, 0), + next_insn ? INSN_UID (next_insn) : 999999, 0, 0); + else + { + /* We draw the remaining edges in class 3. We have + to skip over the barrier since these nodes are + not printed at all. */ + do + next_insn = NEXT_INSN (next_insn); + while (next_insn + && (GET_CODE (next_insn) == NOTE + || GET_CODE (next_insn) == BARRIER)); + + draw_edge (fp, XINT (tmp_rtx, 0), + next_insn ? INSN_UID (next_insn) : 999999, 0, 3); + } + } + } + + dump_for_graph = 0; + + end_fct (fp); + } + + fclose (fp); +} + + +/* Similar as clean_dump_file, but this time for graph output files. */ +void +clean_graph_dump_file (base, suffix) + const char *base; + const char *suffix; +{ + size_t namelen = strlen (base); + size_t suffixlen = strlen (suffix); + size_t extlen = strlen (graph_ext[graph_dump_format]) + 1; + char *buf = (char *) alloca (namelen + extlen + suffixlen); + FILE *fp; + + memcpy (buf, base, namelen); + memcpy (buf + namelen, suffix, suffixlen); + memcpy (buf + namelen + suffixlen, graph_ext[graph_dump_format], extlen); + + fp = fopen (buf, "w"); + + if (fp == NULL) + pfatal_with_name (buf); + + switch (graph_dump_format) + { + case vcg: + fputs ("graph: {\nport_sharing: no\n", fp); + break; + case no_graph: + abort (); + } + + fclose (fp); +} + + +/* Do final work on the graph output file. */ +void +finish_graph_dump_file (base, suffix) + const char *base; + const char *suffix; +{ + size_t namelen = strlen (base); + size_t suffixlen = strlen (suffix); + size_t extlen = strlen (graph_ext[graph_dump_format]) + 1; + char *buf = (char *) alloca (namelen + suffixlen + extlen); + FILE *fp; + + memcpy (buf, base, namelen); + memcpy (buf + namelen, suffix, suffixlen); + memcpy (buf + namelen + suffixlen, graph_ext[graph_dump_format], extlen); + + fp = fopen (buf, "a"); + if (fp != NULL) + { + switch (graph_dump_format) + { + case vcg: + fputs ("}\n", fp); + break; + case no_graph: + abort (); + } + + fclose (fp); + } +} diff --git a/gcc/hwint.h b/gcc/hwint.h new file mode 100644 index 00000000000..91973b8187a --- /dev/null +++ b/gcc/hwint.h @@ -0,0 +1,96 @@ +/* HOST_WIDE_INT definitions for the GNU compiler. + Copyright (C) 1998 Free Software Foundation, Inc. + + This file is part of GNU CC. + + Provide definitions for macros which depend on HOST_BITS_PER_INT + and HOST_BITS_PER_LONG. */ + +#ifndef __HWINT_H__ +#define __HWINT_H__ + +/* Only do all of this if both of these macros are defined, otherwise + they'll evaluate to zero, which is not what you want. */ +#if defined (HOST_BITS_PER_LONG) && defined (HOST_BITS_PER_INT) + +/* Find the largest host integer type and set its size and type. */ + +#ifndef HOST_BITS_PER_WIDE_INT + +# if HOST_BITS_PER_LONG > HOST_BITS_PER_INT +# define HOST_BITS_PER_WIDE_INT HOST_BITS_PER_LONG +# define HOST_WIDE_INT long +# else +# define HOST_BITS_PER_WIDE_INT HOST_BITS_PER_INT +# define HOST_WIDE_INT int +# endif + +#endif /* ! HOST_BITS_PER_WIDE_INT */ + + +/* Provide defaults for the way to print a HOST_WIDE_INT + in various manners. */ + +#ifndef HOST_WIDE_INT_PRINT_DEC +# if HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_INT +# define HOST_WIDE_INT_PRINT_DEC "%d" +# else +# if HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_LONG +# define HOST_WIDE_INT_PRINT_DEC "%ld" +# else +# define HOST_WIDE_INT_PRINT_DEC "%lld" +# endif +# endif +#endif /* ! HOST_WIDE_INT_PRINT_DEC */ + +#ifndef HOST_WIDE_INT_PRINT_UNSIGNED +# if HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_INT +# define HOST_WIDE_INT_PRINT_UNSIGNED "%u" +# else +# if HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_LONG +# define HOST_WIDE_INT_PRINT_UNSIGNED "%lu" +# else +# define HOST_WIDE_INT_PRINT_UNSIGNED "%llu" +# endif +# endif +#endif /* ! HOST_WIDE_INT_PRINT_UNSIGNED */ + +#ifndef HOST_WIDE_INT_PRINT_HEX +# if HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_INT +# define HOST_WIDE_INT_PRINT_HEX "0x%x" +# else +# if HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_LONG +# define HOST_WIDE_INT_PRINT_HEX "0x%lx" +# else +# define HOST_WIDE_INT_PRINT_HEX "0x%llx" +# endif +# endif +#endif /* ! HOST_WIDE_INT_PRINT_HEX */ + +#ifndef HOST_WIDE_INT_PRINT_DOUBLE_HEX +# if HOST_BITS_PER_WIDE_INT == 64 +# if HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_INT +# define HOST_WIDE_INT_PRINT_DOUBLE_HEX "0x%x%016x" +# else +# if HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_LONG +# define HOST_WIDE_INT_PRINT_DOUBLE_HEX "0x%lx%016lx" +# else +# define HOST_WIDE_INT_PRINT_DOUBLE_HEX "0x%llx%016llx" +# endif +# endif +# else +# if HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_INT +# define HOST_WIDE_INT_PRINT_DOUBLE_HEX "0x%x%08x" +# else +# if HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_LONG +# define HOST_WIDE_INT_PRINT_DOUBLE_HEX "0x%lx%08lx" +# else +# define HOST_WIDE_INT_PRINT_DOUBLE_HEX "0x%llx%08llx" +# endif +# endif +# endif +#endif /* ! HOST_WIDE_INT_PRINT_DOUBLE_HEX */ + +#endif /* HOST_BITS_PER_LONG && HOST_BITS_PER_INT */ + +#endif /* __HWINT_H__ */ diff --git a/gcc/java/check-init.c b/gcc/java/check-init.c new file mode 100644 index 00000000000..071faf74924 --- /dev/null +++ b/gcc/java/check-init.c @@ -0,0 +1,714 @@ +/* Code to test for "definitive assignment". + + Copyright (C) 1999 Free Software Foundation, Inc. + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +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 GNU CC; see the file COPYING. If not, write to +the Free Software Foundation, 59 Temple Place - Suite 330, +Boston, MA 02111-1307, USA. + +Java and all Java-based marks are trademarks or registered trademarks +of Sun Microsystems, Inc. in the United States and other countries. +The Free Software Foundation is independent of Sun Microsystems, Inc. */ + +/* Written by Per Bothner <bothner@cygnus.com>, January 1999. */ + +#include "config.h" +#include "system.h" +#include "tree.h" +#include "java-tree.h" +#include "toplev.h" /* Needed for fatal. */ + +/* The basic idea is that we assign each local variable declaration + an index, and then we pass around bitstrings, where the i'th bit + is set if decl whose DECL_BIT_INDEX is i is definitely assigned. */ + +/* One segment of a bitstring. */ +typedef unsigned int word; + +/* Pointer to a bitstring. */ +typedef word *words; + +/* For a local VAR_DECL, holds the index into a words bitstring that + specifies if this decl is definitively assigned. + A DECL_BIT_INDEX of -1 means we no longer care. */ +#define DECL_BIT_INDEX(DECL) DECL_FIELD_SIZE(DECL) + +/* Number of locals variables currently active. */ +int num_current_locals = 0; + +/* The index of the first local variable in the current block. + + The variables whose DECL_BIT_INDEX are in the range from + start_current_locals (inclusive) up to num_current_locals (exclusive) + are declared in the "current" block. If there is a loop or branch + form, we set start_current_locals to num_current_locals to indicate + there is no current block. + + The point is that if a variable in the current block is set, + there are no other control paths that we have to worry about. + Hence, we can remove it from the set of variables we are + checking, making its bit index available for some other variable. + For simplicity, we only do that if the variable's bit index + is (num_current_locals-1); freeing up its bit index is then + just a simple matter of decrementing num_current_locals. + The reason this is worth doing is that it is simple, and + allows us to use short (usually one-word) bit-strings, + even for methods with thousands of local variables, as + long as most of them are initialized immediately after or in + their declaration. */ +int start_current_locals = 0; + +int num_current_words = 1; + +static tree wfl; + +#define COPYN(DST, SRC, NWORDS) memcpy (DST, SRC, NWORDS * sizeof(word)) +#define COPY(DST, SRC) COPYN (DST, SRC, num_current_words) + +#define SET_ALL(DST) memset (DST, ~0, num_current_words * sizeof(word)) +#define CLEAR_ALL(DST) memset (DST, 0, num_current_words * sizeof(word)) + +#define INTERSECTN(DST, SRC1, SRC2, N) \ + do { int n = N; \ + while (--n >= 0) DST[n] = SRC1[n] & SRC2[n]; \ + } while (0) + +#define UNION(DST, SRC1, SRC2) \ + UNIONN (DST, SRC1, SRC2, num_current_words) + +#define UNIONN(DST, SRC1, SRC2, N) \ + do { int n = N; \ + while (--n >= 0) DST[n] = SRC1[n] | SRC2[n]; \ + } while (0) + +#define INTERSECT(DST, SRC1, SRC2) \ + INTERSECTN (DST, SRC1, SRC2, num_current_words) + +#define WORD_SIZE ((unsigned int)(sizeof(word) * 8)) + +static void check_bool_init PROTO ((tree, words, words, words)); +static void check_init PROTO ((tree, words)); +static void check_cond_init PROTO ((tree, tree, tree, words, words, words)); + +#if 0 +#define ALLOC_WORDS(NUM) ((word*) xmalloc ((NUM) * sizeof (word))) +#define FREE_WORDS(PTR) (free (PTR)) +#else +#define ALLOC_WORDS(NUM) ((word*)alloca ((NUM) * sizeof (word))) +#define FREE_WORDS(PTR) ((void)0) +#endif + +#define SET_P(WORDS, BIT) \ + (WORDS[BIT / WORD_SIZE] & (1 << (BIT % WORD_SIZE))) + +#define CLEAR_BIT(WORDS, BIT) \ + (WORDS[BIT / WORD_SIZE] &= ~ (1 << (BIT % WORD_SIZE))) + +#define SET_BIT(WORDS, BIT) \ + (WORDS[BIT / WORD_SIZE] |= (1 << (BIT % WORD_SIZE))) + +#define WORDS_NEEDED(BITS) (((BITS)+(WORD_SIZE-1))/(WORD_SIZE)) + +/* Check a conditional form (TEST_EXP ? THEN_EXP : ELSE_EXP) for + definite assignment. + BEFORE, WHEN_FALSE, and WHEN_TRUE are as in check_bool_init. */ + +static void +check_cond_init (test_exp, then_exp, else_exp, + before, when_false, when_true) + tree test_exp, then_exp, else_exp; + words before, when_false, when_true; +{ + words tmp = ALLOC_WORDS (6 * num_current_words); + words test_false = tmp; + words test_true = tmp + num_current_words; + words then_false = tmp + 2 * num_current_words; + words then_true = tmp + 3 * num_current_words; + words else_false = tmp + 4 * num_current_words; + words else_true = tmp + 5 * num_current_words; + check_bool_init (test_exp, before, test_false, test_true); + check_bool_init (then_exp, test_true, then_false, then_true); + check_bool_init (else_exp, test_false, else_false, else_true); + INTERSECT (when_false, then_false, else_false); + INTERSECT (when_true, then_true, else_true); + FREE_WORDS (tmp); +} + +/* Check a boolean binary form CODE (EXP0, EXP1), + where CODE is one of EQ_EXPR, BIT_AND_EXPR, or BIT_IOR_EXPR. + BEFORE, WHEN_FALSE, and WHEN_TRUE are as in check_bool_init. */ + +static void +check_bool2_init (code, exp0, exp1, before, when_false, when_true) + enum tree_code code; tree exp0, exp1; + words before, when_false, when_true; +{ + word buf[4]; + words tmp = num_current_words <= 1 ? buf + : ALLOC_WORDS (4 * num_current_words); + words when_false_0 = tmp; + words when_false_1 = tmp+num_current_words; + words when_true_0 = tmp+2*num_current_words; + words when_true_1 = tmp+3*num_current_words; + check_bool_init (exp0, before, when_false_0, when_true_0); + INTERSECT (before, when_false_0, when_true_0); + check_bool_init (exp1, before, when_false_1, when_true_1); + + INTERSECT (before, when_false_1, when_true_1); + + if (code == EQ_EXPR) + { + /* Now set: + * when_true = (when_false_1 INTERSECTION when_true_1) + * UNION (when_true_0 INTERSECTION when_false_1) + * UNION (when_false_0 INTERSECTION when_true_1); + * using when_false and before as temporary working areas. */ + INTERSECT (when_true, when_true_0, when_false_1); + INTERSECT (when_false, when_true_0, when_false_1); + UNION (when_true, when_true, when_false); + UNION (when_true, when_true, before); + + /* Now set: + * when_false = (when_false_1 INTERSECTION when_true_1) + * UNION (when_true_0 INTERSECTION when_true_1) + * UNION (when_false_0 INTERSECTION when_false_1); + * using before as a temporary working area. */ + INTERSECT (when_false, when_true_0, when_true_1); + UNION (when_false, when_false, before); + INTERSECT (before, when_false_0, when_false_1); + UNION (when_false, when_false, before); + } + else if (code == BIT_AND_EXPR || code == TRUTH_AND_EXPR) + { + UNION (when_true, when_true_0, when_true_1); + INTERSECT (when_false, when_false_0, when_false_1); + UNION (when_false, when_false, before); + } + else /* if (code == BIT_IOR_EXPR || code == TRUTH_OR_EXPR) */ + { + UNION (when_false, when_false_0, when_false_1); + INTERSECT (when_true, when_true_0, when_true_1); + UNION (when_true, when_true, before); + } + + if (tmp != buf) + FREE_WORDS (tmp); +} + +/* Check a boolean expression EXP for definite assignment. + BEFORE is the set of variables definitely assigned before the conditional. + (This bitstring may be modified arbitrarily in this function.) + On output, WHEN_FALSE is the set of variables definitely assigned after + the conditional when the conditional is false. + On output, WHEN_TRUE is the set of variables definitely assigned after + the conditional when the conditional is true. + (WHEN_FALSE and WHEN_TRUE are overwriten with initial values ignored.) + (None of BEFORE, WHEN_FALSE, or WHEN_TRUE can overlap, as they may + be used as temporary working areas. */ + +static void +check_bool_init (exp, before, when_false, when_true) + tree exp; + words before, when_false, when_true; +{ + switch (TREE_CODE (exp)) + { + case COND_EXPR: + check_cond_init (TREE_OPERAND (exp, 0), TREE_OPERAND (exp, 1), + TREE_OPERAND (exp, 2), + before, when_false, when_true); + return; + + case TRUTH_ANDIF_EXPR: + check_cond_init (TREE_OPERAND (exp, 0), + TREE_OPERAND (exp, 1), boolean_false_node, + before, when_false, when_true); + return; + case TRUTH_ORIF_EXPR: + check_cond_init (TREE_OPERAND (exp, 0), + boolean_true_node, TREE_OPERAND (exp, 1), + before, when_false, when_true); + return; + case TRUTH_NOT_EXPR: + check_bool_init (TREE_OPERAND (exp, 0), before, when_true, when_false); + return; + case MODIFY_EXPR: + { + tree tmp = TREE_OPERAND (exp, 0); + if (TREE_CODE (tmp) == VAR_DECL && ! FIELD_STATIC (tmp)) + { + int index; + check_bool_init (TREE_OPERAND (exp, 1), before, + when_false, when_true); + index = DECL_BIT_INDEX (tmp); + if (index >= 0) + { + SET_BIT (when_false, index); + SET_BIT (when_true, index); + } + break; + } + } + goto do_default; + + case BIT_AND_EXPR: + case BIT_IOR_EXPR: + case TRUTH_AND_EXPR: + case TRUTH_OR_EXPR: + case EQ_EXPR: + check_bool2_init (TREE_CODE (exp), + TREE_OPERAND (exp, 0), TREE_OPERAND (exp, 1), + before, when_false, when_true); + return; + + case TRUTH_XOR_EXPR: + case BIT_XOR_EXPR: + case NE_EXPR: + /* Just like EQ_EXPR, but switch when_true and when_false. */ + check_bool2_init (EQ_EXPR, TREE_OPERAND (exp, 0), TREE_OPERAND (exp, 1), + before, when_true, when_false); + + return; + + case INTEGER_CST: + if (integer_zerop (exp)) + { + SET_ALL (when_true); + COPY (when_false, before); + } + else + { + SET_ALL (when_false); + COPY (when_true, before); + } + break; + default: + do_default: + check_init (exp, before); + COPY (when_false, before); + COPY (when_true, before); + } +} + +/* Used to keep track of control flow branches. */ + +struct alternatives +{ + struct alternatives *outer; + + /* The value of num_current_locals at the start of this compound. */ + int num_locals; + + /* The value of the "before" set at the start of the control stucture. + Used for SWITCH_EXPR but not set for LABELED_BLOCK_EXPR. */ + words saved; + + int save_start_current_locals; + + /* If num_current_words==1, combined==&one_word, for efficiency. */ + word one_word; + + /* The intersection of the "after" sets from previous branches. */ + words combined; + + tree block; +}; + +struct alternatives * alternatives = NULL; + +#define BEGIN_ALTERNATIVES(before, current) \ +{ \ + current.saved = NULL; \ + current.num_locals = num_current_locals; \ + current.combined = num_current_words <= 1 ? ¤t.one_word \ + : ALLOC_WORDS (num_current_words); \ + SET_ALL (current.combined); \ + current.outer = alternatives; \ + alternatives = ¤t; \ + current.save_start_current_locals = start_current_locals; \ + start_current_locals = num_current_locals; \ +} + +static void +done_alternative (after, current) + words after; + struct alternatives *current; +{ + INTERSECTN (current->combined, current->combined, after, + WORDS_NEEDED (current->num_locals)); +} + +#define END_ALTERNATIVES(after, current) \ +{ \ + alternatives = current.outer; \ + COPY (after, current.combined); \ + if (current.combined != ¤t.one_word) \ + FREE_WORDS (current.combined); \ + start_current_locals = current.save_start_current_locals; \ +} + +/* Check for (un)initialized local variables in EXP. +*/ + +static void +check_init (exp, before) + tree exp; + words before; +{ + tree tmp; + again: + switch (TREE_CODE (exp)) + { + case VAR_DECL: + if (! FIELD_STATIC (exp) && DECL_NAME (exp) != NULL_TREE) + { + int index = DECL_BIT_INDEX (exp); + if (index >= 0 && ! SET_P (before, index)) + { +#if 1 + parse_error_context (wfl, + "Variable `%s' may not have been initialized" + , IDENTIFIER_POINTER (DECL_NAME (exp))); +#else + error_with_decl (exp, "variable may be used uninitialized"); +#endif + /* Suppress further errors. */ + DECL_BIT_INDEX (exp) = -1; + } + } + break; + case MODIFY_EXPR: + tmp = TREE_OPERAND (exp, 0); + if (TREE_CODE (tmp) == VAR_DECL && ! FIELD_STATIC (tmp)) + { + int index; + check_init (TREE_OPERAND (exp, 1), before); + index = DECL_BIT_INDEX (tmp); + if (index >= 0) + SET_BIT (before, index); + /* Minor optimization. See comment for start_current_locals. */ + if (index >= start_current_locals + && index == num_current_locals - 1) + { + num_current_locals--; + DECL_BIT_INDEX (tmp) = -1; + } + break; + } + else + goto binop; + case BLOCK: + if (BLOCK_EXPR_BODY (exp)) + { + tree decl = BLOCK_EXPR_DECLS (exp); + int words_needed; + word* tmp; + int i; + int save_start_current_locals = start_current_locals; + int save_num_current_words = num_current_words; + start_current_locals = num_current_locals; + for (; decl != NULL_TREE; decl = TREE_CHAIN (decl)) + { + DECL_BIT_INDEX (decl) = num_current_locals++; + } + words_needed = WORDS_NEEDED (num_current_locals); + if (words_needed > num_current_words) + { + tmp = ALLOC_WORDS (words_needed); + COPY (tmp, before); + num_current_words = words_needed; + } + else + tmp = before; + for (i = start_current_locals; i < num_current_locals; i++) + CLEAR_BIT (tmp, i); + check_init (BLOCK_EXPR_BODY (exp), tmp); + num_current_locals = start_current_locals; + start_current_locals = save_start_current_locals; + if (tmp != before) + { + num_current_words = save_num_current_words; + COPY (before, tmp); + FREE_WORDS (tmp); + } + } + break; + case LOOP_EXPR: + { + struct alternatives alt; + BEGIN_ALTERNATIVES (before, alt); + alt.block = exp; + check_init (TREE_OPERAND (exp, 0), before); + done_alternative (before, &alt); + END_ALTERNATIVES (before, alt); + return; + } + case EXIT_EXPR: + { + struct alternatives *alt = alternatives; + words tmp = ALLOC_WORDS (2 * num_current_words); + words when_true = tmp; + words when_false = tmp + num_current_words; +#ifdef ENABLE_CHECKING + if (TREE_CODE (alt->block) != LOOP_EXPR) + fatal ("internal error in check-init: EXIT_EXPR not in LOOP_EXPR"); +#endif + check_bool_init (TREE_OPERAND (exp, 0), before, when_false, when_true); + done_alternative (when_true, alt); + COPY (before, when_false); + FREE_WORDS (tmp); + return; + } + case LABELED_BLOCK_EXPR: + { + struct alternatives alt; + BEGIN_ALTERNATIVES (before, alt); + alt.block = exp; + check_init (LABELED_BLOCK_BODY (exp), before); + done_alternative (before, &alt); + END_ALTERNATIVES (before, alt); + return; + } + case EXIT_BLOCK_EXPR: + { + tree block = TREE_OPERAND (exp, 0); + struct alternatives *alt = alternatives; + while (alt->block != block) + alt = alt->outer; + done_alternative (before, alt); + SET_ALL (before); + return; + } + case SWITCH_EXPR: + { + struct alternatives alt; + check_init (TREE_OPERAND (exp, 0), before); + BEGIN_ALTERNATIVES (before, alt); + alt.saved = ALLOC_WORDS (num_current_words); + COPY (alt.saved, before); + alt.block = exp; + check_init (TREE_OPERAND (exp, 1), before); + done_alternative (before, &alt); + FREE_WORDS (alt.saved); + END_ALTERNATIVES (before, alt); + return; + } + case CASE_EXPR: + case DEFAULT_EXPR: + { + int i; + struct alternatives *alt = alternatives; + while (TREE_CODE (alt->block) != SWITCH_EXPR) + alt = alt->outer; + COPYN (before, alt->saved, WORDS_NEEDED (alt->num_locals)); + for (i = alt->num_locals; i < num_current_locals; i++) + CLEAR_BIT (before, i); + break; + } + + case CLEANUP_POINT_EXPR: + { + struct alternatives alt; + BEGIN_ALTERNATIVES (before, alt); + CLEAR_ALL (alt.combined); + check_init (TREE_OPERAND (exp, 0), before); + UNION (alt.combined, alt.combined, before); + END_ALTERNATIVES (before, alt); + } + return; + case WITH_CLEANUP_EXPR: + { + struct alternatives *alt = alternatives; +#ifdef ENABLE_CHECKING + if (TREE_CODE (alt->block) != CLEANUP_POINT_EXPR) + fatal ("internal error in check-init: WITH_CLEANUP_EXPR not in CLEANUP_POINT_EXPR"); +#endif + check_init (TREE_OPERAND (exp, 0), before); + UNION (alt->combined, alt->combined, before); + check_init (TREE_OPERAND (exp, 2), alt->combined); + return; + } + + case TRY_EXPR: + { + tree try_clause = TREE_OPERAND (exp, 0); + tree clause = TREE_OPERAND (exp, 1); + words save = ALLOC_WORDS (num_current_words); + words tmp = ALLOC_WORDS (num_current_words); + struct alternatives alt; + BEGIN_ALTERNATIVES (before, alt); + COPY (save, before); + COPY (tmp, save); + check_init (try_clause, tmp); + done_alternative (tmp, &alt); + for ( ; clause != NULL_TREE; clause = TREE_CHAIN (clause)) + { + tree catch_clause = TREE_OPERAND (clause, 0); + COPY (tmp, save); + check_init (catch_clause, tmp); + done_alternative (tmp, &alt); + } + FREE_WORDS (tmp); + FREE_WORDS (save); + END_ALTERNATIVES (before, alt); + } + return; + + case TRY_FINALLY_EXPR: + { + words tmp = ALLOC_WORDS (num_current_words); + COPY (tmp, before); + check_init (TREE_OPERAND (exp, 0), tmp); + check_init (TREE_OPERAND (exp, 1), before); + FREE_WORDS (tmp); + } + return; + + case RETURN_EXPR: + case THROW_EXPR: + if (TREE_OPERAND (exp, 0)) + check_init (TREE_OPERAND (exp, 0), before); + goto never_continues; + + case ERROR_MARK: + never_continues: + SET_ALL (before); + return; + + case COND_EXPR: + case TRUTH_ANDIF_EXPR: + case TRUTH_ORIF_EXPR: + { + words tmp = ALLOC_WORDS (2 * num_current_words); + words when_true = tmp; + words when_false = tmp + num_current_words; + check_bool_init (exp, before, when_false, when_true); + INTERSECT (before, when_false, when_true); + FREE_WORDS (tmp); + } + break; + case UNARY_PLUS_EXPR: + case NEGATE_EXPR: + case TRUTH_AND_EXPR: + case TRUTH_OR_EXPR: + case TRUTH_XOR_EXPR: + case TRUTH_NOT_EXPR: + case BIT_NOT_EXPR: + case CONVERT_EXPR: + case COMPONENT_REF: + case NOP_EXPR: + case FLOAT_EXPR: + case FIX_TRUNC_EXPR: + case INDIRECT_REF: + case ADDR_EXPR: + case SAVE_EXPR: + case PREDECREMENT_EXPR: + case PREINCREMENT_EXPR: + case POSTDECREMENT_EXPR: + case POSTINCREMENT_EXPR: + case NON_LVALUE_EXPR: + case INSTANCEOF_EXPR: + /* Avoid needless recursion. */ + exp = TREE_OPERAND (exp, 0); + goto again; + + case COMPOUND_EXPR: + case PLUS_EXPR: + case MINUS_EXPR: + case MULT_EXPR: + case TRUNC_DIV_EXPR: + case TRUNC_MOD_EXPR: + case RDIV_EXPR: + case LSHIFT_EXPR: + case RSHIFT_EXPR: + case URSHIFT_EXPR: + case BIT_AND_EXPR: + case BIT_XOR_EXPR: + case BIT_IOR_EXPR: + case EQ_EXPR: + case NE_EXPR: + case GT_EXPR: + case GE_EXPR: + case LT_EXPR: + case LE_EXPR: + case ARRAY_REF: + binop: + check_init (TREE_OPERAND (exp, 0), before); + /* Avoid needless recursion, especially for COMPOUND_EXPR. */ + exp = TREE_OPERAND (exp, 1); + goto again; + + case PARM_DECL: + case RESULT_DECL: + case FUNCTION_DECL: + case INTEGER_CST: + case REAL_CST: + case STRING_CST: + break; + + case NEW_CLASS_EXPR: + case CALL_EXPR: + { + tree func = TREE_OPERAND (exp, 0); + tree x = TREE_OPERAND (exp, 1); + if (TREE_CODE (func) == ADDR_EXPR) + func = TREE_OPERAND (func, 0); + check_init (func, before); + + for ( ; x != NULL_TREE; x = TREE_CHAIN (x)) + check_init (TREE_VALUE (x), before); + if (func == throw_node) + goto never_continues; + } + break; + + case NEW_ARRAY_INIT: + { + tree x = CONSTRUCTOR_ELTS (TREE_OPERAND (exp, 0)); + for ( ; x != NULL_TREE; x = TREE_CHAIN (x)) + check_init (TREE_VALUE (x), before); + } + break; + + case EXPR_WITH_FILE_LOCATION: + { + char *saved_input_filename = input_filename; + tree saved_wfl = wfl; + tree body = EXPR_WFL_NODE (exp); + int saved_lineno = lineno; + if (body == empty_stmt_node) + break; + wfl = exp; + input_filename = EXPR_WFL_FILENAME (exp); + lineno = EXPR_WFL_LINENO (exp); + check_init (body, before); + input_filename = saved_input_filename; + lineno = saved_lineno; + wfl = saved_wfl; + } + break; + + default: + fatal ("internal error in check-init: tree code not implemented: %s", + tree_code_name [(int) TREE_CODE (exp)]); + } +} + +void +check_for_initialization (body) + tree body; +{ + word before = 0; + check_init (body, &before); +} diff --git a/gcc/java/jcf-depend.c b/gcc/java/jcf-depend.c new file mode 100644 index 00000000000..9adbdb4eec0 --- /dev/null +++ b/gcc/java/jcf-depend.c @@ -0,0 +1,265 @@ +/* Functions for handling dependency tracking when reading .class files. + + Copyright (C) 1998 Free Software Foundation, Inc. + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +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 GNU CC; see the file COPYING. If not, write to +the Free Software Foundation, 59 Temple Place - Suite 330, +Boston, MA 02111-1307, USA. + +Java and all Java-based marks are trademarks or registered trademarks +of Sun Microsystems, Inc. in the United States and other countries. +The Free Software Foundation is independent of Sun Microsystems, Inc. */ + +/* Written by Tom Tromey <tromey@cygnus.com>, October 1998. */ + +#include <config.h> +#include "system.h" + +#include <assert.h> + +#include "jcf.h" + + + +/* We keep a linked list of all the files we've already read. */ +struct entry +{ + char *file; + struct entry *next; +}; + +/* List of files. */ +static struct entry *dependencies = NULL; + +/* Name of targets. We support multiple targets when writing .class + files. */ +static struct entry *targets = NULL; + +/* Number of columns in output. */ +#define MAX_OUTPUT_COLUMNS 72 + +/* The output file, or NULL if we aren't doing dependency tracking. */ +static FILE *dep_out = NULL; + +/* Nonzero if system files should be added. */ +static int system_files; + + + +/* Helper to free an entry list. */ +static void +free_entry (entp) + struct entry **entp; +{ + struct entry *ent, *next; + + for (ent = *entp; ent != NULL; ent = next) + { + next = ent->next; + free (ent->file); + free (ent); + } + *entp = NULL; +} + +/* Helper to add to entry list. */ +static void +add_entry (entp, name) + struct entry **entp; + char *name; +{ + struct entry *ent; + + for (ent = *entp; ent != NULL; ent = ent->next) + if (! strcmp (ent->file, name)) + return; + + ent = (struct entry *) malloc (sizeof (struct entry)); + ent->file = strdup (name); + ent->next = *entp; + *entp = ent; +} + +/* Call this to reset the dependency module. This is required if + multiple dependency files are being generated from a single tool + invocation. */ +void +jcf_dependency_reset () +{ + free_entry (&dependencies); + free_entry (&targets); + + if (dep_out != NULL) + { + if (dep_out != stdout) + fclose (dep_out); + dep_out = NULL; + } +} + +void +jcf_dependency_set_target (name) + char *name; +{ + free_entry (&targets); + if (name != NULL) + add_entry (&targets, name); +} + +void +jcf_dependency_add_target (name) + char *name; +{ + add_entry (&targets, name); +} + +void +jcf_dependency_set_dep_file (name) + const char *name; +{ + assert (dep_out != stdout); + if (dep_out) + fclose (dep_out); + if (! strcmp (name, "-")) + dep_out = stdout; + else + dep_out = fopen (name, "w"); +} + +void +jcf_dependency_add_file (filename, system_p) + const char *filename; + int system_p; +{ + /* Just omit system files. */ + if (system_p && ! system_files) + return; + + add_entry (&dependencies, filename); +} + +void +jcf_dependency_init (system_p) + int system_p; +{ + system_files = system_p; +} + +/* FIXME: this is taken almost directly from cccp.c. Such duplication + is bad. */ +static char * +munge (filename) + char *filename; +{ + static char *buffer = NULL; + static int buflen = 0; + + int len = 2 * strlen (filename) + 1; + char *p, *dst; + + if (buflen < len) + { + buflen = len; + if (buffer == NULL) + buffer = malloc (buflen); + else + buffer = realloc (buffer, buflen); + } + + dst = buffer; + for (p = filename; *p; ++p) + { + switch (*p) + { + case ' ': + case '\t': + { + /* GNU make uses a weird quoting scheme for white space. + A space or tab preceded by 2N+1 backslashes represents + N backslashes followed by space; a space or tab + preceded by 2N backslashes represents N backslashes at + the end of a file name; and backslashes in other + contexts should not be doubled. */ + char *q; + for (q = p - 1; filename < q && q[-1] == '\\'; q--) + *dst++ = '\\'; + } + *dst++ = '\\'; + goto ordinary_char; + + case '$': + *dst++ = '$'; + /* Fall through. This can mishandle things like "$(" but + there's no easy fix. */ + default: + ordinary_char: + /* This can mishandle characters in the string "\0\n%*?[\\~"; + exactly which chars are mishandled depends on the `make' version. + We know of no portable solution for this; + even GNU make 3.76.1 doesn't solve the problem entirely. + (Also, '\0' is mishandled due to our calling conventions.) */ + *dst++ = *p; + break; + } + } + + *dst++ = '\0'; + return buffer; +} + +/* Helper to print list of files. */ +static int +print_ents (ent, column) + struct entry *ent; + int column; +{ + int first = 1; + + for (; ent != NULL; ent = ent->next) + { + char *depname = munge (ent->file); + int len = strlen (depname); + + if (column + len + 2 > MAX_OUTPUT_COLUMNS) + { + fprintf (dep_out, " \\\n "); + column = 1; + } + + if (! first) + fputs (" ", dep_out); + fputs (depname, dep_out); + first = 0; + column += len + 1; + } + + return column; +} + +void +jcf_dependency_write () +{ + int column = 0; + + if (! dep_out) + return; + + assert (targets); + column = print_ents (targets, 0); + fputs (" : ", dep_out); + + print_ents (dependencies, column); + fputs ("\n", dep_out); + fflush (dep_out); +} diff --git a/gcc/java/jcf-path.c b/gcc/java/jcf-path.c new file mode 100644 index 00000000000..bdd951506f4 --- /dev/null +++ b/gcc/java/jcf-path.c @@ -0,0 +1,342 @@ +/* Handle CLASSPATH, -classpath, and path searching. + + Copyright (C) 1998, 1999 Free Software Foundation, Inc. + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +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 GNU CC; see the file COPYING. If not, write to +the Free Software Foundation, 59 Temple Place - Suite 330, +Boston, MA 02111-1307, USA. + +Java and all Java-based marks are trademarks or registered trademarks +of Sun Microsystems, Inc. in the United States and other countries. +The Free Software Foundation is independent of Sun Microsystems, Inc. */ + +/* Written by Tom Tromey <tromey@cygnus.com>, October 1998. */ + +#include <config.h> +#include "system.h" + +#include "jcf.h" + +/* Some boilerplate that really belongs in a header. */ + +#ifndef GET_ENV_PATH_LIST +#define GET_ENV_PATH_LIST(VAR,NAME) do { (VAR) = getenv (NAME); } while (0) +#endif + +/* By default, colon separates directories in a path. */ +#ifndef PATH_SEPARATOR +#define PATH_SEPARATOR ':' +#endif + +#ifndef DIR_SEPARATOR +#define DIR_SEPARATOR '/' +#endif + + + +/* Possible flag values. */ +#define FLAG_SYSTEM 1 +#define FLAG_ZIP 2 + +/* We keep linked lists of directory names. A ``directory'' can be + either an ordinary directory or a .zip file. */ +struct entry +{ + char *name; + int flags; + struct entry *next; +}; + +/* We support several different ways to set the class path. + + built-in system directory (only libgcj.zip) + CLASSPATH environment variable + -CLASSPATH overrides CLASSPATH + -classpath option - overrides CLASSPATH, -CLASSPATH, and built-in + -I prepends path to list + + We implement this by keeping several path lists, and then simply + ignoring the ones which are not relevant. */ + +/* This holds all the -I directories. */ +static struct entry *include_dirs; + +/* This holds the CLASSPATH environment variable. */ +static struct entry *classpath_env; + +/* This holds the -CLASSPATH command-line option. */ +static struct entry *classpath_u; + +/* This holds the -classpath command-line option. */ +static struct entry *classpath_l; + +/* This holds the default directories. Some of these will have the + "system" flag set. */ +static struct entry *sys_dirs; + +/* This is the sealed list. It is just a combination of other lists. */ +static struct entry *sealed; + +/* We keep track of the longest path we've seen. */ +static int longest_path = 0; + + + +static void +free_entry (entp) + struct entry **entp; +{ + struct entry *e, *n; + + for (e = *entp; e; e = n) + { + n = e->next; + free (e->name); + free (e); + } + *entp = NULL; +} + +static void +append_entry (entp, ent) + struct entry **entp; + struct entry *ent; +{ + /* It doesn't matter if this is slow, since it is run only at + startup, and then infrequently. */ + struct entry *e; + + /* Find end of list. */ + for (e = *entp; e && e->next; e = e->next) + ; + + if (e) + e->next = ent; + else + *entp = ent; +} + +static void +add_entry (entp, filename, is_system) + struct entry **entp; + char *filename; + int is_system; +{ + int len; + struct entry *n; + + n = (struct entry *) ALLOC (sizeof (struct entry)); + n->flags = is_system ? FLAG_SYSTEM : 0; + n->next = NULL; + + len = strlen (filename); + if (len > 4 && (strcmp (filename + len - 4, ".zip") == 0 + || strcmp (filename + len - 4, ".jar") == 0)) + { + n->flags |= FLAG_ZIP; + /* If the user uses -classpath then he'll have to include + libgcj.zip in the value. We check for this in a simplistic + way. Symlinks will fool this test. This is only used for + -MM and -MMD, so it probably isn't terribly important. */ + if (! strcmp (filename, LIBGCJ_ZIP_FILE)) + n->flags |= FLAG_SYSTEM; + } + + /* Note that we add a trailing separator to `.zip' names as well. + This is a little hack that lets the searching code in jcf-io.c + work more easily. Eww. */ + if (filename[len - 1] != '/' && filename[len - 1] != DIR_SEPARATOR) + { + char *f2 = (char *) alloca (len + 2); + strcpy (f2, filename); + f2[len] = DIR_SEPARATOR; + f2[len + 1] = '\0'; + n->name = strdup (f2); + ++len; + } + else + n->name = strdup (filename); + + if (len > longest_path) + longest_path = len; + + append_entry (entp, n); +} + +static void +add_path (entp, cp, is_system) + struct entry **entp; + char *cp; + int is_system; +{ + char *startp, *endp; + + if (cp) + { + char *buf = (char *) alloca (strlen (cp) + 3); + startp = endp = cp; + while (1) + { + if (! *endp || *endp == PATH_SEPARATOR) + { + if (endp == startp) + { + buf[0] = '.'; + buf[1] = DIR_SEPARATOR; + buf[2] = '\0'; + } + else + { + strncpy (buf, startp, endp - startp); + buf[endp - startp] = '\0'; + } + add_entry (entp, buf, is_system); + if (! *endp) + break; + ++endp; + startp = endp; + } + else + ++endp; + } + } +} + +/* Initialize the path module. */ +void +jcf_path_init () +{ + char *cp; + + add_entry (&sys_dirs, ".", 0); + add_entry (&sys_dirs, LIBGCJ_ZIP_FILE, 1); + + GET_ENV_PATH_LIST (cp, "CLASSPATH"); + add_path (&classpath_env, cp, 0); +} + +/* Call this when -classpath is seen on the command line. */ +void +jcf_path_classpath_arg (path) + char *path; +{ + free_entry (&classpath_l); + add_path (&classpath_l, path, 0); +} + +/* Call this when -CLASSPATH is seen on the command line. */ +void +jcf_path_CLASSPATH_arg (path) + char *path; +{ + free_entry (&classpath_u); + add_path (&classpath_u, path, 0); +} + +/* Call this when -I is seen on the command line. */ +void +jcf_path_include_arg (path) + char *path; +{ + add_entry (&include_dirs, path, 0); +} + +/* We `seal' the path by linking everything into one big list. Then + we provide a way to iterate through the sealed list. */ +void +jcf_path_seal () +{ + int do_system = 1; + struct entry *secondary; + + sealed = include_dirs; + include_dirs = NULL; + + if (classpath_l) + { + secondary = classpath_l; + classpath_l = NULL; + do_system = 0; + } + else if (classpath_u) + { + secondary = classpath_u; + classpath_u = NULL; + } + else + { + secondary = classpath_env; + classpath_env = NULL; + } + + free_entry (&classpath_l); + free_entry (&classpath_u); + free_entry (&classpath_env); + + append_entry (&sealed, secondary); + + if (do_system) + { + append_entry (&sealed, sys_dirs); + sys_dirs = NULL; + } + else + free_entry (&sys_dirs); +} + +void * +jcf_path_start () +{ + return (void *) sealed; +} + +void * +jcf_path_next (x) + void *x; +{ + struct entry *ent = (struct entry *) x; + return (void *) ent->next; +} + +/* We guarantee that the return path will either be a zip file, or it + will end with a directory separator. */ +char * +jcf_path_name (x) + void *x; +{ + struct entry *ent = (struct entry *) x; + return ent->name; +} + +int +jcf_path_is_zipfile (x) + void *x; +{ + struct entry *ent = (struct entry *) x; + return (ent->flags & FLAG_ZIP); +} + +int +jcf_path_is_system (x) + void *x; +{ + struct entry *ent = (struct entry *) x; + return (ent->flags & FLAG_SYSTEM); +} + +int +jcf_path_max_len () +{ + return longest_path; +} diff --git a/gcc/java/parse-scan.c b/gcc/java/parse-scan.c new file mode 100644 index 00000000000..654efcfc3fc --- /dev/null +++ b/gcc/java/parse-scan.c @@ -0,0 +1,2440 @@ + +/* A Bison parser, made from ./parse-scan.y + by GNU Bison version 1.25 + */ + +#define YYBISON 1 /* Identify Bison output. */ + +#define PLUS_TK 258 +#define MINUS_TK 259 +#define MULT_TK 260 +#define DIV_TK 261 +#define REM_TK 262 +#define LS_TK 263 +#define SRS_TK 264 +#define ZRS_TK 265 +#define AND_TK 266 +#define XOR_TK 267 +#define OR_TK 268 +#define BOOL_AND_TK 269 +#define BOOL_OR_TK 270 +#define EQ_TK 271 +#define NEQ_TK 272 +#define GT_TK 273 +#define GTE_TK 274 +#define LT_TK 275 +#define LTE_TK 276 +#define PLUS_ASSIGN_TK 277 +#define MINUS_ASSIGN_TK 278 +#define MULT_ASSIGN_TK 279 +#define DIV_ASSIGN_TK 280 +#define REM_ASSIGN_TK 281 +#define LS_ASSIGN_TK 282 +#define SRS_ASSIGN_TK 283 +#define ZRS_ASSIGN_TK 284 +#define AND_ASSIGN_TK 285 +#define XOR_ASSIGN_TK 286 +#define OR_ASSIGN_TK 287 +#define PUBLIC_TK 288 +#define PRIVATE_TK 289 +#define PROTECTED_TK 290 +#define STATIC_TK 291 +#define FINAL_TK 292 +#define SYNCHRONIZED_TK 293 +#define VOLATILE_TK 294 +#define TRANSIENT_TK 295 +#define NATIVE_TK 296 +#define PAD_TK 297 +#define ABSTRACT_TK 298 +#define MODIFIER_TK 299 +#define DECR_TK 300 +#define INCR_TK 301 +#define DEFAULT_TK 302 +#define IF_TK 303 +#define THROW_TK 304 +#define BOOLEAN_TK 305 +#define DO_TK 306 +#define IMPLEMENTS_TK 307 +#define THROWS_TK 308 +#define BREAK_TK 309 +#define IMPORT_TK 310 +#define ELSE_TK 311 +#define INSTANCEOF_TK 312 +#define RETURN_TK 313 +#define VOID_TK 314 +#define CATCH_TK 315 +#define INTERFACE_TK 316 +#define CASE_TK 317 +#define EXTENDS_TK 318 +#define FINALLY_TK 319 +#define SUPER_TK 320 +#define WHILE_TK 321 +#define CLASS_TK 322 +#define SWITCH_TK 323 +#define CONST_TK 324 +#define TRY_TK 325 +#define FOR_TK 326 +#define NEW_TK 327 +#define CONTINUE_TK 328 +#define GOTO_TK 329 +#define PACKAGE_TK 330 +#define THIS_TK 331 +#define BYTE_TK 332 +#define SHORT_TK 333 +#define INT_TK 334 +#define LONG_TK 335 +#define CHAR_TK 336 +#define INTEGRAL_TK 337 +#define FLOAT_TK 338 +#define DOUBLE_TK 339 +#define FP_TK 340 +#define ID_TK 341 +#define REL_QM_TK 342 +#define REL_CL_TK 343 +#define NOT_TK 344 +#define NEG_TK 345 +#define ASSIGN_ANY_TK 346 +#define ASSIGN_TK 347 +#define OP_TK 348 +#define CP_TK 349 +#define OCB_TK 350 +#define CCB_TK 351 +#define OSB_TK 352 +#define CSB_TK 353 +#define SC_TK 354 +#define C_TK 355 +#define DOT_TK 356 +#define STRING_LIT_TK 357 +#define CHAR_LIT_TK 358 +#define INT_LIT_TK 359 +#define FP_LIT_TK 360 +#define TRUE_TK 361 +#define FALSE_TK 362 +#define BOOL_LIT_TK 363 +#define NULL_TK 364 + +#line 37 "./parse-scan.y" + +#define JC1_LITE + +#include "config.h" +#include "system.h" + +#include "obstack.h" +#include "toplev.h" + +extern char *input_filename; +extern FILE *finput, *out; + +/* Obstack for the lexer. */ +struct obstack temporary_obstack; + +/* The current parser context. */ +static struct parser_ctxt *ctxp; + +/* Error and warning counts, current line number, because they're used + elsewhere */ +int java_error_count; +int java_warning_count; +int lineno; + +/* Tweak default rules when necessary. */ +static int absorber; +#define USE_ABSORBER absorber = 0 + +/* Keep track of the current class name and package name. */ +static char *current_class; +static char *package_name; + +/* Keep track of whether things have be listed before. */ +static int previous_output; + +/* Record modifier uses */ +static int modifier_value; + +/* Keep track of number of bracket pairs after a variable declarator + id. */ +static int bracket_count; + +/* Record a method declaration */ +struct method_declarator { + char *method_name; + char *args; +}; +#define NEW_METHOD_DECLARATOR(D,N,A) \ +{ \ + (D) = \ + (struct method_declarator *)xmalloc (sizeof (struct method_declarator)); \ + (D)->method_name = (N); \ + (D)->args = (A); \ +} + +/* Two actions for this grammar */ +static void report_class_declaration PROTO ((char *)); +static void report_main_declaration PROTO ((struct method_declarator *)); + +#include "lex.h" +#include "parse.h" + +#line 100 "./parse-scan.y" +typedef union { + char *node; + struct method_declarator *declarator; + int value; /* For modifiers */ +} YYSTYPE; +#ifndef YYDEBUG +#define YYDEBUG 1 +#endif + +#include <stdio.h> + +#ifndef __cplusplus +#ifndef __STDC__ +#define const +#endif +#endif + + + +#define YYFINAL 601 +#define YYFLAG -32768 +#define YYNTBASE 110 + +#define YYTRANSLATE(x) ((unsigned)(x) <= 364 ? yytranslate[x] : 253) + +static const char yytranslate[] = { 0, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 1, 2, 3, 4, 5, + 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, + 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, + 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, + 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, + 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, + 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, + 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, + 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, + 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, + 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, + 106, 107, 108, 109 +}; + +#if YYDEBUG != 0 +static const short yyprhs[] = { 0, + 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, + 20, 22, 24, 26, 28, 30, 32, 34, 38, 42, + 46, 48, 50, 52, 56, 58, 59, 61, 63, 65, + 68, 71, 74, 78, 80, 83, 85, 88, 92, 94, + 96, 100, 106, 108, 110, 112, 114, 117, 118, 126, + 127, 134, 135, 138, 139, 142, 144, 148, 151, 155, + 157, 160, 162, 164, 166, 168, 170, 172, 174, 176, + 180, 185, 187, 191, 193, 197, 199, 203, 205, 207, + 210, 214, 218, 223, 228, 232, 237, 241, 243, 247, + 250, 254, 255, 258, 260, 264, 266, 269, 271, 274, + 278, 280, 284, 289, 294, 300, 304, 309, 312, 316, + 320, 325, 330, 336, 344, 351, 353, 355, 359, 364, + 369, 375, 378, 382, 385, 389, 391, 394, 396, 398, + 400, 402, 404, 407, 410, 414, 418, 423, 425, 429, + 432, 436, 438, 441, 443, 445, 447, 450, 453, 457, + 459, 461, 463, 465, 467, 469, 471, 473, 475, 477, + 479, 481, 483, 485, 487, 489, 491, 493, 495, 497, + 499, 501, 503, 506, 509, 512, 515, 517, 519, 521, + 523, 525, 527, 529, 535, 543, 551, 557, 560, 564, + 568, 573, 575, 578, 581, 583, 586, 590, 593, 598, + 601, 604, 606, 614, 622, 629, 637, 644, 647, 650, + 651, 653, 655, 656, 658, 660, 664, 667, 671, 674, + 678, 681, 685, 689, 695, 701, 703, 707, 711, 716, + 718, 721, 727, 730, 732, 734, 736, 738, 742, 744, + 746, 748, 750, 754, 758, 762, 766, 772, 777, 784, + 790, 795, 801, 807, 814, 818, 822, 824, 828, 832, + 836, 840, 845, 850, 855, 860, 862, 865, 869, 872, + 876, 880, 884, 888, 893, 899, 906, 912, 919, 924, + 929, 931, 933, 935, 937, 940, 943, 945, 947, 950, + 953, 955, 958, 961, 963, 966, 969, 971, 977, 982, + 987, 993, 995, 999, 1003, 1007, 1009, 1013, 1017, 1019, + 1023, 1027, 1031, 1033, 1037, 1041, 1045, 1049, 1053, 1055, + 1059, 1063, 1065, 1069, 1071, 1075, 1077, 1081, 1083, 1087, + 1089, 1093, 1095, 1101, 1103, 1105, 1109, 1111, 1113, 1115, + 1117, 1119, 1121 +}; + +static const short yyrhs[] = { 123, + 0, 104, 0, 105, 0, 108, 0, 103, 0, 102, + 0, 109, 0, 113, 0, 114, 0, 82, 0, 85, + 0, 50, 0, 115, 0, 118, 0, 119, 0, 115, + 0, 115, 0, 113, 97, 98, 0, 119, 97, 98, + 0, 118, 97, 98, 0, 120, 0, 121, 0, 122, + 0, 119, 101, 122, 0, 86, 0, 0, 126, 0, + 124, 0, 125, 0, 126, 124, 0, 126, 125, 0, + 124, 125, 0, 126, 124, 125, 0, 127, 0, 124, + 127, 0, 130, 0, 125, 130, 0, 75, 119, 99, + 0, 128, 0, 129, 0, 55, 119, 99, 0, 55, + 119, 101, 5, 99, 0, 132, 0, 162, 0, 99, + 0, 44, 0, 131, 44, 0, 0, 131, 67, 122, + 135, 136, 133, 138, 0, 0, 67, 122, 135, 136, + 134, 138, 0, 0, 63, 116, 0, 0, 52, 137, + 0, 117, 0, 137, 100, 117, 0, 95, 96, 0, + 95, 139, 96, 0, 140, 0, 139, 140, 0, 141, + 0, 155, 0, 157, 0, 171, 0, 142, 0, 147, + 0, 132, 0, 162, 0, 112, 143, 99, 0, 131, + 112, 143, 99, 0, 144, 0, 143, 100, 144, 0, + 145, 0, 145, 92, 146, 0, 122, 0, 145, 97, + 98, 0, 251, 0, 169, 0, 148, 154, 0, 112, + 149, 152, 0, 59, 149, 152, 0, 131, 112, 149, + 152, 0, 131, 59, 149, 152, 0, 122, 93, 94, + 0, 122, 93, 150, 94, 0, 149, 97, 98, 0, + 151, 0, 150, 100, 151, 0, 112, 145, 0, 131, + 112, 145, 0, 0, 53, 153, 0, 116, 0, 153, + 100, 116, 0, 171, 0, 171, 99, 0, 99, 0, + 156, 171, 0, 156, 171, 99, 0, 44, 0, 158, + 152, 159, 0, 131, 158, 152, 159, 0, 158, 152, + 159, 99, 0, 131, 158, 152, 159, 99, 0, 120, + 93, 94, 0, 120, 93, 150, 94, 0, 95, 96, + 0, 95, 160, 96, 0, 95, 172, 96, 0, 95, + 160, 172, 96, 0, 161, 93, 94, 99, 0, 161, + 93, 220, 94, 99, 0, 119, 101, 65, 93, 220, + 94, 99, 0, 119, 101, 65, 93, 94, 99, 0, + 76, 0, 65, 0, 61, 122, 164, 0, 131, 61, + 122, 164, 0, 61, 122, 163, 164, 0, 131, 61, + 122, 163, 164, 0, 63, 117, 0, 163, 100, 117, + 0, 95, 96, 0, 95, 165, 96, 0, 166, 0, + 165, 166, 0, 167, 0, 168, 0, 132, 0, 162, + 0, 142, 0, 148, 99, 0, 95, 96, 0, 95, + 170, 96, 0, 95, 100, 96, 0, 95, 170, 100, + 96, 0, 146, 0, 170, 100, 146, 0, 95, 96, + 0, 95, 172, 96, 0, 173, 0, 172, 173, 0, + 174, 0, 176, 0, 132, 0, 175, 99, 0, 112, + 143, 0, 131, 112, 143, 0, 178, 0, 181, 0, + 185, 0, 186, 0, 195, 0, 199, 0, 178, 0, + 182, 0, 187, 0, 196, 0, 200, 0, 171, 0, + 179, 0, 183, 0, 188, 0, 198, 0, 206, 0, + 207, 0, 208, 0, 210, 0, 209, 0, 212, 0, + 99, 0, 122, 88, 0, 180, 176, 0, 180, 177, + 0, 184, 99, 0, 248, 0, 232, 0, 233, 0, + 229, 0, 230, 0, 226, 0, 218, 0, 48, 93, + 251, 94, 176, 0, 48, 93, 251, 94, 177, 56, + 176, 0, 48, 93, 251, 94, 177, 56, 177, 0, + 68, 93, 251, 94, 189, 0, 95, 96, 0, 95, + 192, 96, 0, 95, 190, 96, 0, 95, 190, 192, + 96, 0, 191, 0, 190, 191, 0, 192, 172, 0, + 193, 0, 192, 193, 0, 62, 252, 88, 0, 47, + 88, 0, 66, 93, 251, 94, 0, 194, 176, 0, + 194, 177, 0, 51, 0, 197, 176, 66, 93, 251, + 94, 99, 0, 202, 99, 251, 99, 204, 94, 176, + 0, 202, 99, 99, 204, 94, 176, 0, 202, 99, + 251, 99, 204, 94, 177, 0, 202, 99, 99, 204, + 94, 177, 0, 71, 93, 0, 201, 203, 0, 0, + 205, 0, 175, 0, 0, 205, 0, 184, 0, 205, + 100, 184, 0, 54, 99, 0, 54, 122, 99, 0, + 73, 99, 0, 73, 122, 99, 0, 58, 99, 0, + 58, 251, 99, 0, 49, 251, 99, 0, 211, 93, + 251, 94, 171, 0, 211, 93, 251, 94, 1, 0, + 44, 0, 70, 171, 213, 0, 70, 171, 215, 0, + 70, 171, 213, 215, 0, 214, 0, 213, 214, 0, + 60, 93, 151, 94, 171, 0, 64, 171, 0, 217, + 0, 221, 0, 111, 0, 76, 0, 93, 251, 94, + 0, 218, 0, 225, 0, 226, 0, 227, 0, 119, + 101, 67, 0, 113, 101, 67, 0, 59, 101, 67, + 0, 119, 101, 76, 0, 72, 116, 93, 220, 94, + 0, 72, 116, 93, 94, 0, 72, 116, 93, 220, + 94, 138, 0, 72, 116, 93, 94, 138, 0, 219, + 122, 93, 94, 0, 219, 122, 93, 94, 138, 0, + 219, 122, 93, 220, 94, 0, 219, 122, 93, 220, + 94, 138, 0, 119, 101, 72, 0, 216, 101, 72, + 0, 251, 0, 220, 100, 251, 0, 220, 100, 1, + 0, 72, 113, 222, 0, 72, 115, 222, 0, 72, + 113, 222, 224, 0, 72, 115, 222, 224, 0, 72, + 115, 224, 169, 0, 72, 113, 224, 169, 0, 223, + 0, 222, 223, 0, 97, 251, 98, 0, 97, 98, + 0, 224, 97, 98, 0, 216, 101, 122, 0, 65, + 101, 122, 0, 119, 93, 94, 0, 119, 93, 220, + 94, 0, 216, 101, 122, 93, 94, 0, 216, 101, + 122, 93, 220, 94, 0, 65, 101, 122, 93, 94, + 0, 65, 101, 122, 93, 220, 94, 0, 119, 97, + 251, 98, 0, 217, 97, 251, 98, 0, 216, 0, + 119, 0, 229, 0, 230, 0, 228, 46, 0, 228, + 45, 0, 232, 0, 233, 0, 3, 231, 0, 4, + 231, 0, 234, 0, 46, 231, 0, 45, 231, 0, + 228, 0, 89, 231, 0, 90, 231, 0, 235, 0, + 93, 113, 224, 94, 231, 0, 93, 113, 94, 231, + 0, 93, 251, 94, 234, 0, 93, 119, 224, 94, + 234, 0, 231, 0, 236, 5, 231, 0, 236, 6, + 231, 0, 236, 7, 231, 0, 236, 0, 237, 3, + 236, 0, 237, 4, 236, 0, 237, 0, 238, 8, + 237, 0, 238, 9, 237, 0, 238, 10, 237, 0, + 238, 0, 239, 20, 238, 0, 239, 18, 238, 0, + 239, 21, 238, 0, 239, 19, 238, 0, 239, 57, + 114, 0, 239, 0, 240, 16, 239, 0, 240, 17, + 239, 0, 240, 0, 241, 11, 240, 0, 241, 0, + 242, 12, 241, 0, 242, 0, 243, 13, 242, 0, + 243, 0, 244, 14, 243, 0, 244, 0, 245, 15, + 244, 0, 245, 0, 245, 87, 251, 88, 246, 0, + 246, 0, 248, 0, 249, 250, 247, 0, 119, 0, + 225, 0, 227, 0, 91, 0, 92, 0, 247, 0, + 251, 0 +}; + +#endif + +#if YYDEBUG != 0 +static const short yyrline[] = { 0, + 171, 176, 178, 179, 180, 181, 182, 186, 188, 191, + 197, 202, 209, 211, 214, 218, 222, 226, 228, 235, + 245, 247, 250, 254, 263, 268, 269, 270, 271, 272, + 273, 274, 275, 278, 280, 283, 285, 288, 293, 295, + 298, 302, 306, 308, 309, 315, 324, 335, 342, 342, + 345, 347, 348, 351, 352, 355, 358, 362, 364, 367, + 369, 372, 374, 375, 376, 379, 381, 382, 383, 387, + 390, 394, 397, 400, 402, 405, 408, 412, 414, 418, + 422, 425, 426, 428, 435, 442, 448, 451, 453, 461, + 477, 493, 494, 497, 500, 504, 506, 507, 511, 513, + 516, 526, 528, 531, 533, 539, 542, 546, 548, 549, + 550, 554, 556, 559, 561, 565, 567, 572, 574, 576, + 577, 581, 583, 586, 588, 591, 593, 596, 598, 599, + 600, 603, 607, 612, 614, 615, 616, 619, 621, 625, + 627, 630, 632, 635, 637, 638, 641, 645, 648, 652, + 654, 655, 656, 657, 658, 661, 663, 664, 665, 666, + 669, 671, 672, 673, 674, 675, 676, 677, 678, 679, + 680, 683, 687, 692, 696, 702, 706, 708, 709, 710, + 711, 712, 713, 716, 720, 724, 728, 732, 734, 735, + 736, 739, 741, 744, 749, 751, 754, 756, 759, 763, + 767, 771, 775, 779, 781, 784, 786, 789, 793, 796, + 797, 798, 801, 802, 805, 807, 810, 812, 815, 817, + 820, 822, 825, 829, 831, 834, 839, 841, 842, 845, + 847, 850, 854, 859, 861, 864, 866, 867, 868, 869, + 870, 871, 875, 877, 879, 883, 887, 889, 893, 894, + 898, 899, 900, 901, 904, 907, 910, 912, 913, 916, + 918, 919, 920, 923, 924, 927, 929, 932, 936, 938, + 941, 943, 946, 949, 951, 952, 953, 954, 957, 960, + 963, 965, 967, 968, 971, 975, 979, 981, 982, 983, + 984, 987, 991, 995, 997, 998, 999, 1002, 1004, 1005, + 1006, 1009, 1011, 1012, 1013, 1016, 1018, 1019, 1022, 1024, + 1025, 1026, 1029, 1031, 1032, 1033, 1034, 1035, 1038, 1040, + 1041, 1044, 1046, 1049, 1051, 1054, 1056, 1059, 1061, 1064, + 1066, 1069, 1071, 1074, 1076, 1079, 1083, 1086, 1087, 1090, + 1092, 1095, 1099 +}; +#endif + + +#if YYDEBUG != 0 || defined (YYERROR_VERBOSE) + +static const char * const yytname[] = { "$","error","$undefined.","PLUS_TK", +"MINUS_TK","MULT_TK","DIV_TK","REM_TK","LS_TK","SRS_TK","ZRS_TK","AND_TK","XOR_TK", +"OR_TK","BOOL_AND_TK","BOOL_OR_TK","EQ_TK","NEQ_TK","GT_TK","GTE_TK","LT_TK", +"LTE_TK","PLUS_ASSIGN_TK","MINUS_ASSIGN_TK","MULT_ASSIGN_TK","DIV_ASSIGN_TK", +"REM_ASSIGN_TK","LS_ASSIGN_TK","SRS_ASSIGN_TK","ZRS_ASSIGN_TK","AND_ASSIGN_TK", +"XOR_ASSIGN_TK","OR_ASSIGN_TK","PUBLIC_TK","PRIVATE_TK","PROTECTED_TK","STATIC_TK", +"FINAL_TK","SYNCHRONIZED_TK","VOLATILE_TK","TRANSIENT_TK","NATIVE_TK","PAD_TK", +"ABSTRACT_TK","MODIFIER_TK","DECR_TK","INCR_TK","DEFAULT_TK","IF_TK","THROW_TK", +"BOOLEAN_TK","DO_TK","IMPLEMENTS_TK","THROWS_TK","BREAK_TK","IMPORT_TK","ELSE_TK", +"INSTANCEOF_TK","RETURN_TK","VOID_TK","CATCH_TK","INTERFACE_TK","CASE_TK","EXTENDS_TK", +"FINALLY_TK","SUPER_TK","WHILE_TK","CLASS_TK","SWITCH_TK","CONST_TK","TRY_TK", +"FOR_TK","NEW_TK","CONTINUE_TK","GOTO_TK","PACKAGE_TK","THIS_TK","BYTE_TK","SHORT_TK", +"INT_TK","LONG_TK","CHAR_TK","INTEGRAL_TK","FLOAT_TK","DOUBLE_TK","FP_TK","ID_TK", +"REL_QM_TK","REL_CL_TK","NOT_TK","NEG_TK","ASSIGN_ANY_TK","ASSIGN_TK","OP_TK", +"CP_TK","OCB_TK","CCB_TK","OSB_TK","CSB_TK","SC_TK","C_TK","DOT_TK","STRING_LIT_TK", +"CHAR_LIT_TK","INT_LIT_TK","FP_LIT_TK","TRUE_TK","FALSE_TK","BOOL_LIT_TK","NULL_TK", +"goal","literal","type","primitive_type","reference_type","class_or_interface_type", +"class_type","interface_type","array_type","name","simple_name","qualified_name", +"identifier","compilation_unit","import_declarations","type_declarations","package_declaration", +"import_declaration","single_type_import_declaration","type_import_on_demand_declaration", +"type_declaration","modifiers","class_declaration","@1","@2","super","interfaces", +"interface_type_list","class_body","class_body_declarations","class_body_declaration", +"class_member_declaration","field_declaration","variable_declarators","variable_declarator", +"variable_declarator_id","variable_initializer","method_declaration","method_header", +"method_declarator","formal_parameter_list","formal_parameter","throws","class_type_list", +"method_body","static_initializer","static","constructor_declaration","constructor_declarator", +"constructor_body","explicit_constructor_invocation","this_or_super","interface_declaration", +"extends_interfaces","interface_body","interface_member_declarations","interface_member_declaration", +"constant_declaration","abstract_method_declaration","array_initializer","variable_initializers", +"block","block_statements","block_statement","local_variable_declaration_statement", +"local_variable_declaration","statement","statement_nsi","statement_without_trailing_substatement", +"empty_statement","label_decl","labeled_statement","labeled_statement_nsi","expression_statement", +"statement_expression","if_then_statement","if_then_else_statement","if_then_else_statement_nsi", +"switch_statement","switch_block","switch_block_statement_groups","switch_block_statement_group", +"switch_labels","switch_label","while_expression","while_statement","while_statement_nsi", +"do_statement_begin","do_statement","for_statement","for_statement_nsi","for_header", +"for_begin","for_init","for_update","statement_expression_list","break_statement", +"continue_statement","return_statement","throw_statement","synchronized_statement", +"synchronized","try_statement","catches","catch_clause","finally","primary", +"primary_no_new_array","class_instance_creation_expression","something_dot_new", +"argument_list","array_creation_expression","dim_exprs","dim_expr","dims","field_access", +"method_invocation","array_access","postfix_expression","post_increment_expression", +"post_decrement_expression","unary_expression","pre_increment_expression","pre_decrement_expression", +"unary_expression_not_plus_minus","cast_expression","multiplicative_expression", +"additive_expression","shift_expression","relational_expression","equality_expression", +"and_expression","exclusive_or_expression","inclusive_or_expression","conditional_and_expression", +"conditional_or_expression","conditional_expression","assignment_expression", +"assignment","left_hand_side","assignment_operator","expression","constant_expression", NULL +}; +#endif + +static const short yyr1[] = { 0, + 110, 111, 111, 111, 111, 111, 111, 112, 112, 113, + 113, 113, 114, 114, 115, 116, 117, 118, 118, 118, + 119, 119, 120, 121, 122, 123, 123, 123, 123, 123, + 123, 123, 123, 124, 124, 125, 125, 126, 127, 127, + 128, 129, 130, 130, 130, 131, 131, 133, 132, 134, + 132, 135, 135, 136, 136, 137, 137, 138, 138, 139, + 139, 140, 140, 140, 140, 141, 141, 141, 141, 142, + 142, 143, 143, 144, 144, 145, 145, 146, 146, 147, + 148, 148, 148, 148, 149, 149, 149, 150, 150, 151, + 151, 152, 152, 153, 153, 154, 154, 154, 155, 155, + 156, 157, 157, 157, 157, 158, 158, 159, 159, 159, + 159, 160, 160, 160, 160, 161, 161, 162, 162, 162, + 162, 163, 163, 164, 164, 165, 165, 166, 166, 166, + 166, 167, 168, 169, 169, 169, 169, 170, 170, 171, + 171, 172, 172, 173, 173, 173, 174, 175, 175, 176, + 176, 176, 176, 176, 176, 177, 177, 177, 177, 177, + 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, + 178, 179, 180, 181, 182, 183, 184, 184, 184, 184, + 184, 184, 184, 185, 186, 187, 188, 189, 189, 189, + 189, 190, 190, 191, 192, 192, 193, 193, 194, 195, + 196, 197, 198, 199, 199, 200, 200, 201, 202, 203, + 203, 203, 204, 204, 205, 205, 206, 206, 207, 207, + 208, 208, 209, 210, 210, 211, 212, 212, 212, 213, + 213, 214, 215, 216, 216, 217, 217, 217, 217, 217, + 217, 217, 217, 217, 217, 217, 218, 218, 218, 218, + 218, 218, 218, 218, 219, 219, 220, 220, 220, 221, + 221, 221, 221, 221, 221, 222, 222, 223, 224, 224, + 225, 225, 226, 226, 226, 226, 226, 226, 227, 227, + 228, 228, 228, 228, 229, 230, 231, 231, 231, 231, + 231, 232, 233, 234, 234, 234, 234, 235, 235, 235, + 235, 236, 236, 236, 236, 237, 237, 237, 238, 238, + 238, 238, 239, 239, 239, 239, 239, 239, 240, 240, + 240, 241, 241, 242, 242, 243, 243, 244, 244, 245, + 245, 246, 246, 247, 247, 248, 249, 249, 249, 250, + 250, 251, 252 +}; + +static const short yyr2[] = { 0, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 3, 3, 3, + 1, 1, 1, 3, 1, 0, 1, 1, 1, 2, + 2, 2, 3, 1, 2, 1, 2, 3, 1, 1, + 3, 5, 1, 1, 1, 1, 2, 0, 7, 0, + 6, 0, 2, 0, 2, 1, 3, 2, 3, 1, + 2, 1, 1, 1, 1, 1, 1, 1, 1, 3, + 4, 1, 3, 1, 3, 1, 3, 1, 1, 2, + 3, 3, 4, 4, 3, 4, 3, 1, 3, 2, + 3, 0, 2, 1, 3, 1, 2, 1, 2, 3, + 1, 3, 4, 4, 5, 3, 4, 2, 3, 3, + 4, 4, 5, 7, 6, 1, 1, 3, 4, 4, + 5, 2, 3, 2, 3, 1, 2, 1, 1, 1, + 1, 1, 2, 2, 3, 3, 4, 1, 3, 2, + 3, 1, 2, 1, 1, 1, 2, 2, 3, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 2, 2, 2, 2, 1, 1, 1, 1, + 1, 1, 1, 5, 7, 7, 5, 2, 3, 3, + 4, 1, 2, 2, 1, 2, 3, 2, 4, 2, + 2, 1, 7, 7, 6, 7, 6, 2, 2, 0, + 1, 1, 0, 1, 1, 3, 2, 3, 2, 3, + 2, 3, 3, 5, 5, 1, 3, 3, 4, 1, + 2, 5, 2, 1, 1, 1, 1, 3, 1, 1, + 1, 1, 3, 3, 3, 3, 5, 4, 6, 5, + 4, 5, 5, 6, 3, 3, 1, 3, 3, 3, + 3, 4, 4, 4, 4, 1, 2, 3, 2, 3, + 3, 3, 3, 4, 5, 6, 5, 6, 4, 4, + 1, 1, 1, 1, 2, 2, 1, 1, 2, 2, + 1, 2, 2, 1, 2, 2, 1, 5, 4, 4, + 5, 1, 3, 3, 3, 1, 3, 3, 1, 3, + 3, 3, 1, 3, 3, 3, 3, 3, 1, 3, + 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, + 3, 1, 5, 1, 1, 3, 1, 1, 1, 1, + 1, 1, 1 +}; + +static const short yydefact[] = { 26, + 46, 0, 0, 0, 0, 45, 1, 28, 29, 27, + 34, 39, 40, 36, 0, 43, 44, 25, 0, 21, + 22, 23, 0, 52, 0, 32, 35, 37, 30, 31, + 47, 0, 0, 41, 0, 0, 0, 0, 118, 0, + 54, 38, 0, 33, 0, 52, 0, 24, 17, 122, + 15, 12, 0, 10, 11, 124, 0, 8, 9, 13, + 14, 15, 0, 130, 132, 0, 131, 0, 126, 128, + 129, 0, 120, 16, 53, 0, 50, 0, 119, 54, + 42, 0, 92, 76, 0, 72, 74, 92, 0, 0, + 0, 0, 0, 133, 125, 127, 123, 56, 55, 0, + 121, 48, 0, 0, 0, 82, 70, 0, 0, 0, + 81, 18, 20, 19, 92, 0, 92, 0, 0, 51, + 0, 85, 0, 0, 0, 88, 94, 93, 87, 76, + 73, 0, 0, 0, 0, 0, 0, 0, 237, 0, + 0, 0, 0, 6, 5, 2, 3, 4, 7, 236, + 0, 282, 75, 79, 281, 234, 239, 0, 235, 240, + 241, 242, 294, 283, 284, 302, 287, 288, 291, 297, + 306, 309, 313, 319, 322, 324, 326, 328, 330, 332, + 334, 342, 335, 0, 78, 77, 84, 71, 83, 57, + 46, 0, 58, 21, 0, 68, 0, 60, 62, 66, + 67, 0, 63, 0, 64, 92, 69, 65, 49, 90, + 0, 86, 0, 0, 282, 240, 242, 289, 290, 293, + 292, 0, 0, 0, 16, 0, 295, 296, 0, 282, + 0, 134, 0, 138, 0, 0, 0, 0, 0, 0, + 0, 0, 286, 285, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 340, 341, 0, 46, 0, + 0, 202, 0, 0, 0, 0, 0, 0, 0, 0, + 140, 172, 0, 8, 282, 23, 0, 146, 161, 0, + 142, 144, 0, 145, 150, 162, 0, 151, 163, 0, + 152, 153, 164, 0, 154, 0, 165, 155, 210, 0, + 166, 167, 168, 170, 169, 0, 171, 239, 241, 0, + 180, 181, 178, 179, 177, 0, 92, 59, 61, 98, + 80, 96, 99, 0, 91, 89, 95, 245, 272, 0, + 260, 266, 0, 261, 0, 0, 0, 0, 0, 0, + 0, 238, 136, 135, 0, 244, 273, 0, 257, 0, + 243, 255, 246, 256, 271, 0, 0, 303, 304, 305, + 307, 308, 310, 311, 312, 315, 317, 314, 316, 0, + 318, 320, 321, 323, 325, 327, 329, 331, 0, 336, + 0, 0, 217, 0, 221, 0, 0, 0, 0, 208, + 219, 0, 0, 148, 0, 173, 0, 141, 143, 147, + 226, 174, 176, 200, 0, 0, 212, 215, 209, 211, + 0, 0, 106, 0, 0, 97, 100, 0, 102, 0, + 269, 0, 267, 262, 0, 265, 263, 264, 248, 0, + 299, 0, 0, 300, 137, 139, 274, 0, 279, 0, + 280, 251, 0, 0, 0, 223, 218, 222, 0, 0, + 0, 0, 227, 230, 228, 220, 238, 149, 0, 0, + 213, 0, 0, 107, 103, 117, 237, 108, 282, 0, + 0, 0, 104, 277, 0, 268, 270, 250, 247, 298, + 301, 259, 258, 275, 0, 252, 253, 333, 0, 199, + 0, 0, 233, 231, 229, 0, 216, 0, 214, 213, + 0, 105, 0, 109, 0, 0, 110, 278, 249, 276, + 254, 0, 184, 0, 150, 0, 157, 158, 0, 159, + 160, 0, 0, 187, 0, 0, 0, 0, 225, 224, + 0, 111, 0, 0, 0, 0, 175, 201, 0, 0, + 0, 188, 0, 192, 0, 195, 0, 0, 205, 0, + 0, 112, 0, 0, 185, 213, 0, 198, 343, 0, + 190, 193, 0, 189, 194, 196, 232, 203, 204, 0, + 0, 113, 0, 0, 213, 197, 191, 115, 0, 0, + 0, 0, 114, 0, 207, 0, 186, 206, 0, 0, + 0 +}; + +static const short yydefgoto[] = { 599, + 150, 283, 151, 59, 60, 75, 50, 61, 152, 20, + 21, 22, 7, 8, 9, 10, 11, 12, 13, 14, + 287, 288, 121, 100, 41, 77, 99, 120, 197, 198, + 199, 65, 85, 86, 87, 153, 201, 66, 83, 125, + 126, 106, 128, 331, 203, 204, 205, 206, 429, 480, + 481, 17, 38, 39, 68, 69, 70, 71, 154, 235, + 289, 575, 291, 292, 293, 294, 524, 295, 296, 297, + 298, 527, 299, 300, 301, 302, 528, 303, 534, 553, + 554, 555, 556, 304, 305, 530, 306, 307, 308, 531, + 309, 310, 419, 508, 509, 311, 312, 313, 314, 315, + 316, 317, 463, 464, 465, 155, 156, 157, 158, 358, + 159, 341, 342, 343, 160, 161, 162, 163, 164, 165, + 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, + 176, 177, 178, 179, 180, 181, 182, 183, 184, 268, + 359, 570 +}; + +static const short yypact[] = { 11, +-32768, -52, -52, -52, -52,-32768,-32768, 18, 154, 18, +-32768,-32768,-32768,-32768, 185,-32768,-32768,-32768, 187,-32768, +-32768,-32768, -24, -5, 332, 154,-32768,-32768, 18, 154, +-32768, -52, -52,-32768, 5, -52, 745, 162,-32768, -52, + 76,-32768, -52, 154, -24, -5, 57,-32768,-32768,-32768, + 41,-32768, -52,-32768,-32768,-32768, -52, 71,-32768,-32768, + 170, 113, 518,-32768,-32768, 126,-32768, 758,-32768,-32768, +-32768, -52,-32768,-32768,-32768, -52,-32768, 162,-32768, 76, +-32768, 249, -15, 249, 321,-32768, 205, -15, 149, 255, + 265, -52, -52,-32768,-32768,-32768,-32768,-32768, 198, 294, +-32768,-32768, 58, -52, 298,-32768,-32768, -52, 1568, 309, +-32768,-32768,-32768,-32768, -15, 359, -15, -52, 596,-32768, + 294,-32768, -52, 199, -13,-32768,-32768, 310,-32768,-32768, +-32768, 2315, 2315, 2315, 2315, 329, 352, 88,-32768, 2315, + 2315, 2315, 1438,-32768,-32768,-32768,-32768,-32768,-32768,-32768, + 354, 393,-32768,-32768, 360, 369,-32768, -52,-32768, 347, +-32768, 378, 437,-32768,-32768,-32768,-32768,-32768,-32768,-32768, + 445, 495, 483, 380, 492, 461, 462, 467, 502, 1, +-32768,-32768,-32768, 412,-32768,-32768,-32768,-32768,-32768,-32768, + 423, 2513,-32768, 429, 518,-32768, 683,-32768,-32768,-32768, +-32768, 128,-32768, 432,-32768, 471,-32768,-32768,-32768, 435, + -52,-32768, 337, -52, 52,-32768,-32768,-32768,-32768,-32768, +-32768, 468, -52, 440, 440, 449,-32768,-32768, 174, 414, + 454,-32768, 460,-32768, 235, 500, 1619, 2315, 261, -21, + 2315, 476,-32768,-32768, 2315, 2315, 2315, 2315, 2315, 2315, + 2315, 2315, 2315, 2315, 2315, 2315, 88, 2315, 2315, 2315, + 2315, 2315, 2315, 2315, 2315,-32768,-32768, 2315, 480, 482, + 2315,-32768, 60, 1684, 490, 491, 432, 494, 89, 2315, +-32768,-32768, -52, 137, 559, 488, 496,-32768,-32768, 2579, +-32768,-32768, 493,-32768,-32768,-32768, 2975,-32768,-32768, 498, +-32768,-32768,-32768, 2975,-32768, 2975,-32768,-32768, 1029, 499, +-32768,-32768,-32768,-32768,-32768, 497,-32768, 96, 196, 437, + 485, 505,-32768,-32768,-32768, 323, 471,-32768,-32768,-32768, +-32768, 506, 507, 504, 435,-32768,-32768,-32768, 508, 1735, + 440,-32768, 339, 440, 339, 1800, 2315, 509, 180, 1735, + 246, 1364,-32768,-32768, 1503,-32768,-32768, 3,-32768, 512, +-32768,-32768,-32768,-32768, 520, 513, 1851,-32768,-32768,-32768, + 445, 445, 495, 495, 495, 483, 483, 483, 483, 71, +-32768, 380, 380, 492, 461, 462, 467, 502, 501,-32768, + 2315, 522,-32768, 523,-32768, 526, 2315, 2315, 322,-32768, +-32768, 528, 534, 535, 1916,-32768, -52,-32768,-32768,-32768, +-32768,-32768,-32768,-32768, 572, 199,-32768,-32768,-32768, 539, + 1967, 2315,-32768, 141, 504,-32768,-32768, 2645, 543, 2032, +-32768, 545,-32768, 547, 549,-32768, 547,-32768, 294, 244, +-32768, 2315, 1364,-32768,-32768,-32768,-32768, 1323,-32768, 2083, +-32768, 294, 251, 2315, 555,-32768,-32768,-32768, 564, 565, + 573, 432, 322,-32768,-32768,-32768,-32768, 535, 576, 1171, + 1171, 566, 582,-32768, 571, 352, 584,-32768, 849, 2711, + 587, 2777,-32768,-32768, 256,-32768,-32768,-32768, 294,-32768, +-32768,-32768,-32768,-32768, 260,-32768, 294,-32768, 3041,-32768, + 588, 337,-32768,-32768,-32768, 2315,-32768, 591, 539, 1171, + 6,-32768, 183,-32768, 2843, 2148,-32768,-32768,-32768,-32768, +-32768, 593,-32768, 631, 632, 3041,-32768,-32768, 3041,-32768, +-32768, 590, -16,-32768, 600, 601, 2975, 602,-32768,-32768, + 604,-32768, 603, 272, 2315, 2975,-32768,-32768, 2199, 611, + 2315,-32768, 45,-32768, 2381,-32768, 432, 609,-32768, 2975, + 2264,-32768, 610, 616,-32768, 1171, 613,-32768,-32768, 615, +-32768,-32768, 2447,-32768, 2909,-32768,-32768,-32768,-32768, 619, + 280,-32768, 3041, 621, 1171,-32768,-32768,-32768, 623, 670, + 3041, 636,-32768, 3041,-32768, 3041,-32768,-32768, 725, 735, +-32768 +}; + +static const short yypgoto[] = {-32768, +-32768, 139, -26, 479, 253, -85, 43,-32768, 59, -72, +-32768, -3,-32768, 729, 150,-32768, 20,-32768,-32768, 200, + 15, 586,-32768,-32768, 695, 665,-32768, -113,-32768, 550, +-32768, -83, -80, 640, -105, -138,-32768, -71, 93, 426, + -211, -82,-32768,-32768,-32768,-32768,-32768, 554, 328,-32768, +-32768, -25, 709, -18,-32768, 688,-32768,-32768, 103,-32768, + -93, -188, -276,-32768, 450, -167, -372, -378,-32768, -151, +-32768,-32768,-32768, -306,-32768,-32768,-32768,-32768,-32768,-32768, + 207, 208, -499, -134,-32768,-32768,-32768,-32768,-32768,-32768, +-32768, -58,-32768, -453, 458,-32768,-32768,-32768,-32768,-32768, +-32768,-32768,-32768, 295, 300,-32768,-32768, 138,-32768, -283, +-32768, 546, 14, -208, 1037, 191, 1059, 327, 410, 434, + -65, 487, 570, -343,-32768, 305, 308, 159, 306, 510, + 511, 519, 517, 524,-32768, 319, 531, 669,-32768,-32768, + 123,-32768 +}; + + +#define YYLAST 3150 + + +static const short yytable[] = { 23, + 24, 336, 418, 290, 234, 111, 539, 209, 444, 47, + 58, 67, 116, 409, 15, 264, 345, 210, 127, 73, + 349, 351, 15, 15, 15, 208, 79, 27, 45, 46, + 550, 48, 187, 18, 189, 200, 58, 104, 36, 48, + 15, 58, 67, 15, 15, 551, 194, 202, 27, 82, + 364, 63, 226, 84, 1, 576, 538, 40, 15, 101, + 19, 1, 440, 25, 18, 2, 218, 219, 220, 221, + 37, 3, 2, 576, 227, 228, 58, 4, 3, 552, + 212, 105, 63, 453, 4, 5, 213, 265, 82, 84, + 18, 550, 58, 207, 51, 62, 447, 58, 51, 491, + 192, 1, 448, 208, 130, 335, 551, 52, 332, 6, + 333, 224, 584, 200, 97, 229, 6, 124, 98, 130, + 525, 62, 194, 334, 194, 202, 62, 76, 337, 412, + 51, 592, 434, 195, 51, 437, 414, 52, 415, 54, + 571, 43, 55, 18, 237, 18, 485, 525, 238, 88, + 525, 122, 239, 547, 242, 81, 548, 26, 393, 30, + 190, 62, 51, 507, 418, 284, 495, 89, 58, 54, + 58, 207, 55, 18, 18, 57, 51, 62, 44, 368, + 369, 370, 62, 399, 115, 117, 58, 401, 286, -183, + 215, 215, 215, 215, -183, -183, 51, 1, 215, 215, + 230, 93, 404, 418, 525, 409, 57, 130, 28, 91, + 590, 195, 525, 43, 3, 525, 446, 525, 595, 339, + 4, 597, 192, 598, 94, 28, 330, 124, 31, 28, + 380, 185, 544, 89, 474, 48, 365, 236, 409, 482, + 213, 123, 31, 28, 425, 32, 112, 541, 52, 361, + 285, 33, 6, 62, 362, 62, 37, 57, 363, 418, + 58, 72, 211, 284, 231, 185, 90, 347, 18, 394, + 348, 62, 51, 442, 236, 402, 435, 581, 418, 130, + 54, 441, 284, 55, 18, 34, 286, 35, 49, -182, + 535, 515, 74, 286, -182, -182, 109, 118, 409, 58, + 286, 110, 286, 215, 215, 215, 215, 215, 215, 215, + 215, 215, 215, 215, 215, 62, 215, 215, 215, 215, + 215, 215, 215, 416, 49, 488, 468, 361, 49, 318, + 354, 523, 362, 93, 355, 57, 363, 489, 496, 443, + 124, 103, 435, 448, 497, 62, 18, 526, 285, 518, + 448, 123, 113, 520, 433, 448, 74, 433, 412, 448, + 360, 414, 114, 366, 529, 563, 1, 285, 503, 559, + 49, 448, 52, 589, 526, 519, 490, 526, 565, 448, + 1, 461, 319, 521, 62, 462, 52, 389, 119, 58, + 225, 529, 579, 392, 529, 129, 396, 253, 254, 255, + 256, 284, 403, 130, 54, 215, 186, 55, 18, 214, + 215, 376, 377, 378, 379, 523, 423, 540, 54, 107, + 108, 55, 18, 559, 286, 407, 565, 318, 579, 222, + 42, 526, 43, 143, 318, 435, 257, -338, -338, 526, + 532, 318, 526, 318, 526, 436, 318, 438, 529, 245, + 246, 247, 223, 284, 236, 284, 529, 188, 108, 529, + 240, 529, 432, 577, 123, 241, 74, 532, -339, -339, + 532, 260, 360, 261, 62, 58, 286, 185, 286, 262, + 319, 243, 244, -337, -337, 237, 479, 319, 284, 238, + 250, 251, 252, 239, 319, 286, 319, 248, 249, 319, + 215, 215, 266, 267, -337, -337, 237, 258, 259, 48, + 350, 286, 215, 455, 239, 263, 124, -101, 320, 459, + 460, 326, 286, 104, 532, 286, 192, 360, 284, -283, + -283, 110, 532, 286, 338, 532, 340, 532, 285, 31, + 285, 346, 286, 472, 473, 52, 284, 352, 284, -284, + -284, 286, 371, 372, 407, 353, 286, 373, 374, 375, + 62, 31, 33, 382, 383, 318, 356, 52, 367, 286, + 493, 286, -226, 285, 391, 406, 92, 54, 32, 286, + 55, 18, 397, 398, 33, 16, 400, 286, 454, 422, + 286, 410, 286, 16, 16, 16, 413, 421, 428, 54, + 430, 321, 55, 18, 426, 427, 431, 318, 318, 449, + 451, 16, 450, 285, 16, 16, 320, 318, 319, 318, + 456, 457, 64, 320, 458, 322, 466, 467, 536, 16, + 320, 285, 320, 285, 108, 320, 318, 469, 470, 191, + 123, 483, 486, 435, -15, 52, 487, 318, 499, -337, + -337, 237, 318, 64, 53, 405, 3, 500, 501, 239, + 319, 319, 4, 318, 510, 502, 318, 564, 506, 512, + 319, 567, 319, 569, 318, 511, -116, 54, 323, 516, + 55, 18, 533, 318, 537, 545, 546, -156, 549, 319, + 192, 193, 318, 557, 558, 560, 561, 318, 568, 321, + 319, 562, 586, 318, 196, 319, 321, 578, 582, 583, + 318, 585, 318, 321, 591, 321, 319, 588, 321, 319, + 318, 593, 318, 322, 600, 594, 191, 319, 318, 596, + 322, 318, 52, 318, 601, 381, 319, 322, 29, 322, + 80, 53, 322, 3, 102, 319, 329, 131, 327, 4, + 319, 424, 475, 78, 320, 96, 319, 504, 417, 572, + 573, 324, 505, 319, 54, 319, 420, 55, 18, 384, + 344, 385, 498, 319, 0, 319, 323, 192, 328, 387, + 386, 319, 196, 323, 319, 0, 319, 388, 1, 0, + 323, 0, 323, 0, 52, 323, 320, 320, 390, 0, + 0, 1, 0, 53, 0, 3, 320, 52, 320, 0, + 0, 4, 0, 0, 0, 0, 53, 0, 3, 0, + 0, 0, 0, 0, 4, 320, 54, 0, 0, 55, + 18, 0, 0, 0, 0, 0, 320, 321, 0, 54, + 56, 320, 55, 18, 0, 0, 0, 0, 0, 0, + 0, 0, 320, 95, 0, 320, 0, 0, 0, 324, + 325, 322, 0, 320, 0, 0, 324, 0, 0, 0, + 0, 0, 320, 324, 0, 324, 0, 0, 324, 321, + 321, 320, 0, 0, 0, 0, 320, 0, 0, 321, + 0, 321, 320, 0, 0, 0, 0, 0, 0, 320, + 0, 320, 0, 322, 322, 0, 0, 0, 321, 320, + 0, 320, 0, 322, 323, 322, 0, 320, 0, 321, + 320, 0, 320, 0, 321, 0, 0, 0, 0, 0, + 0, 0, 322, 0, -15, 321, 0, 0, 321, -337, + -337, 237, 0, 322, 0, 405, 321, 0, 322, 513, + 0, 0, 0, 0, 0, 321, 323, 323, 325, 322, + 0, 0, 322, 0, 321, 325, 323, 0, 323, 321, + 322, 0, 325, 0, 325, 321, 0, 325, 0, 322, + 0, 0, 321, 0, 321, 323, 0, 0, 322, 0, + 0, 0, 321, 322, 321, 0, 323, 324, 0, 322, + 321, 323, 0, 321, 0, 321, 322, 0, 322, 0, + 0, 0, 323, 0, 0, 323, 322, 0, 322, 0, + 0, 0, 0, 323, 322, 0, 0, 322, 0, 322, + 0, 0, 323, 0, 0, 0, 0, 0, 0, 324, + 324, 323, 0, 0, 0, 0, 323, 0, 0, 324, + 0, 324, 323, 0, 0, 0, 0, 0, 0, 323, + 0, 323, 0, 0, 0, 0, 0, 0, 324, 323, + 0, 323, 1, 134, 135, 0, 0, 323, 52, 324, + 323, 0, 323, 0, 324, 0, 0, 136, 0, 0, + 0, 0, 0, 137, 0, 324, 325, 0, 324, 0, + 138, 0, 0, 0, 139, 0, 324, 0, 0, 0, + 54, 0, 0, 55, 18, 324, 0, 0, 0, 0, + 0, 280, 0, 0, 324, 0, 0, 0, 0, 324, + 144, 145, 146, 147, 0, 324, 148, 149, 325, 325, + 0, 0, 324, 0, 324, 0, 0, 0, 325, 0, + 325, 0, 324, 0, 324, 0, 0, 0, 0, 0, + 324, 0, 0, 324, 0, 324, 0, 325, 216, 216, + 216, 216, 0, 0, 0, 0, 216, 216, 325, 0, + 0, 0, 0, 325, 0, 0, 0, 0, 0, 0, + 217, 217, 217, 217, 325, 0, 0, 325, 217, 217, + 0, 0, 0, 0, 0, 325, 0, 0, 0, 0, + 0, 0, 0, 0, 325, 134, 135, 0, 0, 0, + 52, 0, 0, 325, 0, 0, 0, 0, 325, 136, + 0, 0, 0, 0, 325, 137, 0, 0, 0, 0, + 0, 325, 138, 325, 0, 0, 139, 0, 0, 0, + 0, 325, 54, 325, 0, 55, 18, 0, 0, 325, + 0, 0, 325, 280, 325, 0, 0, 0, 0, 0, + 0, 0, 144, 145, 146, 147, 0, 0, 148, 149, + 0, 216, 216, 216, 216, 216, 216, 216, 216, 216, + 216, 216, 216, 0, 216, 216, 216, 216, 216, 216, + 216, 0, 0, 217, 217, 217, 217, 217, 217, 217, + 217, 217, 217, 217, 217, 0, 217, 217, 217, 217, + 217, 217, 217, 492, 0, 132, 133, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 134, 135, 0, + 0, 0, 52, 0, 0, 0, 0, 0, 0, 0, + 0, 136, 0, 216, 0, 0, 0, 137, 216, 0, + 0, 0, 0, 0, 138, 0, 0, 0, 139, 0, + 0, 0, 0, 0, 54, 217, 0, 55, 18, 0, + 217, 140, 141, 52, 0, 142, 0, 0, 0, 0, + 0, 0, 136, 0, 144, 145, 146, 147, 137, 0, + 148, 149, 0, 0, 0, 138, 0, 0, 0, 139, + 132, 133, 0, 0, 0, 54, 0, 0, 55, 18, + 0, 0, 140, 141, 0, 0, 142, 0, 0, 0, + 0, 0, 0, 0, 0, 144, 145, 146, 147, 0, + 0, 148, 149, 0, 0, 0, 0, 0, 216, 216, + 0, 0, 134, 135, 0, 0, 0, 52, 0, 0, + 216, 0, 0, 0, 0, 0, 136, 0, 0, 0, + 217, 217, 137, 0, 0, 132, 133, 0, 0, 138, + 0, 0, 217, 139, 0, 0, 0, 0, 0, 54, + 0, 0, 55, 18, 0, 0, 140, 141, 0, 0, + 142, 0, 143, 232, 0, 0, 0, 233, 0, 144, + 145, 146, 147, 0, 0, 148, 149, 134, 135, 0, + 0, 0, 52, 0, 0, 0, 0, 0, 0, 0, + 0, 136, 0, 0, 0, 0, 0, 137, 0, 0, + 132, 133, 0, 0, 138, 0, 0, 0, 139, 0, + 0, 0, 0, 0, 54, 0, 0, 55, 18, 0, + 0, 140, 141, 0, 0, 142, 0, 143, 445, 0, + 0, 0, 0, 0, 144, 145, 146, 147, 0, 0, + 148, 149, 134, 135, 0, 0, 0, 52, 0, 0, + 0, 132, 133, 0, 0, 0, 136, 0, 0, 0, + 0, 0, 137, 0, 0, 0, 0, 0, 0, 138, + 0, 0, 0, 139, 0, 0, 0, 0, 0, 54, + 0, 0, 55, 18, 0, 0, 140, 141, 0, 0, + 142, 0, 143, 134, 135, 0, 0, 0, 52, 144, + 145, 146, 147, 0, 0, 148, 149, 136, 0, 0, + 0, 0, 0, 137, 0, 0, 132, 133, 0, 0, + 138, 0, 0, 0, 139, 0, 0, 0, 0, 0, + 54, 0, 0, 55, 18, 0, 0, 140, 141, 0, + 0, 142, 357, 0, 0, 0, 0, 0, 0, 0, + 144, 145, 146, 147, 0, 0, 148, 149, 134, 135, + 0, 0, 0, 52, 0, 0, 0, 132, 133, 0, + 0, 0, 136, 0, 0, 0, 0, 0, 137, 0, + 0, 0, 0, 0, 0, 138, 0, 0, 0, 139, + 0, 0, 0, 0, 0, 54, 0, 0, 55, 18, + 0, 0, 140, 141, 0, 0, 142, 0, 0, 134, + 135, 0, 395, 0, 52, 144, 145, 146, 147, 0, + 0, 148, 149, 136, 0, 0, 0, 0, 0, 137, + 0, 0, 132, 133, 0, 0, 138, 0, 0, 0, + 139, 0, 0, 0, 0, 0, 54, 0, 0, 55, + 18, 0, 0, 140, 141, 0, 0, 142, 0, 0, + 0, 0, 431, 0, 0, 0, 144, 145, 146, 147, + 0, 0, 148, 149, 134, 135, 0, 0, 0, 52, + 0, 0, 0, 132, 133, 0, 0, 0, 136, 0, + 0, 0, 0, 0, 137, 0, 0, 0, 0, 0, + 0, 138, 0, 0, 0, 139, 0, 0, 0, 0, + 0, 54, 0, 0, 55, 18, 0, 0, 140, 141, + 0, 0, 142, 439, 0, 134, 135, 0, 0, 0, + 52, 144, 145, 146, 147, 0, 0, 148, 149, 136, + 0, 0, 0, 0, 0, 137, 0, 0, 132, 133, + 0, 0, 138, 0, 0, 0, 139, 0, 0, 0, + 0, 0, 54, 0, 0, 55, 18, 0, 0, 140, + 141, 0, 0, 142, 452, 0, 0, 0, 0, 0, + 0, 0, 144, 145, 146, 147, 0, 0, 148, 149, + 134, 135, 0, 0, 0, 52, 0, 0, 0, 132, + 133, 0, 0, 0, 136, 0, 0, 0, 0, 0, + 137, 0, 0, 0, 0, 0, 0, 138, 0, 0, + 0, 139, 0, 0, 0, 0, 0, 54, 0, 0, + 55, 18, 0, 0, 140, 141, 0, 0, 142, 0, + 0, 134, 135, 114, 0, 0, 52, 144, 145, 146, + 147, 0, 0, 148, 149, 136, 0, 0, 0, 0, + 0, 137, 0, 0, 132, 133, 0, 0, 138, 0, + 0, 0, 139, 0, 0, 0, 0, 0, 54, 0, + 0, 55, 18, 0, 0, 140, 141, 0, 0, 142, + 0, 0, 0, 0, 0, 471, 0, 0, 144, 145, + 146, 147, 0, 0, 148, 149, 134, 135, 0, 0, + 0, 52, 0, 0, 0, 132, 133, 0, 0, 0, + 136, 0, 0, 0, 0, 0, 137, 0, 0, 0, + 0, 0, 0, 138, 0, 0, 0, 139, 0, 0, + 0, 0, 0, 54, 0, 0, 55, 18, 0, 0, + 140, 141, 0, 0, 142, 484, 0, 134, 135, 0, + 0, 0, 52, 144, 145, 146, 147, 0, 0, 148, + 149, 136, 0, 0, 0, 0, 0, 137, 0, 0, + 132, 133, 0, 0, 138, 0, 0, 0, 139, 0, + 0, 0, 0, 0, 54, 0, 0, 55, 18, 0, + 0, 140, 141, 0, 0, 142, 494, 0, 0, 0, + 0, 0, 0, 0, 144, 145, 146, 147, 0, 0, + 148, 149, 134, 135, 0, 0, 0, 52, 0, 0, + 0, 132, 133, 0, 0, 0, 136, 0, 0, 0, + 0, 0, 137, 0, 0, 0, 0, 0, 0, 138, + 0, 0, 0, 139, 0, 0, 0, 0, 0, 54, + 0, 0, 55, 18, 0, 0, 140, 141, 0, 0, + 142, 543, 0, 134, 135, 0, 0, 0, 52, 144, + 145, 146, 147, 0, 0, 148, 149, 136, 0, 0, + 0, 0, 0, 137, 0, 0, 132, 133, 0, 0, + 138, 0, 0, 0, 139, 0, 0, 0, 0, 0, + 54, 0, 0, 55, 18, 0, 0, 140, 141, 0, + 0, 142, 0, 0, 0, 0, 0, 566, 0, 0, + 144, 145, 146, 147, 0, 0, 148, 149, 134, 135, + 0, 0, 0, 52, 0, 0, 0, 132, 133, 0, + 0, 0, 136, 0, 0, 0, 0, 0, 137, 0, + 0, 0, 0, 0, 0, 138, 0, 0, 0, 139, + 0, 0, 0, 0, 0, 54, 0, 0, 55, 18, + 0, 0, 140, 141, 0, 0, 142, 580, 0, 134, + 135, 0, 0, 0, 52, 144, 145, 146, 147, 0, + 0, 148, 149, 136, 0, 0, 0, 0, 0, 137, + 0, 0, 0, 0, 0, 0, 138, 0, 0, 0, + 139, 0, 0, 0, 0, 0, 54, 0, 0, 55, + 18, 0, 0, 140, 141, 0, 0, 142, 0, 0, + 0, 0, 0, 0, 0, 0, 144, 145, 146, 147, + 0, 0, 148, 149, 269, 134, 135, 550, 270, 271, + 52, 272, 0, 0, 273, 0, 0, 0, 274, 136, + 0, 0, 551, 0, 0, 137, 275, 4, 276, 0, + 277, 278, 138, 279, 0, 0, 139, 0, 0, 0, + 0, 0, 54, 0, 0, 55, 18, 0, 0, 0, + 0, 0, 0, 280, 0, 192, 574, 0, 0, 282, + 0, 0, 144, 145, 146, 147, 0, 0, 148, 149, + 269, 134, 135, 550, 270, 271, 52, 272, 0, 0, + 273, 0, 0, 0, 274, 136, 0, 0, 551, 0, + 0, 137, 275, 4, 276, 0, 277, 278, 138, 279, + 0, 0, 139, 0, 0, 0, 0, 0, 54, 0, + 0, 55, 18, 0, 0, 0, 0, 0, 0, 280, + 0, 192, 587, 0, 0, 282, 0, 0, 144, 145, + 146, 147, 0, 0, 148, 149, 269, 134, 135, 0, + 270, 271, 52, 272, 0, 0, 273, 0, 0, 0, + 274, 136, 0, 0, 0, 0, 0, 137, 275, 4, + 276, 0, 277, 278, 138, 279, 0, 0, 139, 0, + 0, 0, 0, 0, 54, 0, 0, 55, 18, 0, + 0, 0, 0, 0, 0, 280, 0, 192, 281, 0, + 0, 282, 0, 0, 144, 145, 146, 147, 0, 0, + 148, 149, 269, 134, 135, 0, 270, 271, 52, 272, + 0, 0, 273, 0, 0, 0, 274, 136, 0, 0, + 0, 0, 0, 137, 275, 4, 276, 0, 277, 278, + 138, 279, 0, 0, 139, 0, 0, 0, 0, 0, + 54, 0, 0, 55, 18, 0, 0, 0, 0, 0, + 0, 280, 0, 192, 408, 0, 0, 282, 0, 0, + 144, 145, 146, 147, 0, 0, 148, 149, 269, 134, + 135, 0, 270, 271, 52, 272, 0, 0, 273, 0, + 0, 0, 274, 136, 0, 0, 0, 0, 0, 476, + 275, 4, 276, 0, 277, 278, 138, 279, 0, 0, + 477, 0, 0, 0, 0, 0, 54, 0, 0, 55, + 18, 0, 0, 0, 0, 0, 0, 280, 0, 192, + 478, 0, 0, 282, 0, 0, 144, 145, 146, 147, + 0, 0, 148, 149, 269, 134, 135, 0, 270, 271, + 52, 272, 0, 0, 273, 0, 0, 0, 274, 136, + 0, 0, 0, 0, 0, 137, 275, 4, 276, 0, + 277, 278, 138, 279, 0, 0, 139, 0, 0, 0, + 0, 0, 54, 0, 0, 55, 18, 0, 0, 0, + 0, 0, 0, 280, 0, 192, 514, 0, 0, 282, + 0, 0, 144, 145, 146, 147, 0, 0, 148, 149, + 269, 134, 135, 0, 270, 271, 52, 272, 0, 0, + 273, 0, 0, 0, 274, 136, 0, 0, 0, 0, + 0, 137, 275, 4, 276, 0, 277, 278, 138, 279, + 0, 0, 139, 0, 0, 0, 0, 0, 54, 0, + 0, 55, 18, 0, 0, 0, 0, 0, 0, 280, + 0, 192, 517, 0, 0, 282, 0, 0, 144, 145, + 146, 147, 0, 0, 148, 149, 269, 134, 135, 0, + 270, 271, 52, 272, 0, 0, 273, 0, 0, 0, + 274, 136, 0, 0, 0, 0, 0, 137, 275, 4, + 276, 0, 277, 278, 138, 279, 0, 0, 139, 0, + 0, 0, 0, 0, 54, 0, 0, 55, 18, 0, + 0, 0, 0, 0, 0, 280, 0, 192, 542, 0, + 0, 282, 0, 0, 144, 145, 146, 147, 0, 0, + 148, 149, 269, 134, 135, 0, 270, 271, 52, 272, + 0, 0, 273, 0, 0, 0, 274, 136, 0, 0, + 0, 0, 0, 137, 275, 4, 276, 0, 277, 278, + 138, 279, 0, 0, 139, 0, 0, 0, 0, 0, + 54, 0, 0, 55, 18, 0, 0, 0, 0, 0, + 0, 280, 0, 192, 0, 0, 0, 282, 0, 0, + 144, 145, 146, 147, 0, 0, 148, 149, 411, 134, + 135, 0, 270, 271, 52, 272, 0, 0, 273, 0, + 0, 0, 274, 136, 0, 0, 0, 0, 0, 137, + 275, 0, 276, 0, 277, 278, 138, 279, 0, 0, + 139, 0, 0, 0, 0, 0, 54, 0, 0, 55, + 18, 0, 0, 0, 0, 0, 0, 280, 0, 192, + 0, 0, 0, 282, 0, 0, 144, 145, 146, 147, + 0, 0, 148, 149, 411, 134, 135, 0, 522, 271, + 52, 272, 0, 0, 273, 0, 0, 0, 274, 136, + 0, 0, 0, 0, 0, 137, 275, 0, 276, 0, + 277, 278, 138, 279, 0, 0, 139, 0, 0, 0, + 0, 0, 54, 0, 0, 55, 18, 0, 0, 0, + 0, 0, 0, 280, 0, 192, 0, 0, 0, 282, + 0, 0, 144, 145, 146, 147, 0, 0, 148, 149 +}; + +static const short yycheck[] = { 3, + 4, 213, 309, 192, 143, 88, 1, 121, 352, 5, + 37, 37, 93, 290, 0, 15, 225, 123, 104, 38, + 229, 230, 8, 9, 10, 119, 45, 8, 32, 33, + 47, 35, 115, 86, 117, 119, 63, 53, 63, 43, + 26, 68, 68, 29, 30, 62, 119, 119, 29, 53, + 72, 37, 138, 57, 44, 555, 510, 63, 44, 78, + 2, 44, 346, 5, 86, 55, 132, 133, 134, 135, + 95, 61, 55, 573, 140, 141, 103, 67, 61, 96, + 94, 97, 68, 367, 67, 75, 100, 87, 92, 93, + 86, 47, 119, 119, 36, 37, 94, 124, 40, 443, + 95, 44, 100, 197, 108, 211, 62, 50, 202, 99, + 204, 138, 566, 197, 72, 142, 99, 103, 76, 123, + 499, 63, 195, 206, 197, 197, 68, 52, 214, 297, + 72, 585, 341, 119, 76, 344, 304, 50, 306, 82, + 96, 101, 85, 86, 93, 86, 430, 526, 97, 57, + 529, 94, 101, 526, 158, 99, 529, 8, 99, 10, + 118, 103, 104, 470, 471, 192, 450, 97, 195, 82, + 197, 197, 85, 86, 86, 37, 118, 119, 29, 245, + 246, 247, 124, 277, 92, 93, 213, 99, 192, 94, + 132, 133, 134, 135, 99, 100, 138, 44, 140, 141, + 142, 63, 283, 510, 583, 482, 68, 211, 9, 97, + 583, 197, 591, 101, 61, 594, 355, 596, 591, 223, + 67, 594, 95, 596, 99, 26, 99, 213, 44, 30, + 257, 109, 516, 97, 94, 239, 240, 101, 515, 428, + 100, 103, 44, 44, 327, 61, 98, 65, 50, 67, + 192, 67, 99, 195, 72, 197, 95, 119, 76, 566, + 287, 100, 124, 290, 142, 143, 97, 94, 86, 273, + 97, 213, 214, 94, 101, 279, 97, 561, 585, 283, + 82, 347, 309, 85, 86, 99, 290, 101, 36, 94, + 502, 480, 40, 297, 99, 100, 92, 100, 575, 326, + 304, 97, 306, 245, 246, 247, 248, 249, 250, 251, + 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, + 262, 263, 264, 309, 72, 439, 407, 67, 76, 192, + 96, 499, 72, 195, 100, 197, 76, 94, 452, 94, + 326, 93, 97, 100, 94, 287, 86, 499, 290, 94, + 100, 213, 98, 94, 341, 100, 104, 344, 526, 100, + 238, 529, 98, 241, 499, 94, 44, 309, 462, 537, + 118, 100, 50, 94, 526, 489, 442, 529, 546, 100, + 44, 60, 192, 497, 326, 64, 50, 265, 95, 416, + 138, 526, 560, 271, 529, 98, 274, 18, 19, 20, + 21, 428, 280, 407, 82, 347, 98, 85, 86, 100, + 352, 253, 254, 255, 256, 583, 94, 511, 82, 99, + 100, 85, 86, 591, 428, 287, 594, 290, 596, 101, + 99, 583, 101, 95, 297, 97, 57, 91, 92, 591, + 499, 304, 594, 306, 596, 343, 309, 345, 583, 5, + 6, 7, 101, 480, 101, 482, 591, 99, 100, 594, + 101, 596, 340, 557, 326, 97, 214, 526, 91, 92, + 529, 11, 350, 12, 416, 502, 480, 355, 482, 13, + 290, 45, 46, 91, 92, 93, 428, 297, 515, 97, + 8, 9, 10, 101, 304, 499, 306, 3, 4, 309, + 442, 443, 91, 92, 91, 92, 93, 16, 17, 513, + 97, 515, 454, 391, 101, 14, 502, 95, 192, 397, + 398, 93, 526, 53, 583, 529, 95, 405, 555, 45, + 46, 97, 591, 537, 67, 594, 97, 596, 480, 44, + 482, 93, 546, 421, 422, 50, 573, 94, 575, 45, + 46, 555, 248, 249, 416, 96, 560, 250, 251, 252, + 502, 44, 67, 258, 259, 428, 67, 50, 93, 573, + 448, 575, 93, 515, 93, 88, 59, 82, 61, 583, + 85, 86, 93, 93, 67, 0, 93, 591, 88, 93, + 594, 99, 596, 8, 9, 10, 99, 99, 95, 82, + 93, 192, 85, 86, 99, 99, 98, 470, 471, 98, + 98, 26, 93, 555, 29, 30, 290, 480, 428, 482, + 99, 99, 37, 297, 99, 192, 99, 94, 506, 44, + 304, 573, 306, 575, 100, 309, 499, 66, 100, 44, + 502, 99, 98, 97, 86, 50, 98, 510, 94, 91, + 92, 93, 515, 68, 59, 97, 61, 94, 94, 101, + 470, 471, 67, 526, 99, 93, 529, 545, 93, 99, + 480, 549, 482, 551, 537, 94, 93, 82, 192, 93, + 85, 86, 95, 546, 94, 93, 56, 56, 99, 499, + 95, 96, 555, 94, 94, 94, 93, 560, 88, 290, + 510, 99, 88, 566, 119, 515, 297, 99, 99, 94, + 573, 99, 575, 304, 94, 306, 526, 99, 309, 529, + 583, 99, 585, 290, 0, 56, 44, 537, 591, 94, + 297, 594, 50, 596, 0, 257, 546, 304, 10, 306, + 46, 59, 309, 61, 80, 555, 197, 108, 195, 67, + 560, 326, 425, 45, 428, 68, 566, 463, 309, 553, + 553, 192, 463, 573, 82, 575, 309, 85, 86, 260, + 225, 261, 454, 583, -1, 585, 290, 95, 96, 263, + 262, 591, 197, 297, 594, -1, 596, 264, 44, -1, + 304, -1, 306, -1, 50, 309, 470, 471, 268, -1, + -1, 44, -1, 59, -1, 61, 480, 50, 482, -1, + -1, 67, -1, -1, -1, -1, 59, -1, 61, -1, + -1, -1, -1, -1, 67, 499, 82, -1, -1, 85, + 86, -1, -1, -1, -1, -1, 510, 428, -1, 82, + 96, 515, 85, 86, -1, -1, -1, -1, -1, -1, + -1, -1, 526, 96, -1, 529, -1, -1, -1, 290, + 192, 428, -1, 537, -1, -1, 297, -1, -1, -1, + -1, -1, 546, 304, -1, 306, -1, -1, 309, 470, + 471, 555, -1, -1, -1, -1, 560, -1, -1, 480, + -1, 482, 566, -1, -1, -1, -1, -1, -1, 573, + -1, 575, -1, 470, 471, -1, -1, -1, 499, 583, + -1, 585, -1, 480, 428, 482, -1, 591, -1, 510, + 594, -1, 596, -1, 515, -1, -1, -1, -1, -1, + -1, -1, 499, -1, 86, 526, -1, -1, 529, 91, + 92, 93, -1, 510, -1, 97, 537, -1, 515, 101, + -1, -1, -1, -1, -1, 546, 470, 471, 290, 526, + -1, -1, 529, -1, 555, 297, 480, -1, 482, 560, + 537, -1, 304, -1, 306, 566, -1, 309, -1, 546, + -1, -1, 573, -1, 575, 499, -1, -1, 555, -1, + -1, -1, 583, 560, 585, -1, 510, 428, -1, 566, + 591, 515, -1, 594, -1, 596, 573, -1, 575, -1, + -1, -1, 526, -1, -1, 529, 583, -1, 585, -1, + -1, -1, -1, 537, 591, -1, -1, 594, -1, 596, + -1, -1, 546, -1, -1, -1, -1, -1, -1, 470, + 471, 555, -1, -1, -1, -1, 560, -1, -1, 480, + -1, 482, 566, -1, -1, -1, -1, -1, -1, 573, + -1, 575, -1, -1, -1, -1, -1, -1, 499, 583, + -1, 585, 44, 45, 46, -1, -1, 591, 50, 510, + 594, -1, 596, -1, 515, -1, -1, 59, -1, -1, + -1, -1, -1, 65, -1, 526, 428, -1, 529, -1, + 72, -1, -1, -1, 76, -1, 537, -1, -1, -1, + 82, -1, -1, 85, 86, 546, -1, -1, -1, -1, + -1, 93, -1, -1, 555, -1, -1, -1, -1, 560, + 102, 103, 104, 105, -1, 566, 108, 109, 470, 471, + -1, -1, 573, -1, 575, -1, -1, -1, 480, -1, + 482, -1, 583, -1, 585, -1, -1, -1, -1, -1, + 591, -1, -1, 594, -1, 596, -1, 499, 132, 133, + 134, 135, -1, -1, -1, -1, 140, 141, 510, -1, + -1, -1, -1, 515, -1, -1, -1, -1, -1, -1, + 132, 133, 134, 135, 526, -1, -1, 529, 140, 141, + -1, -1, -1, -1, -1, 537, -1, -1, -1, -1, + -1, -1, -1, -1, 546, 45, 46, -1, -1, -1, + 50, -1, -1, 555, -1, -1, -1, -1, 560, 59, + -1, -1, -1, -1, 566, 65, -1, -1, -1, -1, + -1, 573, 72, 575, -1, -1, 76, -1, -1, -1, + -1, 583, 82, 585, -1, 85, 86, -1, -1, 591, + -1, -1, 594, 93, 596, -1, -1, -1, -1, -1, + -1, -1, 102, 103, 104, 105, -1, -1, 108, 109, + -1, 245, 246, 247, 248, 249, 250, 251, 252, 253, + 254, 255, 256, -1, 258, 259, 260, 261, 262, 263, + 264, -1, -1, 245, 246, 247, 248, 249, 250, 251, + 252, 253, 254, 255, 256, -1, 258, 259, 260, 261, + 262, 263, 264, 1, -1, 3, 4, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 45, 46, -1, + -1, -1, 50, -1, -1, -1, -1, -1, -1, -1, + -1, 59, -1, 347, -1, -1, -1, 65, 352, -1, + -1, -1, -1, -1, 72, -1, -1, -1, 76, -1, + -1, -1, -1, -1, 82, 347, -1, 85, 86, -1, + 352, 89, 90, 50, -1, 93, -1, -1, -1, -1, + -1, -1, 59, -1, 102, 103, 104, 105, 65, -1, + 108, 109, -1, -1, -1, 72, -1, -1, -1, 76, + 3, 4, -1, -1, -1, 82, -1, -1, 85, 86, + -1, -1, 89, 90, -1, -1, 93, -1, -1, -1, + -1, -1, -1, -1, -1, 102, 103, 104, 105, -1, + -1, 108, 109, -1, -1, -1, -1, -1, 442, 443, + -1, -1, 45, 46, -1, -1, -1, 50, -1, -1, + 454, -1, -1, -1, -1, -1, 59, -1, -1, -1, + 442, 443, 65, -1, -1, 3, 4, -1, -1, 72, + -1, -1, 454, 76, -1, -1, -1, -1, -1, 82, + -1, -1, 85, 86, -1, -1, 89, 90, -1, -1, + 93, -1, 95, 96, -1, -1, -1, 100, -1, 102, + 103, 104, 105, -1, -1, 108, 109, 45, 46, -1, + -1, -1, 50, -1, -1, -1, -1, -1, -1, -1, + -1, 59, -1, -1, -1, -1, -1, 65, -1, -1, + 3, 4, -1, -1, 72, -1, -1, -1, 76, -1, + -1, -1, -1, -1, 82, -1, -1, 85, 86, -1, + -1, 89, 90, -1, -1, 93, -1, 95, 96, -1, + -1, -1, -1, -1, 102, 103, 104, 105, -1, -1, + 108, 109, 45, 46, -1, -1, -1, 50, -1, -1, + -1, 3, 4, -1, -1, -1, 59, -1, -1, -1, + -1, -1, 65, -1, -1, -1, -1, -1, -1, 72, + -1, -1, -1, 76, -1, -1, -1, -1, -1, 82, + -1, -1, 85, 86, -1, -1, 89, 90, -1, -1, + 93, -1, 95, 45, 46, -1, -1, -1, 50, 102, + 103, 104, 105, -1, -1, 108, 109, 59, -1, -1, + -1, -1, -1, 65, -1, -1, 3, 4, -1, -1, + 72, -1, -1, -1, 76, -1, -1, -1, -1, -1, + 82, -1, -1, 85, 86, -1, -1, 89, 90, -1, + -1, 93, 94, -1, -1, -1, -1, -1, -1, -1, + 102, 103, 104, 105, -1, -1, 108, 109, 45, 46, + -1, -1, -1, 50, -1, -1, -1, 3, 4, -1, + -1, -1, 59, -1, -1, -1, -1, -1, 65, -1, + -1, -1, -1, -1, -1, 72, -1, -1, -1, 76, + -1, -1, -1, -1, -1, 82, -1, -1, 85, 86, + -1, -1, 89, 90, -1, -1, 93, -1, -1, 45, + 46, -1, 99, -1, 50, 102, 103, 104, 105, -1, + -1, 108, 109, 59, -1, -1, -1, -1, -1, 65, + -1, -1, 3, 4, -1, -1, 72, -1, -1, -1, + 76, -1, -1, -1, -1, -1, 82, -1, -1, 85, + 86, -1, -1, 89, 90, -1, -1, 93, -1, -1, + -1, -1, 98, -1, -1, -1, 102, 103, 104, 105, + -1, -1, 108, 109, 45, 46, -1, -1, -1, 50, + -1, -1, -1, 3, 4, -1, -1, -1, 59, -1, + -1, -1, -1, -1, 65, -1, -1, -1, -1, -1, + -1, 72, -1, -1, -1, 76, -1, -1, -1, -1, + -1, 82, -1, -1, 85, 86, -1, -1, 89, 90, + -1, -1, 93, 94, -1, 45, 46, -1, -1, -1, + 50, 102, 103, 104, 105, -1, -1, 108, 109, 59, + -1, -1, -1, -1, -1, 65, -1, -1, 3, 4, + -1, -1, 72, -1, -1, -1, 76, -1, -1, -1, + -1, -1, 82, -1, -1, 85, 86, -1, -1, 89, + 90, -1, -1, 93, 94, -1, -1, -1, -1, -1, + -1, -1, 102, 103, 104, 105, -1, -1, 108, 109, + 45, 46, -1, -1, -1, 50, -1, -1, -1, 3, + 4, -1, -1, -1, 59, -1, -1, -1, -1, -1, + 65, -1, -1, -1, -1, -1, -1, 72, -1, -1, + -1, 76, -1, -1, -1, -1, -1, 82, -1, -1, + 85, 86, -1, -1, 89, 90, -1, -1, 93, -1, + -1, 45, 46, 98, -1, -1, 50, 102, 103, 104, + 105, -1, -1, 108, 109, 59, -1, -1, -1, -1, + -1, 65, -1, -1, 3, 4, -1, -1, 72, -1, + -1, -1, 76, -1, -1, -1, -1, -1, 82, -1, + -1, 85, 86, -1, -1, 89, 90, -1, -1, 93, + -1, -1, -1, -1, -1, 99, -1, -1, 102, 103, + 104, 105, -1, -1, 108, 109, 45, 46, -1, -1, + -1, 50, -1, -1, -1, 3, 4, -1, -1, -1, + 59, -1, -1, -1, -1, -1, 65, -1, -1, -1, + -1, -1, -1, 72, -1, -1, -1, 76, -1, -1, + -1, -1, -1, 82, -1, -1, 85, 86, -1, -1, + 89, 90, -1, -1, 93, 94, -1, 45, 46, -1, + -1, -1, 50, 102, 103, 104, 105, -1, -1, 108, + 109, 59, -1, -1, -1, -1, -1, 65, -1, -1, + 3, 4, -1, -1, 72, -1, -1, -1, 76, -1, + -1, -1, -1, -1, 82, -1, -1, 85, 86, -1, + -1, 89, 90, -1, -1, 93, 94, -1, -1, -1, + -1, -1, -1, -1, 102, 103, 104, 105, -1, -1, + 108, 109, 45, 46, -1, -1, -1, 50, -1, -1, + -1, 3, 4, -1, -1, -1, 59, -1, -1, -1, + -1, -1, 65, -1, -1, -1, -1, -1, -1, 72, + -1, -1, -1, 76, -1, -1, -1, -1, -1, 82, + -1, -1, 85, 86, -1, -1, 89, 90, -1, -1, + 93, 94, -1, 45, 46, -1, -1, -1, 50, 102, + 103, 104, 105, -1, -1, 108, 109, 59, -1, -1, + -1, -1, -1, 65, -1, -1, 3, 4, -1, -1, + 72, -1, -1, -1, 76, -1, -1, -1, -1, -1, + 82, -1, -1, 85, 86, -1, -1, 89, 90, -1, + -1, 93, -1, -1, -1, -1, -1, 99, -1, -1, + 102, 103, 104, 105, -1, -1, 108, 109, 45, 46, + -1, -1, -1, 50, -1, -1, -1, 3, 4, -1, + -1, -1, 59, -1, -1, -1, -1, -1, 65, -1, + -1, -1, -1, -1, -1, 72, -1, -1, -1, 76, + -1, -1, -1, -1, -1, 82, -1, -1, 85, 86, + -1, -1, 89, 90, -1, -1, 93, 94, -1, 45, + 46, -1, -1, -1, 50, 102, 103, 104, 105, -1, + -1, 108, 109, 59, -1, -1, -1, -1, -1, 65, + -1, -1, -1, -1, -1, -1, 72, -1, -1, -1, + 76, -1, -1, -1, -1, -1, 82, -1, -1, 85, + 86, -1, -1, 89, 90, -1, -1, 93, -1, -1, + -1, -1, -1, -1, -1, -1, 102, 103, 104, 105, + -1, -1, 108, 109, 44, 45, 46, 47, 48, 49, + 50, 51, -1, -1, 54, -1, -1, -1, 58, 59, + -1, -1, 62, -1, -1, 65, 66, 67, 68, -1, + 70, 71, 72, 73, -1, -1, 76, -1, -1, -1, + -1, -1, 82, -1, -1, 85, 86, -1, -1, -1, + -1, -1, -1, 93, -1, 95, 96, -1, -1, 99, + -1, -1, 102, 103, 104, 105, -1, -1, 108, 109, + 44, 45, 46, 47, 48, 49, 50, 51, -1, -1, + 54, -1, -1, -1, 58, 59, -1, -1, 62, -1, + -1, 65, 66, 67, 68, -1, 70, 71, 72, 73, + -1, -1, 76, -1, -1, -1, -1, -1, 82, -1, + -1, 85, 86, -1, -1, -1, -1, -1, -1, 93, + -1, 95, 96, -1, -1, 99, -1, -1, 102, 103, + 104, 105, -1, -1, 108, 109, 44, 45, 46, -1, + 48, 49, 50, 51, -1, -1, 54, -1, -1, -1, + 58, 59, -1, -1, -1, -1, -1, 65, 66, 67, + 68, -1, 70, 71, 72, 73, -1, -1, 76, -1, + -1, -1, -1, -1, 82, -1, -1, 85, 86, -1, + -1, -1, -1, -1, -1, 93, -1, 95, 96, -1, + -1, 99, -1, -1, 102, 103, 104, 105, -1, -1, + 108, 109, 44, 45, 46, -1, 48, 49, 50, 51, + -1, -1, 54, -1, -1, -1, 58, 59, -1, -1, + -1, -1, -1, 65, 66, 67, 68, -1, 70, 71, + 72, 73, -1, -1, 76, -1, -1, -1, -1, -1, + 82, -1, -1, 85, 86, -1, -1, -1, -1, -1, + -1, 93, -1, 95, 96, -1, -1, 99, -1, -1, + 102, 103, 104, 105, -1, -1, 108, 109, 44, 45, + 46, -1, 48, 49, 50, 51, -1, -1, 54, -1, + -1, -1, 58, 59, -1, -1, -1, -1, -1, 65, + 66, 67, 68, -1, 70, 71, 72, 73, -1, -1, + 76, -1, -1, -1, -1, -1, 82, -1, -1, 85, + 86, -1, -1, -1, -1, -1, -1, 93, -1, 95, + 96, -1, -1, 99, -1, -1, 102, 103, 104, 105, + -1, -1, 108, 109, 44, 45, 46, -1, 48, 49, + 50, 51, -1, -1, 54, -1, -1, -1, 58, 59, + -1, -1, -1, -1, -1, 65, 66, 67, 68, -1, + 70, 71, 72, 73, -1, -1, 76, -1, -1, -1, + -1, -1, 82, -1, -1, 85, 86, -1, -1, -1, + -1, -1, -1, 93, -1, 95, 96, -1, -1, 99, + -1, -1, 102, 103, 104, 105, -1, -1, 108, 109, + 44, 45, 46, -1, 48, 49, 50, 51, -1, -1, + 54, -1, -1, -1, 58, 59, -1, -1, -1, -1, + -1, 65, 66, 67, 68, -1, 70, 71, 72, 73, + -1, -1, 76, -1, -1, -1, -1, -1, 82, -1, + -1, 85, 86, -1, -1, -1, -1, -1, -1, 93, + -1, 95, 96, -1, -1, 99, -1, -1, 102, 103, + 104, 105, -1, -1, 108, 109, 44, 45, 46, -1, + 48, 49, 50, 51, -1, -1, 54, -1, -1, -1, + 58, 59, -1, -1, -1, -1, -1, 65, 66, 67, + 68, -1, 70, 71, 72, 73, -1, -1, 76, -1, + -1, -1, -1, -1, 82, -1, -1, 85, 86, -1, + -1, -1, -1, -1, -1, 93, -1, 95, 96, -1, + -1, 99, -1, -1, 102, 103, 104, 105, -1, -1, + 108, 109, 44, 45, 46, -1, 48, 49, 50, 51, + -1, -1, 54, -1, -1, -1, 58, 59, -1, -1, + -1, -1, -1, 65, 66, 67, 68, -1, 70, 71, + 72, 73, -1, -1, 76, -1, -1, -1, -1, -1, + 82, -1, -1, 85, 86, -1, -1, -1, -1, -1, + -1, 93, -1, 95, -1, -1, -1, 99, -1, -1, + 102, 103, 104, 105, -1, -1, 108, 109, 44, 45, + 46, -1, 48, 49, 50, 51, -1, -1, 54, -1, + -1, -1, 58, 59, -1, -1, -1, -1, -1, 65, + 66, -1, 68, -1, 70, 71, 72, 73, -1, -1, + 76, -1, -1, -1, -1, -1, 82, -1, -1, 85, + 86, -1, -1, -1, -1, -1, -1, 93, -1, 95, + -1, -1, -1, 99, -1, -1, 102, 103, 104, 105, + -1, -1, 108, 109, 44, 45, 46, -1, 48, 49, + 50, 51, -1, -1, 54, -1, -1, -1, 58, 59, + -1, -1, -1, -1, -1, 65, 66, -1, 68, -1, + 70, 71, 72, 73, -1, -1, 76, -1, -1, -1, + -1, -1, 82, -1, -1, 85, 86, -1, -1, -1, + -1, -1, -1, 93, -1, 95, -1, -1, -1, 99, + -1, -1, 102, 103, 104, 105, -1, -1, 108, 109 +}; +#define YYPURE 1 + +/* -*-C-*- Note some compilers choke on comments on `#line' lines. */ +#line 3 "/usr/local/gnu/share/bison.simple" + +/* Skeleton output parser for bison, + Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + 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, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ + +/* As a special exception, when this file is copied by Bison into a + Bison output file, you may use that output file without restriction. + This special exception was added by the Free Software Foundation + in version 1.24 of Bison. */ + +#ifndef alloca +#ifdef __GNUC__ +#define alloca __builtin_alloca +#else /* not GNU C. */ +#if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi) +#include <alloca.h> +#else /* not sparc */ +#if defined (MSDOS) && !defined (__TURBOC__) +#include <malloc.h> +#else /* not MSDOS, or __TURBOC__ */ +#if defined(_AIX) +#include <malloc.h> + #pragma alloca +#else /* not MSDOS, __TURBOC__, or _AIX */ +#ifdef __hpux +#ifdef __cplusplus +extern "C" { +void *alloca (unsigned int); +}; +#else /* not __cplusplus */ +void *alloca (); +#endif /* not __cplusplus */ +#endif /* __hpux */ +#endif /* not _AIX */ +#endif /* not MSDOS, or __TURBOC__ */ +#endif /* not sparc. */ +#endif /* not GNU C. */ +#endif /* alloca not defined. */ + +/* This is the parser code that is written into each bison parser + when the %semantic_parser declaration is not specified in the grammar. + It was written by Richard Stallman by simplifying the hairy parser + used when %semantic_parser is specified. */ + +/* Note: there must be only one dollar sign in this file. + It is replaced by the list of actions, each action + as one case of the switch. */ + +#define yyerrok (yyerrstatus = 0) +#define yyclearin (yychar = YYEMPTY) +#define YYEMPTY -2 +#define YYEOF 0 +#define YYACCEPT return(0) +#define YYABORT return(1) +#define YYERROR goto yyerrlab1 +/* Like YYERROR except do call yyerror. + This remains here temporarily to ease the + transition to the new meaning of YYERROR, for GCC. + Once GCC version 2 has supplanted version 1, this can go. */ +#define YYFAIL goto yyerrlab +#define YYRECOVERING() (!!yyerrstatus) +#define YYBACKUP(token, value) \ +do \ + if (yychar == YYEMPTY && yylen == 1) \ + { yychar = (token), yylval = (value); \ + yychar1 = YYTRANSLATE (yychar); \ + YYPOPSTACK; \ + goto yybackup; \ + } \ + else \ + { yyerror ("syntax error: cannot back up"); YYERROR; } \ +while (0) + +#define YYTERROR 1 +#define YYERRCODE 256 + +#ifndef YYPURE +#define YYLEX yylex() +#endif + +#ifdef YYPURE +#ifdef YYLSP_NEEDED +#ifdef YYLEX_PARAM +#define YYLEX yylex(&yylval, &yylloc, YYLEX_PARAM) +#else +#define YYLEX yylex(&yylval, &yylloc) +#endif +#else /* not YYLSP_NEEDED */ +#ifdef YYLEX_PARAM +#define YYLEX yylex(&yylval, YYLEX_PARAM) +#else +#define YYLEX yylex(&yylval) +#endif +#endif /* not YYLSP_NEEDED */ +#endif + +/* If nonreentrant, generate the variables here */ + +#ifndef YYPURE + +int yychar; /* the lookahead symbol */ +YYSTYPE yylval; /* the semantic value of the */ + /* lookahead symbol */ + +#ifdef YYLSP_NEEDED +YYLTYPE yylloc; /* location data for the lookahead */ + /* symbol */ +#endif + +int yynerrs; /* number of parse errors so far */ +#endif /* not YYPURE */ + +#if YYDEBUG != 0 +int yydebug; /* nonzero means print parse trace */ +/* Since this is uninitialized, it does not stop multiple parsers + from coexisting. */ +#endif + +/* YYINITDEPTH indicates the initial size of the parser's stacks */ + +#ifndef YYINITDEPTH +#define YYINITDEPTH 200 +#endif + +/* YYMAXDEPTH is the maximum size the stacks can grow to + (effective only if the built-in stack extension method is used). */ + +#if YYMAXDEPTH == 0 +#undef YYMAXDEPTH +#endif + +#ifndef YYMAXDEPTH +#define YYMAXDEPTH 10000 +#endif + +/* Prevent warning if -Wstrict-prototypes. */ +#ifdef __GNUC__ +int yyparse (void); +#endif + +#if __GNUC__ > 1 /* GNU C and GNU C++ define this. */ +#define __yy_memcpy(TO,FROM,COUNT) __builtin_memcpy(TO,FROM,COUNT) +#else /* not GNU C or C++ */ +#ifndef __cplusplus + +/* This is the most reliable way to avoid incompatibilities + in available built-in functions on various systems. */ +static void +__yy_memcpy (to, from, count) + char *to; + char *from; + int count; +{ + register char *f = from; + register char *t = to; + register int i = count; + + while (i-- > 0) + *t++ = *f++; +} + +#else /* __cplusplus */ + +/* This is the most reliable way to avoid incompatibilities + in available built-in functions on various systems. */ +static void +__yy_memcpy (char *to, char *from, int count) +{ + register char *f = from; + register char *t = to; + register int i = count; + + while (i-- > 0) + *t++ = *f++; +} + +#endif +#endif + +#line 196 "/usr/local/gnu/share/bison.simple" + +/* The user can define YYPARSE_PARAM as the name of an argument to be passed + into yyparse. The argument should have type void *. + It should actually point to an object. + Grammar actions can access the variable by casting it + to the proper pointer type. */ + +#ifdef YYPARSE_PARAM +#ifdef __cplusplus +#define YYPARSE_PARAM_ARG void *YYPARSE_PARAM +#define YYPARSE_PARAM_DECL +#else /* not __cplusplus */ +#define YYPARSE_PARAM_ARG YYPARSE_PARAM +#define YYPARSE_PARAM_DECL void *YYPARSE_PARAM; +#endif /* not __cplusplus */ +#else /* not YYPARSE_PARAM */ +#define YYPARSE_PARAM_ARG +#define YYPARSE_PARAM_DECL +#endif /* not YYPARSE_PARAM */ + +int +yyparse(YYPARSE_PARAM_ARG) + YYPARSE_PARAM_DECL +{ + register int yystate; + register int yyn; + register short *yyssp; + register YYSTYPE *yyvsp; + int yyerrstatus; /* number of tokens to shift before error messages enabled */ + int yychar1 = 0; /* lookahead token as an internal (translated) token number */ + + short yyssa[YYINITDEPTH]; /* the state stack */ + YYSTYPE yyvsa[YYINITDEPTH]; /* the semantic value stack */ + + short *yyss = yyssa; /* refer to the stacks thru separate pointers */ + YYSTYPE *yyvs = yyvsa; /* to allow yyoverflow to reallocate them elsewhere */ + +#ifdef YYLSP_NEEDED + YYLTYPE yylsa[YYINITDEPTH]; /* the location stack */ + YYLTYPE *yyls = yylsa; + YYLTYPE *yylsp; + +#define YYPOPSTACK (yyvsp--, yyssp--, yylsp--) +#else +#define YYPOPSTACK (yyvsp--, yyssp--) +#endif + + int yystacksize = YYINITDEPTH; + +#ifdef YYPURE + int yychar; + YYSTYPE yylval; + int yynerrs; +#ifdef YYLSP_NEEDED + YYLTYPE yylloc; +#endif +#endif + + YYSTYPE yyval; /* the variable used to return */ + /* semantic values from the action */ + /* routines */ + + int yylen; + +#if YYDEBUG != 0 + if (yydebug) + fprintf(stderr, "Starting parse\n"); +#endif + + yystate = 0; + yyerrstatus = 0; + yynerrs = 0; + yychar = YYEMPTY; /* Cause a token to be read. */ + + /* Initialize stack pointers. + Waste one element of value and location stack + so that they stay on the same level as the state stack. + The wasted elements are never initialized. */ + + yyssp = yyss - 1; + yyvsp = yyvs; +#ifdef YYLSP_NEEDED + yylsp = yyls; +#endif + +/* Push a new state, which is found in yystate . */ +/* In all cases, when you get here, the value and location stacks + have just been pushed. so pushing a state here evens the stacks. */ +yynewstate: + + *++yyssp = yystate; + + if (yyssp >= yyss + yystacksize - 1) + { + /* Give user a chance to reallocate the stack */ + /* Use copies of these so that the &'s don't force the real ones into memory. */ + YYSTYPE *yyvs1 = yyvs; + short *yyss1 = yyss; +#ifdef YYLSP_NEEDED + YYLTYPE *yyls1 = yyls; +#endif + + /* Get the current used size of the three stacks, in elements. */ + int size = yyssp - yyss + 1; + +#ifdef yyoverflow + /* Each stack pointer address is followed by the size of + the data in use in that stack, in bytes. */ +#ifdef YYLSP_NEEDED + /* This used to be a conditional around just the two extra args, + but that might be undefined if yyoverflow is a macro. */ + yyoverflow("parser stack overflow", + &yyss1, size * sizeof (*yyssp), + &yyvs1, size * sizeof (*yyvsp), + &yyls1, size * sizeof (*yylsp), + &yystacksize); +#else + yyoverflow("parser stack overflow", + &yyss1, size * sizeof (*yyssp), + &yyvs1, size * sizeof (*yyvsp), + &yystacksize); +#endif + + yyss = yyss1; yyvs = yyvs1; +#ifdef YYLSP_NEEDED + yyls = yyls1; +#endif +#else /* no yyoverflow */ + /* Extend the stack our own way. */ + if (yystacksize >= YYMAXDEPTH) + { + yyerror("parser stack overflow"); + return 2; + } + yystacksize *= 2; + if (yystacksize > YYMAXDEPTH) + yystacksize = YYMAXDEPTH; + yyss = (short *) alloca (yystacksize * sizeof (*yyssp)); + __yy_memcpy ((char *)yyss, (char *)yyss1, size * sizeof (*yyssp)); + yyvs = (YYSTYPE *) alloca (yystacksize * sizeof (*yyvsp)); + __yy_memcpy ((char *)yyvs, (char *)yyvs1, size * sizeof (*yyvsp)); +#ifdef YYLSP_NEEDED + yyls = (YYLTYPE *) alloca (yystacksize * sizeof (*yylsp)); + __yy_memcpy ((char *)yyls, (char *)yyls1, size * sizeof (*yylsp)); +#endif +#endif /* no yyoverflow */ + + yyssp = yyss + size - 1; + yyvsp = yyvs + size - 1; +#ifdef YYLSP_NEEDED + yylsp = yyls + size - 1; +#endif + +#if YYDEBUG != 0 + if (yydebug) + fprintf(stderr, "Stack size increased to %d\n", yystacksize); +#endif + + if (yyssp >= yyss + yystacksize - 1) + YYABORT; + } + +#if YYDEBUG != 0 + if (yydebug) + fprintf(stderr, "Entering state %d\n", yystate); +#endif + + goto yybackup; + yybackup: + +/* Do appropriate processing given the current state. */ +/* Read a lookahead token if we need one and don't already have one. */ +/* yyresume: */ + + /* First try to decide what to do without reference to lookahead token. */ + + yyn = yypact[yystate]; + if (yyn == YYFLAG) + goto yydefault; + + /* Not known => get a lookahead token if don't already have one. */ + + /* yychar is either YYEMPTY or YYEOF + or a valid token in external form. */ + + if (yychar == YYEMPTY) + { +#if YYDEBUG != 0 + if (yydebug) + fprintf(stderr, "Reading a token: "); +#endif + yychar = YYLEX; + } + + /* Convert token to internal form (in yychar1) for indexing tables with */ + + if (yychar <= 0) /* This means end of input. */ + { + yychar1 = 0; + yychar = YYEOF; /* Don't call YYLEX any more */ + +#if YYDEBUG != 0 + if (yydebug) + fprintf(stderr, "Now at end of input.\n"); +#endif + } + else + { + yychar1 = YYTRANSLATE(yychar); + +#if YYDEBUG != 0 + if (yydebug) + { + fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]); + /* Give the individual parser a way to print the precise meaning + of a token, for further debugging info. */ +#ifdef YYPRINT + YYPRINT (stderr, yychar, yylval); +#endif + fprintf (stderr, ")\n"); + } +#endif + } + + yyn += yychar1; + if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1) + goto yydefault; + + yyn = yytable[yyn]; + + /* yyn is what to do for this token type in this state. + Negative => reduce, -yyn is rule number. + Positive => shift, yyn is new state. + New state is final state => don't bother to shift, + just return success. + 0, or most negative number => error. */ + + if (yyn < 0) + { + if (yyn == YYFLAG) + goto yyerrlab; + yyn = -yyn; + goto yyreduce; + } + else if (yyn == 0) + goto yyerrlab; + + if (yyn == YYFINAL) + YYACCEPT; + + /* Shift the lookahead token. */ + +#if YYDEBUG != 0 + if (yydebug) + fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]); +#endif + + /* Discard the token being shifted unless it is eof. */ + if (yychar != YYEOF) + yychar = YYEMPTY; + + *++yyvsp = yylval; +#ifdef YYLSP_NEEDED + *++yylsp = yylloc; +#endif + + /* count tokens shifted since error; after three, turn off error status. */ + if (yyerrstatus) yyerrstatus--; + + yystate = yyn; + goto yynewstate; + +/* Do the default action for the current state. */ +yydefault: + + yyn = yydefact[yystate]; + if (yyn == 0) + goto yyerrlab; + +/* Do a reduction. yyn is the number of a rule to reduce with. */ +yyreduce: + yylen = yyr2[yyn]; + if (yylen > 0) + yyval = yyvsp[1-yylen]; /* implement default value of the action */ + +#if YYDEBUG != 0 + if (yydebug) + { + int i; + + fprintf (stderr, "Reducing via rule %d (line %d), ", + yyn, yyrline[yyn]); + + /* Print the symbols being reduced, and their result. */ + for (i = yyprhs[yyn]; yyrhs[i] > 0; i++) + fprintf (stderr, "%s ", yytname[yyrhs[i]]); + fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]); + } +#endif + + + switch (yyn) { + +case 10: +#line 193 "./parse-scan.y" +{ + /* use preset global here. FIXME */ + yyval.node = xstrdup ("int"); + ; + break;} +case 11: +#line 198 "./parse-scan.y" +{ + /* use preset global here. FIXME */ + yyval.node = xstrdup ("double"); + ; + break;} +case 12: +#line 203 "./parse-scan.y" +{ + /* use preset global here. FIXME */ + yyval.node = xstrdup ("boolean"); + ; + break;} +case 19: +#line 229 "./parse-scan.y" +{ + char *n = xmalloc (strlen (yyvsp[-2].node)+2); + n [0] = '['; + strcpy (n+1, yyvsp[-2].node); + yyval.node = n; + ; + break;} +case 20: +#line 236 "./parse-scan.y" +{ + char *n = xmalloc (strlen (yyvsp[-2].node)+2); + n [0] = '['; + strcpy (n+1, yyvsp[-2].node); + yyval.node = n; + ; + break;} +case 24: +#line 256 "./parse-scan.y" +{ + char *n = xmalloc (strlen (yyvsp[-2].node)+strlen (yyvsp[0].node)+2); + sprintf (n, "%s.%s", yyvsp[-2].node, yyvsp[0].node); + yyval.node = n; + ; + break;} +case 38: +#line 290 "./parse-scan.y" +{ package_name = yyvsp[-1].node; ; + break;} +case 46: +#line 317 "./parse-scan.y" +{ + if (yyvsp[0].value == PUBLIC_TK) + modifier_value++; + if (yyvsp[0].value == STATIC_TK) + modifier_value++; + USE_ABSORBER; + ; + break;} +case 47: +#line 325 "./parse-scan.y" +{ + if (yyvsp[0].value == PUBLIC_TK) + modifier_value++; + if (yyvsp[0].value == STATIC_TK) + modifier_value++; + USE_ABSORBER; + ; + break;} +case 48: +#line 337 "./parse-scan.y" +{ + report_class_declaration(yyvsp[-2].node); + modifier_value = 0; + ; + break;} +case 50: +#line 343 "./parse-scan.y" +{ report_class_declaration(yyvsp[-2].node); ; + break;} +case 56: +#line 357 "./parse-scan.y" +{ USE_ABSORBER; ; + break;} +case 57: +#line 359 "./parse-scan.y" +{ USE_ABSORBER; ; + break;} +case 70: +#line 389 "./parse-scan.y" +{ USE_ABSORBER; ; + break;} +case 71: +#line 391 "./parse-scan.y" +{ modifier_value = 0; ; + break;} +case 76: +#line 407 "./parse-scan.y" +{ bracket_count = 0; USE_ABSORBER; ; + break;} +case 77: +#line 409 "./parse-scan.y" +{ ++bracket_count; ; + break;} +case 81: +#line 424 "./parse-scan.y" +{ USE_ABSORBER; ; + break;} +case 83: +#line 427 "./parse-scan.y" +{ modifier_value = 0; ; + break;} +case 84: +#line 429 "./parse-scan.y" +{ + report_main_declaration (yyvsp[-1].declarator); + modifier_value = 0; + ; + break;} +case 85: +#line 437 "./parse-scan.y" +{ + struct method_declarator *d; + NEW_METHOD_DECLARATOR (d, yyvsp[-2].node, NULL); + yyval.declarator = d; + ; + break;} +case 86: +#line 443 "./parse-scan.y" +{ + struct method_declarator *d; + NEW_METHOD_DECLARATOR (d, yyvsp[-3].node, yyvsp[-1].node); + yyval.declarator = d; + ; + break;} +case 89: +#line 454 "./parse-scan.y" +{ + char *n = xmalloc (strlen (yyvsp[-2].node)+strlen(yyvsp[0].node)+2); + sprintf (n, "%s,%s", yyvsp[-2].node, yyvsp[0].node); + yyval.node = n; + ; + break;} +case 90: +#line 463 "./parse-scan.y" +{ + USE_ABSORBER; + if (bracket_count) + { + int i; + char *n = xmalloc (bracket_count + 1 + strlen (yyval.node)); + for (i = 0; i < bracket_count; ++i) + n[i] = '['; + strcpy (n + bracket_count, yyval.node); + yyval.node = n; + } + else + yyval.node = yyvsp[-1].node; + ; + break;} +case 91: +#line 478 "./parse-scan.y" +{ + if (bracket_count) + { + int i; + char *n = xmalloc (bracket_count + 1 + strlen (yyval.node)); + for (i = 0; i < bracket_count; ++i) + n[i] = '['; + strcpy (n + bracket_count, yyval.node); + yyval.node = n; + } + else + yyval.node = yyvsp[-1].node; + ; + break;} +case 94: +#line 499 "./parse-scan.y" +{ USE_ABSORBER; ; + break;} +case 95: +#line 501 "./parse-scan.y" +{ USE_ABSORBER; ; + break;} +case 101: +#line 518 "./parse-scan.y" +{ USE_ABSORBER; ; + break;} +case 103: +#line 529 "./parse-scan.y" +{ modifier_value = 0; ; + break;} +case 105: +#line 534 "./parse-scan.y" +{ modifier_value = 0; ; + break;} +case 106: +#line 541 "./parse-scan.y" +{ USE_ABSORBER; ; + break;} +case 107: +#line 543 "./parse-scan.y" +{ USE_ABSORBER; ; + break;} +case 114: +#line 560 "./parse-scan.y" +{ USE_ABSORBER; ; + break;} +case 115: +#line 562 "./parse-scan.y" +{ USE_ABSORBER; ; + break;} +case 119: +#line 575 "./parse-scan.y" +{ modifier_value = 0; ; + break;} +case 121: +#line 578 "./parse-scan.y" +{ modifier_value = 0; ; + break;} +case 148: +#line 647 "./parse-scan.y" +{ USE_ABSORBER; ; + break;} +case 149: +#line 649 "./parse-scan.y" +{ modifier_value = 0; ; + break;} +case 173: +#line 689 "./parse-scan.y" +{ USE_ABSORBER; ; + break;} +case 226: +#line 836 "./parse-scan.y" +{ USE_ABSORBER; ; + break;} +case 243: +#line 876 "./parse-scan.y" +{ USE_ABSORBER; ; + break;} +case 244: +#line 878 "./parse-scan.y" +{ USE_ABSORBER; ; + break;} +case 246: +#line 884 "./parse-scan.y" +{ USE_ABSORBER; ; + break;} +case 255: +#line 906 "./parse-scan.y" +{ USE_ABSORBER; ; + break;} +case 273: +#line 948 "./parse-scan.y" +{ USE_ABSORBER; ; + break;} +case 274: +#line 950 "./parse-scan.y" +{ USE_ABSORBER; ; + break;} +case 279: +#line 959 "./parse-scan.y" +{ USE_ABSORBER; ; + break;} +case 282: +#line 966 "./parse-scan.y" +{ USE_ABSORBER; ; + break;} +case 337: +#line 1085 "./parse-scan.y" +{ USE_ABSORBER; ; + break;} +} + /* the action file gets copied in in place of this dollarsign */ +#line 498 "/usr/local/gnu/share/bison.simple" + + yyvsp -= yylen; + yyssp -= yylen; +#ifdef YYLSP_NEEDED + yylsp -= yylen; +#endif + +#if YYDEBUG != 0 + if (yydebug) + { + short *ssp1 = yyss - 1; + fprintf (stderr, "state stack now"); + while (ssp1 != yyssp) + fprintf (stderr, " %d", *++ssp1); + fprintf (stderr, "\n"); + } +#endif + + *++yyvsp = yyval; + +#ifdef YYLSP_NEEDED + yylsp++; + if (yylen == 0) + { + yylsp->first_line = yylloc.first_line; + yylsp->first_column = yylloc.first_column; + yylsp->last_line = (yylsp-1)->last_line; + yylsp->last_column = (yylsp-1)->last_column; + yylsp->text = 0; + } + else + { + yylsp->last_line = (yylsp+yylen-1)->last_line; + yylsp->last_column = (yylsp+yylen-1)->last_column; + } +#endif + + /* Now "shift" the result of the reduction. + Determine what state that goes to, + based on the state we popped back to + and the rule number reduced by. */ + + yyn = yyr1[yyn]; + + yystate = yypgoto[yyn - YYNTBASE] + *yyssp; + if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp) + yystate = yytable[yystate]; + else + yystate = yydefgoto[yyn - YYNTBASE]; + + goto yynewstate; + +yyerrlab: /* here on detecting error */ + + if (! yyerrstatus) + /* If not already recovering from an error, report this error. */ + { + ++yynerrs; + +#ifdef YYERROR_VERBOSE + yyn = yypact[yystate]; + + if (yyn > YYFLAG && yyn < YYLAST) + { + int size = 0; + char *msg; + int x, count; + + count = 0; + /* Start X at -yyn if nec to avoid negative indexes in yycheck. */ + for (x = (yyn < 0 ? -yyn : 0); + x < (sizeof(yytname) / sizeof(char *)); x++) + if (yycheck[x + yyn] == x) + size += strlen(yytname[x]) + 15, count++; + msg = (char *) malloc(size + 15); + if (msg != 0) + { + strcpy(msg, "parse error"); + + if (count < 5) + { + count = 0; + for (x = (yyn < 0 ? -yyn : 0); + x < (sizeof(yytname) / sizeof(char *)); x++) + if (yycheck[x + yyn] == x) + { + strcat(msg, count == 0 ? ", expecting `" : " or `"); + strcat(msg, yytname[x]); + strcat(msg, "'"); + count++; + } + } + yyerror(msg); + free(msg); + } + else + yyerror ("parse error; also virtual memory exceeded"); + } + else +#endif /* YYERROR_VERBOSE */ + yyerror("parse error"); + } + + goto yyerrlab1; +yyerrlab1: /* here on error raised explicitly by an action */ + + if (yyerrstatus == 3) + { + /* if just tried and failed to reuse lookahead token after an error, discard it. */ + + /* return failure if at end of input */ + if (yychar == YYEOF) + YYABORT; + +#if YYDEBUG != 0 + if (yydebug) + fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]); +#endif + + yychar = YYEMPTY; + } + + /* Else will try to reuse lookahead token + after shifting the error token. */ + + yyerrstatus = 3; /* Each real token shifted decrements this */ + + goto yyerrhandle; + +yyerrdefault: /* current state does not do anything special for the error token. */ + +#if 0 + /* This is wrong; only states that explicitly want error tokens + should shift them. */ + yyn = yydefact[yystate]; /* If its default is to accept any token, ok. Otherwise pop it.*/ + if (yyn) goto yydefault; +#endif + +yyerrpop: /* pop the current state because it cannot handle the error token */ + + if (yyssp == yyss) YYABORT; + yyvsp--; + yystate = *--yyssp; +#ifdef YYLSP_NEEDED + yylsp--; +#endif + +#if YYDEBUG != 0 + if (yydebug) + { + short *ssp1 = yyss - 1; + fprintf (stderr, "Error: state stack now"); + while (ssp1 != yyssp) + fprintf (stderr, " %d", *++ssp1); + fprintf (stderr, "\n"); + } +#endif + +yyerrhandle: + + yyn = yypact[yystate]; + if (yyn == YYFLAG) + goto yyerrdefault; + + yyn += YYTERROR; + if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR) + goto yyerrdefault; + + yyn = yytable[yyn]; + if (yyn < 0) + { + if (yyn == YYFLAG) + goto yyerrpop; + yyn = -yyn; + goto yyreduce; + } + else if (yyn == 0) + goto yyerrpop; + + if (yyn == YYFINAL) + YYACCEPT; + +#if YYDEBUG != 0 + if (yydebug) + fprintf(stderr, "Shifting error token, "); +#endif + + *++yyvsp = yylval; +#ifdef YYLSP_NEEDED + *++yylsp = yylloc; +#endif + + yystate = yyn; + goto yynewstate; +} +#line 1103 "./parse-scan.y" + + +#include "lex.c" + +/* Create a new parser context */ + +void +java_push_parser_context () +{ + struct parser_ctxt *new = + (struct parser_ctxt *)xmalloc(sizeof (struct parser_ctxt)); + + bzero (new, sizeof (struct parser_ctxt)); + new->next = ctxp; + ctxp = new; +} + +/* Actions defined here */ + +static void +report_class_declaration (name) + char * name; +{ + extern int flag_dump_class, flag_list_filename; + + if (flag_dump_class) + { + if (!previous_output) + { + if (flag_list_filename) + fprintf (out, "%s: ", input_filename); + previous_output = 1; + } + + if (package_name) + fprintf (out, "%s.%s ", package_name, name); + else + fprintf (out, "%s ", name); + } + + current_class = name; +} + +static void +report_main_declaration (declarator) + struct method_declarator *declarator; +{ + extern int flag_find_main; + + if (flag_find_main + && modifier_value == 2 + && !strcmp (declarator->method_name, "main") + && declarator->args + && declarator->args [0] == '[' + && (! strcmp (declarator->args+1, "String") + || ! strcmp (declarator->args + 1, "java.lang.String")) + && current_class) + { + if (!previous_output) + { + if (package_name) + fprintf (out, "%s.%s ", package_name, current_class); + else + fprintf (out, current_class); + previous_output = 1; + } + } +} + +/* Reset global status used by the report functions. */ + +void reset_report () +{ + previous_output = 0; + current_class = package_name = NULL; +} + +void +yyerror (msg) + char *msg ATTRIBUTE_UNUSED; +{ +} + +char * +xstrdup (s) + const char *s; +{ + char *ret; + + ret = xmalloc (strlen (s) + 1); + strcpy (ret, s); + return ret; +} diff --git a/gcc/java/xref.c b/gcc/java/xref.c new file mode 100644 index 00000000000..906dfedbc58 --- /dev/null +++ b/gcc/java/xref.c @@ -0,0 +1,76 @@ +/* Write cross reference information extracted from Java(TM) + source and bytecode files, in one of formats documented below. + Copyright (C) 1999 Free Software Foundation, Inc. + Contributed by Alexandre Petit-Bianco (apbianco@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. + +Java and all Java-based marks are trademarks or registered trademarks +of Sun Microsystems, Inc. in the United States and other countries. +The Free Software Foundation is independent of Sun Microsystems, Inc. */ + +#include <stdio.h> +#include "config.h" +#include "system.h" +#include "tree.h" +#include "java-tree.h" +#include "xref.h" +#include "jcf.h" +#include "parse.h" +#include "obstack.h" + + +static xref_flag_table xref_table [] = { + {NULL, NULL, NULL}, +}; + +/* Decode an xref flag value. Return 0 if the flag wasn't found. */ + +int xref_flag_value (flag) + char *flag; +{ + int i; + for (i = 0; xref_table [i].key; i++) + if (!strcmp (flag, xref_table [i].key)) + return i+1; + return 0; +} + +/* Branch to the right xref "back-end". */ + +void +expand_xref (node) + tree node; +{ + /* Maintain these two cached. */ + static FILE *fp = NULL; + static void (*current_expand) PROTO ((FILE *, tree)) = NULL; + + if ( !flag_emit_xref ) + return; + + if (!fp) + fp = xref_table [flag_emit_xref-1].fp; + if (!current_expand) + current_expand = xref_table [flag_emit_xref-1].expand; + + (*current_expand) (fp, node); +} + +/* Implementation of the xref back-ends. */ + diff --git a/gcc/java/xref.h b/gcc/java/xref.h new file mode 100644 index 00000000000..6089d31255c --- /dev/null +++ b/gcc/java/xref.h @@ -0,0 +1,42 @@ +/* Definitions for the cross reference backend xref.c + Copyright (C) 1999 Free Software Foundation, Inc. + Contributed by Alexandre Petit-Bianco (apbianco@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. + +Java and all Java-based marks are trademarks or registered trademarks +of Sun Microsystems, Inc. in the United States and other countries. +The Free Software Foundation is independent of Sun Microsystems, Inc. */ + +/* Exported functions. */ +int xref_flag_value PROTO ((char *)); +void expand_xref PROTO ((tree)); + +/* flag_emit_xref range of possible values. */ + +enum { + XREF_NONE = 0, +}; + +/* Lookup table to be used with the value of flag_emit_xref */ + +typedef struct { + char *key; /* Activator in -fxref=<key> */ + void (*expand) PROTO ((FILE *, tree)); /* Function to write xrefs out */ + FILE *fp; /* fp to use during the call. */ +} xref_flag_table; diff --git a/gcc/lcm.c b/gcc/lcm.c new file mode 100644 index 00000000000..01367e36d5c --- /dev/null +++ b/gcc/lcm.c @@ -0,0 +1,799 @@ +/* Generic partial redundancy elimination with lazy code motion + support. + 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. */ + +/* These routines are meant to be used by various optimization + passes which can be modeled as lazy code motion problems. + Including, but not limited to: + + * Traditional partial redundancy elimination. + + * Placement of caller/caller register save/restores. + + * Load/store motion. + + * Copy motion. + + * Conversion of flat register files to a stacked register + model. + + * Dead load/store elimination. + + These routines accept as input: + + * Basic block information (number of blocks, lists of + predecessors and successors). Note the granularity + does not need to be basic block, they could be statements + or functions. + + * Bitmaps of local properties (computed, transparent and + anticipatable expressions). + + The output of these routines is bitmap of redundant computations + and a bitmap of optimal placement points. */ + + +#include "config.h" +#include "system.h" + +#include "rtl.h" +#include "regs.h" +#include "hard-reg-set.h" +#include "flags.h" +#include "real.h" +#include "insn-config.h" +#include "recog.h" +#include "basic-block.h" + +static void compute_antinout PROTO ((int, int_list_ptr *, sbitmap *, + sbitmap *, sbitmap *, sbitmap *)); +static void compute_earlyinout PROTO ((int, int, int_list_ptr *, sbitmap *, + sbitmap *, sbitmap *, sbitmap *)); +static void compute_delayinout PROTO ((int, int, int_list_ptr *, sbitmap *, + sbitmap *, sbitmap *, + sbitmap *, sbitmap *)); +static void compute_latein PROTO ((int, int, int_list_ptr *, sbitmap *, + sbitmap *, sbitmap *)); +static void compute_isoinout PROTO ((int, int_list_ptr *, sbitmap *, + sbitmap *, sbitmap *, sbitmap *)); +static void compute_optimal PROTO ((int, sbitmap *, + sbitmap *, sbitmap *)); +static void compute_redundant PROTO ((int, int, sbitmap *, + sbitmap *, sbitmap *, sbitmap *)); + +/* Similarly, but for the reversed flowgraph. */ +static void compute_avinout PROTO ((int, int_list_ptr *, sbitmap *, + sbitmap *, sbitmap *, sbitmap *)); +static void compute_fartherinout PROTO ((int, int, int_list_ptr *, + sbitmap *, sbitmap *, + sbitmap *, sbitmap *)); +static void compute_earlierinout PROTO ((int, int, int_list_ptr *, sbitmap *, + sbitmap *, sbitmap *, + sbitmap *, sbitmap *)); +static void compute_firstout PROTO ((int, int, int_list_ptr *, sbitmap *, + sbitmap *, sbitmap *)); +static void compute_rev_isoinout PROTO ((int, int_list_ptr *, sbitmap *, + sbitmap *, sbitmap *, sbitmap *)); + +/* Given local properties TRANSP, ANTLOC, return the redundant and optimal + computation points for expressions. + + To reduce overall memory consumption, we allocate memory immediately + before its needed and deallocate it as soon as possible. */ +void +pre_lcm (n_blocks, n_exprs, s_preds, s_succs, transp, + antloc, redundant, optimal) + int n_blocks; + int n_exprs; + int_list_ptr *s_preds; + int_list_ptr *s_succs; + sbitmap *transp; + sbitmap *antloc; + sbitmap *redundant; + sbitmap *optimal; +{ + sbitmap *antin, *antout, *earlyin, *earlyout, *delayin, *delayout; + sbitmap *latein, *isoin, *isoout; + + /* Compute global anticipatability. ANTOUT is not needed except to + compute ANTIN, so free its memory as soon as we return from + compute_antinout. */ + antin = sbitmap_vector_alloc (n_blocks, n_exprs); + antout = sbitmap_vector_alloc (n_blocks, n_exprs); + compute_antinout (n_blocks, s_succs, antloc, + transp, antin, antout); + free (antout); + antout = NULL; + + /* Compute earliestness. EARLYOUT is not needed except to compute + EARLYIN, so free its memory as soon as we return from + compute_earlyinout. */ + earlyin = sbitmap_vector_alloc (n_blocks, n_exprs); + earlyout = sbitmap_vector_alloc (n_blocks, n_exprs); + compute_earlyinout (n_blocks, n_exprs, s_preds, transp, antin, + earlyin, earlyout); + free (earlyout); + earlyout = NULL; + + /* Compute delayedness. DELAYOUT is not needed except to compute + DELAYIN, so free its memory as soon as we return from + compute_delayinout. We also no longer need ANTIN and EARLYIN. */ + delayin = sbitmap_vector_alloc (n_blocks, n_exprs); + delayout = sbitmap_vector_alloc (n_blocks, n_exprs); + compute_delayinout (n_blocks, n_exprs, s_preds, antloc, + antin, earlyin, delayin, delayout); + free (delayout); + delayout = NULL; + free (antin); + antin = NULL; + free (earlyin); + earlyin = NULL; + + /* Compute latestness. We no longer need DELAYIN after we compute + LATEIN. */ + latein = sbitmap_vector_alloc (n_blocks, n_exprs); + compute_latein (n_blocks, n_exprs, s_succs, antloc, delayin, latein); + free (delayin); + delayin = NULL; + + /* Compute isolatedness. ISOIN is not needed except to compute + ISOOUT, so free its memory as soon as we return from + compute_isoinout. */ + isoin = sbitmap_vector_alloc (n_blocks, n_exprs); + isoout = sbitmap_vector_alloc (n_blocks, n_exprs); + compute_isoinout (n_blocks, s_succs, antloc, latein, isoin, isoout); + free (isoin); + isoin = NULL; + + /* Now compute optimal placement points and the redundant expressions. */ + compute_optimal (n_blocks, latein, isoout, optimal); + compute_redundant (n_blocks, n_exprs, antloc, latein, isoout, redundant); + free (latein); + latein = NULL; + free (isoout); + isoout = NULL; +} + +/* Given local properties TRANSP, AVLOC, return the redundant and optimal + computation points for expressions on the reverse flowgraph. + + To reduce overall memory consumption, we allocate memory immediately + before its needed and deallocate it as soon as possible. */ + +void +pre_rev_lcm (n_blocks, n_exprs, s_preds, s_succs, transp, + avloc, redundant, optimal) + int n_blocks; + int n_exprs; + int_list_ptr *s_preds; + int_list_ptr *s_succs; + sbitmap *transp; + sbitmap *avloc; + sbitmap *redundant; + sbitmap *optimal; +{ + sbitmap *avin, *avout, *fartherin, *fartherout, *earlierin, *earlierout; + sbitmap *firstout, *rev_isoin, *rev_isoout; + + /* Compute global availability. AVIN is not needed except to + compute AVOUT, so free its memory as soon as we return from + compute_avinout. */ + avin = sbitmap_vector_alloc (n_blocks, n_exprs); + avout = sbitmap_vector_alloc (n_blocks, n_exprs); + compute_avinout (n_blocks, s_preds, avloc, transp, avin, avout); + free (avin); + avin = NULL; + + /* Compute fartherness. FARTHERIN is not needed except to compute + FARTHEROUT, so free its memory as soon as we return from + compute_earlyinout. */ + fartherin = sbitmap_vector_alloc (n_blocks, n_exprs); + fartherout = sbitmap_vector_alloc (n_blocks, n_exprs); + compute_fartherinout (n_blocks, n_exprs, s_succs, transp, + avout, fartherin, fartherout); + free (fartherin); + fartherin = NULL; + + /* Compute earlierness. EARLIERIN is not needed except to compute + EARLIEROUT, so free its memory as soon as we return from + compute_delayinout. We also no longer need AVOUT and FARTHEROUT. */ + earlierin = sbitmap_vector_alloc (n_blocks, n_exprs); + earlierout = sbitmap_vector_alloc (n_blocks, n_exprs); + compute_earlierinout (n_blocks, n_exprs, s_succs, avloc, + avout, fartherout, earlierin, earlierout); + free (earlierin); + earlierin = NULL; + free (avout); + avout = NULL; + free (fartherout); + fartherout = NULL; + + /* Compute firstness. We no longer need EARLIEROUT after we compute + FIRSTOUT. */ + firstout = sbitmap_vector_alloc (n_blocks, n_exprs); + compute_firstout (n_blocks, n_exprs, s_preds, avloc, earlierout, firstout); + free (earlierout); + earlierout = NULL; + + /* Compute rev_isolatedness. ISOIN is not needed except to compute + ISOOUT, so free its memory as soon as we return from + compute_isoinout. */ + rev_isoin = sbitmap_vector_alloc (n_blocks, n_exprs); + rev_isoout = sbitmap_vector_alloc (n_blocks, n_exprs); + compute_rev_isoinout (n_blocks, s_preds, avloc, firstout, + rev_isoin, rev_isoout); + free (rev_isoout); + rev_isoout = NULL; + + /* Now compute optimal placement points and the redundant expressions. */ + compute_optimal (n_blocks, firstout, rev_isoin, optimal); + compute_redundant (n_blocks, n_exprs, avloc, firstout, rev_isoin, redundant); + free (firstout); + firstout = NULL; + free (rev_isoin); + rev_isoin = NULL; +} + +/* Compute expression anticipatability at entrance and exit of each block. */ + +static void +compute_antinout (n_blocks, s_succs, antloc, transp, antin, antout) + int n_blocks; + int_list_ptr *s_succs; + sbitmap *antloc; + sbitmap *transp; + sbitmap *antin; + sbitmap *antout; +{ + int bb, changed, passes; + sbitmap old_changed, new_changed; + + sbitmap_zero (antout[n_blocks - 1]); + sbitmap_vector_ones (antin, n_blocks); + + old_changed = sbitmap_alloc (n_blocks); + new_changed = sbitmap_alloc (n_blocks); + sbitmap_ones (old_changed); + + passes = 0; + changed = 1; + while (changed) + { + changed = 0; + sbitmap_zero (new_changed); + /* We scan the blocks in the reverse order to speed up + the convergence. */ + for (bb = n_blocks - 1; bb >= 0; bb--) + { + int_list_ptr ps; + + /* If none of the successors of this block have changed, + then this block is not going to change. */ + for (ps = s_succs[bb] ; ps; ps = ps->next) + { + if (INT_LIST_VAL (ps) == EXIT_BLOCK + || INT_LIST_VAL (ps) == ENTRY_BLOCK) + break; + + if (TEST_BIT (old_changed, INT_LIST_VAL (ps)) + || TEST_BIT (new_changed, INT_LIST_VAL (ps))) + break; + } + + if (!ps) + continue; + + if (bb != n_blocks - 1) + sbitmap_intersect_of_successors (antout[bb], antin, + bb, s_succs); + if (sbitmap_a_or_b_and_c (antin[bb], antloc[bb], + transp[bb], antout[bb])) + { + changed = 1; + SET_BIT (new_changed, bb); + } + } + sbitmap_copy (old_changed, new_changed); + passes++; + } + free (old_changed); + free (new_changed); +} + +/* Compute expression earliestness at entrance and exit of each block. + + From Advanced Compiler Design and Implementation pp411. + + An expression is earliest at the entrance to basic block BB if no + block from entry to block BB both evaluates the expression and + produces the same value as evaluating it at the entry to block BB + does. Similarly for earlistness at basic block BB exit. */ + +static void +compute_earlyinout (n_blocks, n_exprs, s_preds, transp, antin, + earlyin, earlyout) + int n_blocks; + int n_exprs; + int_list_ptr *s_preds; + sbitmap *transp; + sbitmap *antin; + sbitmap *earlyin; + sbitmap *earlyout; +{ + int bb, changed, passes; + sbitmap temp_bitmap; + sbitmap old_changed, new_changed; + + temp_bitmap = sbitmap_alloc (n_exprs); + + sbitmap_vector_zero (earlyout, n_blocks); + sbitmap_ones (earlyin[0]); + + old_changed = sbitmap_alloc (n_blocks); + new_changed = sbitmap_alloc (n_blocks); + sbitmap_ones (old_changed); + + passes = 0; + changed = 1; + while (changed) + { + changed = 0; + sbitmap_zero (new_changed); + for (bb = 0; bb < n_blocks; bb++) + { + int_list_ptr ps; + + /* If none of the predecessors of this block have changed, + then this block is not going to change. */ + for (ps = s_preds[bb] ; ps; ps = ps->next) + { + if (INT_LIST_VAL (ps) == EXIT_BLOCK + || INT_LIST_VAL (ps) == ENTRY_BLOCK) + break; + + if (TEST_BIT (old_changed, INT_LIST_VAL (ps)) + || TEST_BIT (new_changed, INT_LIST_VAL (ps))) + break; + } + + if (!ps) + continue; + + if (bb != 0) + sbitmap_union_of_predecessors (earlyin[bb], earlyout, + bb, s_preds); + sbitmap_not (temp_bitmap, transp[bb]); + if (sbitmap_union_of_diff (earlyout[bb], temp_bitmap, + earlyin[bb], antin[bb])) + { + changed = 1; + SET_BIT (new_changed, bb); + } + } + sbitmap_copy (old_changed, new_changed); + passes++; + } + free (old_changed); + free (new_changed); + free (temp_bitmap); +} + +/* Compute expression delayedness at entrance and exit of each block. + + From Advanced Compiler Design and Implementation pp411. + + An expression is delayed at the entrance to BB if it is anticipatable + and earliest at that point and if all subsequent computations of + the expression are in block BB. */ + +static void +compute_delayinout (n_blocks, n_exprs, s_preds, antloc, + antin, earlyin, delayin, delayout) + int n_blocks; + int n_exprs; + int_list_ptr *s_preds; + sbitmap *antloc; + sbitmap *antin; + sbitmap *earlyin; + sbitmap *delayin; + sbitmap *delayout; +{ + int bb, changed, passes; + sbitmap *anti_and_early; + sbitmap temp_bitmap; + + temp_bitmap = sbitmap_alloc (n_exprs); + + /* This is constant throughout the flow equations below, so compute + it once to save time. */ + anti_and_early = sbitmap_vector_alloc (n_blocks, n_exprs); + for (bb = 0; bb < n_blocks; bb++) + sbitmap_a_and_b (anti_and_early[bb], antin[bb], earlyin[bb]); + + sbitmap_vector_zero (delayout, n_blocks); + sbitmap_copy (delayin[0], anti_and_early[0]); + + passes = 0; + changed = 1; + while (changed) + { + changed = 0; + for (bb = 0; bb < n_blocks; bb++) + { + if (bb != 0) + { + sbitmap_intersect_of_predecessors (temp_bitmap, delayout, + bb, s_preds); + changed |= sbitmap_a_or_b (delayin[bb], + anti_and_early[bb], + temp_bitmap); + } + sbitmap_not (temp_bitmap, antloc[bb]); + changed |= sbitmap_a_and_b (delayout[bb], + temp_bitmap, + delayin[bb]); + } + passes++; + } + + /* We're done with this, so go ahead and free it's memory now instead + of waiting until the end of pre. */ + free (anti_and_early); + free (temp_bitmap); +} + +/* Compute latestness. + + From Advanced Compiler Design and Implementation pp412. + + An expression is latest at the entrance to block BB if that is an optimal + point for computing the expression and if on every path from block BB's + entrance to the exit block, any optimal computation point for the + expression occurs after one of the points at which the expression was + computed in the original flowgraph. */ + +static void +compute_latein (n_blocks, n_exprs, s_succs, antloc, delayin, latein) + int n_blocks; + int n_exprs; + int_list_ptr *s_succs; + sbitmap *antloc; + sbitmap *delayin; + sbitmap *latein; +{ + int bb; + sbitmap temp_bitmap; + + temp_bitmap = sbitmap_alloc (n_exprs); + + for (bb = 0; bb < n_blocks; bb++) + { + /* The last block is succeeded only by the exit block; therefore, + temp_bitmap will not be set by the following call! */ + if (bb == n_blocks - 1) + { + sbitmap_intersect_of_successors (temp_bitmap, delayin, + bb, s_succs); + sbitmap_not (temp_bitmap, temp_bitmap); + } + else + sbitmap_ones (temp_bitmap); + sbitmap_a_and_b_or_c (latein[bb], delayin[bb], + antloc[bb], temp_bitmap); + } + free (temp_bitmap); +} + +/* Compute isolated. + + From Advanced Compiler Design and Implementation pp413. + + A computationally optimal placement for the evaluation of an expression + is defined to be isolated if and only if on every path from a successor + of the block in which it is computed to the exit block, every original + computation of the expression is preceded by the optimal placement point. */ + +static void +compute_isoinout (n_blocks, s_succs, antloc, latein, isoin, isoout) + int n_blocks; + int_list_ptr *s_succs; + sbitmap *antloc; + sbitmap *latein; + sbitmap *isoin; + sbitmap *isoout; +{ + int bb, changed, passes; + + sbitmap_vector_zero (isoin, n_blocks); + sbitmap_zero (isoout[n_blocks - 1]); + + passes = 0; + changed = 1; + while (changed) + { + changed = 0; + for (bb = n_blocks - 1; bb >= 0; bb--) + { + if (bb != n_blocks - 1) + sbitmap_intersect_of_successors (isoout[bb], isoin, + bb, s_succs); + changed |= sbitmap_union_of_diff (isoin[bb], latein[bb], + isoout[bb], antloc[bb]); + } + passes++; + } +} + +/* Compute the set of expressions which have optimal computational points + in each basic block. This is the set of expressions that are latest, but + that are not isolated in the block. */ + +static void +compute_optimal (n_blocks, latein, isoout, optimal) + int n_blocks; + sbitmap *latein; + sbitmap *isoout; + sbitmap *optimal; +{ + int bb; + + for (bb = 0; bb < n_blocks; bb++) + sbitmap_difference (optimal[bb], latein[bb], isoout[bb]); +} + +/* Compute the set of expressions that are redundant in a block. They are + the expressions that are used in the block and that are neither isolated + or latest. */ + +static void +compute_redundant (n_blocks, n_exprs, antloc, latein, isoout, redundant) + int n_blocks; + int n_exprs; + sbitmap *antloc; + sbitmap *latein; + sbitmap *isoout; + sbitmap *redundant; +{ + int bb; + sbitmap temp_bitmap; + + temp_bitmap = sbitmap_alloc (n_exprs); + + for (bb = 0; bb < n_blocks; bb++) + { + sbitmap_a_or_b (temp_bitmap, latein[bb], isoout[bb]); + sbitmap_difference (redundant[bb], antloc[bb], temp_bitmap); + } + free (temp_bitmap); +} + +/* Compute expression availability at entrance and exit of each block. */ + +static void +compute_avinout (n_blocks, s_preds, avloc, transp, avin, avout) + int n_blocks; + int_list_ptr *s_preds; + sbitmap *avloc; + sbitmap *transp; + sbitmap *avin; + sbitmap *avout; +{ + int bb, changed, passes; + + sbitmap_zero (avin[0]); + sbitmap_vector_ones (avout, n_blocks); + + passes = 0; + changed = 1; + while (changed) + { + changed = 0; + for (bb = 0; bb < n_blocks; bb++) + { + if (bb != 0) + sbitmap_intersect_of_predecessors (avin[bb], avout, + bb, s_preds); + changed |= sbitmap_a_or_b_and_c (avout[bb], avloc[bb], + transp[bb], avin[bb]); + } + passes++; + } +} + +/* Compute expression latestness. + + This is effectively the same as earliestness computed on the reverse + flow graph. */ + +static void +compute_fartherinout (n_blocks, n_exprs, s_succs, + transp, avout, fartherin, fartherout) + int n_blocks; + int n_exprs; + int_list_ptr *s_succs; + sbitmap *transp; + sbitmap *avout; + sbitmap *fartherin; + sbitmap *fartherout; +{ + int bb, changed, passes; + sbitmap temp_bitmap; + + temp_bitmap = sbitmap_alloc (n_exprs); + + sbitmap_vector_zero (fartherin, n_blocks); + sbitmap_ones (fartherout[n_blocks - 1]); + + passes = 0; + changed = 1; + while (changed) + { + changed = 0; + for (bb = n_blocks - 1; bb >= 0; bb--) + { + if (bb != n_blocks - 1) + sbitmap_union_of_successors (fartherout[bb], fartherin, + bb, s_succs); + sbitmap_not (temp_bitmap, transp[bb]); + changed |= sbitmap_union_of_diff (fartherin[bb], temp_bitmap, + fartherout[bb], avout[bb]); + } + passes++; + } + + free (temp_bitmap); +} + +/* Compute expression earlierness at entrance and exit of each block. + + This is effectively the same as delayedness computed on the reverse + flow graph. */ + +static void +compute_earlierinout (n_blocks, n_exprs, s_succs, avloc, + avout, fartherout, earlierin, earlierout) + int n_blocks; + int n_exprs; + int_list_ptr *s_succs; + sbitmap *avloc; + sbitmap *avout; + sbitmap *fartherout; + sbitmap *earlierin; + sbitmap *earlierout; +{ + int bb, changed, passes; + sbitmap *av_and_farther; + sbitmap temp_bitmap; + + temp_bitmap = sbitmap_alloc (n_exprs); + + /* This is constant throughout the flow equations below, so compute + it once to save time. */ + av_and_farther = sbitmap_vector_alloc (n_blocks, n_exprs); + for (bb = 0; bb < n_blocks; bb++) + sbitmap_a_and_b (av_and_farther[bb], avout[bb], fartherout[bb]); + + sbitmap_vector_zero (earlierin, n_blocks); + sbitmap_copy (earlierout[n_blocks - 1], av_and_farther[n_blocks - 1]); + + passes = 0; + changed = 1; + while (changed) + { + changed = 0; + for (bb = n_blocks - 1; bb >= 0; bb--) + { + if (bb != n_blocks - 1) + { + sbitmap_intersect_of_successors (temp_bitmap, earlierin, + bb, s_succs); + changed |= sbitmap_a_or_b (earlierout[bb], + av_and_farther[bb], + temp_bitmap); + } + sbitmap_not (temp_bitmap, avloc[bb]); + changed |= sbitmap_a_and_b (earlierin[bb], + temp_bitmap, + earlierout[bb]); + } + passes++; + } + + /* We're done with this, so go ahead and free it's memory now instead + of waiting until the end of pre. */ + free (av_and_farther); + free (temp_bitmap); +} + +/* Compute firstness. + + This is effectively the same as latestness computed on the reverse + flow graph. */ + +static void +compute_firstout (n_blocks, n_exprs, s_preds, avloc, earlierout, firstout) + int n_blocks; + int n_exprs; + int_list_ptr *s_preds; + sbitmap *avloc; + sbitmap *earlierout; + sbitmap *firstout; +{ + int bb; + sbitmap temp_bitmap; + + temp_bitmap = sbitmap_alloc (n_exprs); + + for (bb = 0; bb < n_blocks; bb++) + { + /* The first block is preceded only by the entry block; therefore, + temp_bitmap will not be set by the following call! */ + if (bb != 0) + { + sbitmap_intersect_of_predecessors (temp_bitmap, earlierout, + bb, s_preds); + sbitmap_not (temp_bitmap, temp_bitmap); + } + else + { + sbitmap_ones (temp_bitmap); + } + sbitmap_a_and_b_or_c (firstout[bb], earlierout[bb], + avloc[bb], temp_bitmap); + } + free (temp_bitmap); +} + +/* Compute reverse isolated. + + This is effectively the same as isolatedness computed on the reverse + flow graph. */ + +static void +compute_rev_isoinout (n_blocks, s_preds, avloc, firstout, + rev_isoin, rev_isoout) + int n_blocks; + int_list_ptr *s_preds; + sbitmap *avloc; + sbitmap *firstout; + sbitmap *rev_isoin; + sbitmap *rev_isoout; +{ + int bb, changed, passes; + + sbitmap_vector_zero (rev_isoout, n_blocks); + sbitmap_zero (rev_isoin[0]); + + passes = 0; + changed = 1; + while (changed) + { + changed = 0; + for (bb = 0; bb < n_blocks; bb++) + { + if (bb != 0) + sbitmap_intersect_of_predecessors (rev_isoin[bb], rev_isoout, + bb, s_preds); + changed |= sbitmap_union_of_diff (rev_isoout[bb], firstout[bb], + rev_isoin[bb], avloc[bb]); + } + passes++; + } +} diff --git a/gcc/objc/lang-specs.h b/gcc/objc/lang-specs.h new file mode 100644 index 00000000000..50c25f5d2ef --- /dev/null +++ b/gcc/objc/lang-specs.h @@ -0,0 +1,96 @@ +/* Definitions for specs for Objective-C. + Copyright (C) 1998, 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. */ + +/* This is the contribution to the `default_compilers' array in gcc.c for + objc. */ + + {".m", {"@objective-c"}}, + {"@objective-c", +#if USE_CPPLIB + {"%{E|M|MM:cpp -lang-objc %{nostdinc*} %{C} %{v} %{A*} %{I*} %{P} %I\ + %{C:%{!E:%eGNU C does not support -C without using -E}}\ + %{M} %{MM} %{MD:-MD %b.d} %{MMD:-MMD %b.d} %{MG}\ + -undef -D__OBJC__ -D__GNUC__=%v1 -D__GNUC_MINOR__=%v2\ + %{ansi:-trigraphs -D__STRICT_ANSI__}\ + %{!undef:%{!ansi:%p} %P} %{trigraphs}\ + %c %{Os:-D__OPTIMIZE_SIZE__} %{O*:%{!O0:-D__OPTIMIZE__}}\ + %{ffast-math:-D__FAST_MATH__}\ + %{traditional} %{ftraditional:-traditional}\ + %{traditional-cpp:-traditional}\ + %{fleading-underscore} %{fno-leading-underscore}\ + %{g*} %{W*} %{w} %{pedantic*} %{H} %{d*} %C %{D*} %{U*} %{i*} %Z\ + %i %{E:%W{o*}}%{M:%W{o*}}%{MM:%W{o*}}\n}", + "%{!M:%{!MM:%{!E:cc1obj %i %1 \ + %{nostdinc*} %{A*} %{I*} %{P} %I\ + %{MD:-MD %b.d} %{MMD:-MMD %b.d} %{MG}\ + -undef -D__OBJC__ -D__GNUC__=%v1 -D__GNUC_MINOR__=%v2\ + %{!undef:%{!ansi:%p} %P} %{trigraphs}\ + %c %{Os:-D__OPTIMIZE_SIZE__} %{O*:%{!O0:-D__OPTIMIZE__}}\ + %{ffast-math:-D__FAST_MATH__}\ + %{!Q:-quiet} -dumpbase %b.m %{d*} %{m*} %{a*}\ + %{g*} %{O*} %{W*} %{w} %{pedantic*} %{ansi} \ + %{traditional} %{v:-version} %{pg:-p} %{p} %{f*} \ + -lang-objc %{gen-decls} \ + %{aux-info*} %{Qn:-fno-ident}\ + %{pg:%{fomit-frame-pointer:%e-pg and -fomit-frame-pointer are incompatible}}\ + %{S:%W{o*}%{!o*:-o %b.s}}%{!S:-o %{|!pipe:%g.s}} |\n\ + %{!S:as %a %Y\ + %{c:%W{o*}%{!o*:-o %w%b%O}}%{!c:-o %d%w%u%O}\ + %{!pipe:%g.s} %A\n }}}}"} +#else /* ! USE_CPPLIB */ + {"cpp -lang-objc %{nostdinc*} %{C} %{v} %{A*} %{I*} %{P} %I\ + %{C:%{!E:%eGNU C does not support -C without using -E}}\ + %{M} %{MM} %{MD:-MD %b.d} %{MMD:-MMD %b.d} %{MG}\ + -undef -D__OBJC__ -D__GNUC__=%v1 -D__GNUC_MINOR__=%v2\ + %{ansi:-trigraphs -D__STRICT_ANSI__}\ + %{!undef:%{!ansi:%p} %P} %{trigraphs}\ + %c %{Os:-D__OPTIMIZE_SIZE__} %{O*:%{!O0:-D__OPTIMIZE__}}\ + %{ffast-math:-D__FAST_MATH__}\ + %{traditional} %{ftraditional:-traditional}\ + %{traditional-cpp:-traditional}\ + %{fleading-underscore} %{fno-leading-underscore}\ + %{g*} %{W*} %{w} %{pedantic*} %{H} %{d*} %C %{D*} %{U*} %{i*} %Z\ + %i %{!M:%{!MM:%{!E:%{!pipe:%g.mi}}}}%{E:%W{o*}}%{M:%W{o*}}%{MM:%W{o*}} |\n", + "%{!M:%{!MM:%{!E:cc1obj %{!pipe:%g.mi} %1 \ + %{!Q:-quiet} -dumpbase %b.m %{d*} %{m*} %{a*}\ + %{g*} %{O*} %{W*} %{w} %{pedantic*} %{ansi} \ + %{traditional} %{v:-version} %{pg:-p} %{p} %{f*} \ + -lang-objc %{gen-decls} \ + %{aux-info*} %{Qn:-fno-ident}\ + %{pg:%{fomit-frame-pointer:%e-pg and -fomit-frame-pointer are incompatible}}\ + %{S:%W{o*}%{!o*:-o %b.s}}%{!S:-o %{|!pipe:%g.s}} |\n\ + %{!S:as %a %Y\ + %{c:%W{o*}%{!o*:-o %w%b%O}}%{!c:-o %d%w%u%O}\ + %{!pipe:%g.s} %A\n }}}}"} +#endif /* ! USE_CPPLIB */ + }, + {".mi", {"@objc-cpp-output"}}, + {"@objc-cpp-output", + {"%{!M:%{!MM:%{!E:cc1obj %{!pipe:%g.i} %1 \ + %{!Q:-quiet} -dumpbase %b.m %{d*} %{m*} %{a*}\ + %{g*} %{O*} %{W*} %{w} %{pedantic*} %{ansi} \ + %{traditional} %{v:-version} %{pg:-p} %{p} %{f*} \ + -lang-objc %{gen-decls} \ + %{aux-info*} %{Qn:-fno-ident}\ + %{pg:%{fomit-frame-pointer:%e-pg and -fomit-frame-pointer are incompatible}}\ + %{S:%W{o*}%{!o*:-o %b.s}}%{!S:-o %{|!pipe:%g.s}} |\n", + "%{!S:as %a %Y\ + %{c:%W{o*}%{!o*:-o %w%b%O}}%{!c:-o %d%w%u%O}\ + %{!pipe:%g.s} %A\n }}}}"}}, diff --git a/gcc/prefix.h b/gcc/prefix.h new file mode 100644 index 00000000000..b7c36487a55 --- /dev/null +++ b/gcc/prefix.h @@ -0,0 +1,28 @@ +/* Provide prototypes for functions exported from prefix.c. + Copyright (C) 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 Library General Public +License as published by the Free Software Foundation; either +version 2 of the License, 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 +Library General Public License for more details. + +You should have received a copy of the GNU Library General Public +License along with GCC; see the file COPYING. If not, write to the Free +Software Foundation, Inc., 59 Temple Place - Suite 330, +Boston, MA 02111-1307, USA. */ + + +#ifndef __GCC_PREFIX_H__ +#define __GCC_PREFIX_H__ + +extern const char *update_path PARAMS ((const char *, const char *)); +extern void set_std_prefix PARAMS ((const char *, int)); + +#endif /* ! __GCC_PREFIX_H__ */ diff --git a/gcc/resource.c b/gcc/resource.c new file mode 100644 index 00000000000..9f702a536cd --- /dev/null +++ b/gcc/resource.c @@ -0,0 +1,1266 @@ +/* Definitions for computing resource usage of specific insns. + Copyright (C) 1999 Free Software Foundation, Inc. + +This file is part of GNU CC. + +GNU CC is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU CC is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU CC; see the file COPYING. If not, write to +the Free Software Foundation, 59 Temple Place - Suite 330, +Boston, MA 02111-1307, USA. */ + +#include "config.h" +#include "rtl.h" +#include "hard-reg-set.h" +#include "system.h" +#include "basic-block.h" +#include "regs.h" +#include "flags.h" +#include "output.h" +#include "resource.h" + +/* This structure is used to record liveness information at the targets or + fallthrough insns of branches. We will most likely need the information + at targets again, so save them in a hash table rather than recomputing them + each time. */ + +struct target_info +{ + int uid; /* INSN_UID of target. */ + struct target_info *next; /* Next info for same hash bucket. */ + HARD_REG_SET live_regs; /* Registers live at target. */ + int block; /* Basic block number containing target. */ + int bb_tick; /* Generation count of basic block info. */ +}; + +#define TARGET_HASH_PRIME 257 + +/* Indicates what resources are required at the beginning of the epilogue. */ +static struct resources start_of_epilogue_needs; + +/* Indicates what resources are required at function end. */ +static struct resources end_of_function_needs; + +/* Define the hash table itself. */ +static struct target_info **target_hash_table = NULL; + +/* For each basic block, we maintain a generation number of its basic + block info, which is updated each time we move an insn from the + target of a jump. This is the generation number indexed by block + number. */ + +static int *bb_ticks; + +/* Marks registers possibly live at the current place being scanned by + mark_target_live_regs. Used only by next two function. */ + +static HARD_REG_SET current_live_regs; + +/* Marks registers for which we have seen a REG_DEAD note but no assignment. + Also only used by the next two functions. */ + +static HARD_REG_SET pending_dead_regs; + +static void update_live_status PROTO ((rtx, rtx)); +static int find_basic_block PROTO ((rtx)); +static rtx next_insn_no_annul PROTO ((rtx)); +static rtx find_dead_or_set_registers PROTO ((rtx, struct resources*, + rtx*, int, struct resources, + struct resources)); + +/* Utility function called from mark_target_live_regs via note_stores. + It deadens any CLOBBERed registers and livens any SET registers. */ + +static void +update_live_status (dest, x) + rtx dest; + rtx x; +{ + int first_regno, last_regno; + int i; + + if (GET_CODE (dest) != REG + && (GET_CODE (dest) != SUBREG || GET_CODE (SUBREG_REG (dest)) != REG)) + return; + + if (GET_CODE (dest) == SUBREG) + first_regno = REGNO (SUBREG_REG (dest)) + SUBREG_WORD (dest); + else + first_regno = REGNO (dest); + + last_regno = first_regno + HARD_REGNO_NREGS (first_regno, GET_MODE (dest)); + + if (GET_CODE (x) == CLOBBER) + for (i = first_regno; i < last_regno; i++) + CLEAR_HARD_REG_BIT (current_live_regs, i); + else + for (i = first_regno; i < last_regno; i++) + { + SET_HARD_REG_BIT (current_live_regs, i); + CLEAR_HARD_REG_BIT (pending_dead_regs, i); + } +} +/* Find the number of the basic block that starts closest to INSN. Return -1 + if we couldn't find such a basic block. */ + +static int +find_basic_block (insn) + rtx insn; +{ + int i; + + /* Scan backwards to the previous BARRIER. Then see if we can find a + label that starts a basic block. Return the basic block number. */ + + for (insn = prev_nonnote_insn (insn); + insn && GET_CODE (insn) != BARRIER; + insn = prev_nonnote_insn (insn)) + ; + + /* The start of the function is basic block zero. */ + if (insn == 0) + return 0; + + /* See if any of the upcoming CODE_LABELs start a basic block. If we reach + anything other than a CODE_LABEL or note, we can't find this code. */ + for (insn = next_nonnote_insn (insn); + insn && GET_CODE (insn) == CODE_LABEL; + insn = next_nonnote_insn (insn)) + { + for (i = 0; i < n_basic_blocks; i++) + if (insn == BLOCK_HEAD (i)) + return i; + } + + return -1; +} + +/* Similar to next_insn, but ignores insns in the delay slots of + an annulled branch. */ + +static rtx +next_insn_no_annul (insn) + rtx insn; +{ + if (insn) + { + /* If INSN is an annulled branch, skip any insns from the target + of the branch. */ + if (INSN_ANNULLED_BRANCH_P (insn) + && NEXT_INSN (PREV_INSN (insn)) != insn) + while (INSN_FROM_TARGET_P (NEXT_INSN (insn))) + insn = NEXT_INSN (insn); + + insn = NEXT_INSN (insn); + if (insn && GET_CODE (insn) == INSN + && GET_CODE (PATTERN (insn)) == SEQUENCE) + insn = XVECEXP (PATTERN (insn), 0, 0); + } + + return insn; +} + +/* Given X, some rtl, and RES, a pointer to a `struct resource', mark + which resources are references by the insn. If INCLUDE_DELAYED_EFFECTS + is TRUE, resources used by the called routine will be included for + CALL_INSNs. */ + +void +mark_referenced_resources (x, res, include_delayed_effects) + register rtx x; + register struct resources *res; + register int include_delayed_effects; +{ + register enum rtx_code code = GET_CODE (x); + register int i, j; + register char *format_ptr; + + /* Handle leaf items for which we set resource flags. Also, special-case + CALL, SET and CLOBBER operators. */ + switch (code) + { + case CONST: + case CONST_INT: + case CONST_DOUBLE: + case PC: + case SYMBOL_REF: + case LABEL_REF: + return; + + case SUBREG: + if (GET_CODE (SUBREG_REG (x)) != REG) + mark_referenced_resources (SUBREG_REG (x), res, 0); + else + { + int regno = REGNO (SUBREG_REG (x)) + SUBREG_WORD (x); + int last_regno = regno + HARD_REGNO_NREGS (regno, GET_MODE (x)); + for (i = regno; i < last_regno; i++) + SET_HARD_REG_BIT (res->regs, i); + } + return; + + case REG: + for (i = 0; i < HARD_REGNO_NREGS (REGNO (x), GET_MODE (x)); i++) + SET_HARD_REG_BIT (res->regs, REGNO (x) + i); + return; + + case MEM: + /* If this memory shouldn't change, it really isn't referencing + memory. */ + if (RTX_UNCHANGING_P (x)) + res->unch_memory = 1; + else + res->memory = 1; + res->volatil = MEM_VOLATILE_P (x); + + /* Mark registers used to access memory. */ + mark_referenced_resources (XEXP (x, 0), res, 0); + return; + + case CC0: + res->cc = 1; + return; + + case UNSPEC_VOLATILE: + case ASM_INPUT: + /* Traditional asm's are always volatile. */ + res->volatil = 1; + return; + + case TRAP_IF: + res->volatil = 1; + break; + + case ASM_OPERANDS: + res->volatil = MEM_VOLATILE_P (x); + + /* For all ASM_OPERANDS, we must traverse the vector of input operands. + We can not just fall through here since then we would be confused + by the ASM_INPUT rtx inside ASM_OPERANDS, which do not indicate + traditional asms unlike their normal usage. */ + + for (i = 0; i < ASM_OPERANDS_INPUT_LENGTH (x); i++) + mark_referenced_resources (ASM_OPERANDS_INPUT (x, i), res, 0); + return; + + case CALL: + /* The first operand will be a (MEM (xxx)) but doesn't really reference + memory. The second operand may be referenced, though. */ + mark_referenced_resources (XEXP (XEXP (x, 0), 0), res, 0); + mark_referenced_resources (XEXP (x, 1), res, 0); + return; + + case SET: + /* Usually, the first operand of SET is set, not referenced. But + registers used to access memory are referenced. SET_DEST is + also referenced if it is a ZERO_EXTRACT or SIGN_EXTRACT. */ + + mark_referenced_resources (SET_SRC (x), res, 0); + + x = SET_DEST (x); + if (GET_CODE (x) == SIGN_EXTRACT || GET_CODE (x) == ZERO_EXTRACT) + mark_referenced_resources (x, res, 0); + else if (GET_CODE (x) == SUBREG) + x = SUBREG_REG (x); + if (GET_CODE (x) == MEM) + mark_referenced_resources (XEXP (x, 0), res, 0); + return; + + case CLOBBER: + return; + + case CALL_INSN: + if (include_delayed_effects) + { + /* A CALL references memory, the frame pointer if it exists, the + stack pointer, any global registers and any registers given in + USE insns immediately in front of the CALL. + + However, we may have moved some of the parameter loading insns + into the delay slot of this CALL. If so, the USE's for them + don't count and should be skipped. */ + rtx insn = PREV_INSN (x); + rtx sequence = 0; + int seq_size = 0; + rtx next = NEXT_INSN (x); + int i; + + /* If we are part of a delay slot sequence, point at the SEQUENCE. */ + if (NEXT_INSN (insn) != x) + { + next = NEXT_INSN (NEXT_INSN (insn)); + sequence = PATTERN (NEXT_INSN (insn)); + seq_size = XVECLEN (sequence, 0); + if (GET_CODE (sequence) != SEQUENCE) + abort (); + } + + res->memory = 1; + SET_HARD_REG_BIT (res->regs, STACK_POINTER_REGNUM); + if (frame_pointer_needed) + { + SET_HARD_REG_BIT (res->regs, FRAME_POINTER_REGNUM); +#if FRAME_POINTER_REGNUM != HARD_FRAME_POINTER_REGNUM + SET_HARD_REG_BIT (res->regs, HARD_FRAME_POINTER_REGNUM); +#endif + } + + for (i = 0; i < FIRST_PSEUDO_REGISTER; i++) + if (global_regs[i]) + SET_HARD_REG_BIT (res->regs, i); + + /* Check for a NOTE_INSN_SETJMP. If it exists, then we must + assume that this call can need any register. + + This is done to be more conservative about how we handle setjmp. + We assume that they both use and set all registers. Using all + registers ensures that a register will not be considered dead + just because it crosses a setjmp call. A register should be + considered dead only if the setjmp call returns non-zero. */ + if (next && GET_CODE (next) == NOTE + && NOTE_LINE_NUMBER (next) == NOTE_INSN_SETJMP) + SET_HARD_REG_SET (res->regs); + + { + rtx link; + + for (link = CALL_INSN_FUNCTION_USAGE (x); + link; + link = XEXP (link, 1)) + if (GET_CODE (XEXP (link, 0)) == USE) + { + for (i = 1; i < seq_size; i++) + { + rtx slot_pat = PATTERN (XVECEXP (sequence, 0, i)); + if (GET_CODE (slot_pat) == SET + && rtx_equal_p (SET_DEST (slot_pat), + SET_DEST (XEXP (link, 0)))) + break; + } + if (i >= seq_size) + mark_referenced_resources (SET_DEST (XEXP (link, 0)), + res, 0); + } + } + } + + /* ... fall through to other INSN processing ... */ + + case INSN: + case JUMP_INSN: + +#ifdef INSN_REFERENCES_ARE_DELAYED + if (! include_delayed_effects + && INSN_REFERENCES_ARE_DELAYED (x)) + return; +#endif + + /* No special processing, just speed up. */ + mark_referenced_resources (PATTERN (x), res, include_delayed_effects); + return; + + default: + break; + } + + /* Process each sub-expression and flag what it needs. */ + format_ptr = GET_RTX_FORMAT (code); + for (i = 0; i < GET_RTX_LENGTH (code); i++) + switch (*format_ptr++) + { + case 'e': + mark_referenced_resources (XEXP (x, i), res, include_delayed_effects); + break; + + case 'E': + for (j = 0; j < XVECLEN (x, i); j++) + mark_referenced_resources (XVECEXP (x, i, j), res, + include_delayed_effects); + break; + } +} + +/* A subroutine of mark_target_live_regs. Search forward from TARGET + looking for registers that are set before they are used. These are dead. + Stop after passing a few conditional jumps, and/or a small + number of unconditional branches. */ + +static rtx +find_dead_or_set_registers (target, res, jump_target, jump_count, set, needed) + rtx target; + struct resources *res; + rtx *jump_target; + int jump_count; + struct resources set, needed; +{ + HARD_REG_SET scratch; + rtx insn, next; + rtx jump_insn = 0; + int i; + + for (insn = target; insn; insn = next) + { + rtx this_jump_insn = insn; + + next = NEXT_INSN (insn); + switch (GET_CODE (insn)) + { + case CODE_LABEL: + /* After a label, any pending dead registers that weren't yet + used can be made dead. */ + AND_COMPL_HARD_REG_SET (pending_dead_regs, needed.regs); + AND_COMPL_HARD_REG_SET (res->regs, pending_dead_regs); + CLEAR_HARD_REG_SET (pending_dead_regs); + + continue; + + case BARRIER: + case NOTE: + continue; + + case INSN: + if (GET_CODE (PATTERN (insn)) == USE) + { + /* If INSN is a USE made by update_block, we care about the + underlying insn. Any registers set by the underlying insn + are live since the insn is being done somewhere else. */ + if (GET_RTX_CLASS (GET_CODE (XEXP (PATTERN (insn), 0))) == 'i') + mark_set_resources (XEXP (PATTERN (insn), 0), res, 0, 1); + + /* All other USE insns are to be ignored. */ + continue; + } + else if (GET_CODE (PATTERN (insn)) == CLOBBER) + continue; + else if (GET_CODE (PATTERN (insn)) == SEQUENCE) + { + /* An unconditional jump can be used to fill the delay slot + of a call, so search for a JUMP_INSN in any position. */ + for (i = 0; i < XVECLEN (PATTERN (insn), 0); i++) + { + this_jump_insn = XVECEXP (PATTERN (insn), 0, i); + if (GET_CODE (this_jump_insn) == JUMP_INSN) + break; + } + } + + default: + break; + } + + if (GET_CODE (this_jump_insn) == JUMP_INSN) + { + if (jump_count++ < 10) + { + if (simplejump_p (this_jump_insn) + || GET_CODE (PATTERN (this_jump_insn)) == RETURN) + { + next = JUMP_LABEL (this_jump_insn); + if (jump_insn == 0) + { + jump_insn = insn; + if (jump_target) + *jump_target = JUMP_LABEL (this_jump_insn); + } + } + else if (condjump_p (this_jump_insn) + || condjump_in_parallel_p (this_jump_insn)) + { + struct resources target_set, target_res; + struct resources fallthrough_res; + + /* We can handle conditional branches here by following + both paths, and then IOR the results of the two paths + together, which will give us registers that are dead + on both paths. Since this is expensive, we give it + a much higher cost than unconditional branches. The + cost was chosen so that we will follow at most 1 + conditional branch. */ + + jump_count += 4; + if (jump_count >= 10) + break; + + mark_referenced_resources (insn, &needed, 1); + + /* For an annulled branch, mark_set_resources ignores slots + filled by instructions from the target. This is correct + if the branch is not taken. Since we are following both + paths from the branch, we must also compute correct info + if the branch is taken. We do this by inverting all of + the INSN_FROM_TARGET_P bits, calling mark_set_resources, + and then inverting the INSN_FROM_TARGET_P bits again. */ + + if (GET_CODE (PATTERN (insn)) == SEQUENCE + && INSN_ANNULLED_BRANCH_P (this_jump_insn)) + { + for (i = 1; i < XVECLEN (PATTERN (insn), 0); i++) + INSN_FROM_TARGET_P (XVECEXP (PATTERN (insn), 0, i)) + = ! INSN_FROM_TARGET_P (XVECEXP (PATTERN (insn), 0, i)); + + target_set = set; + mark_set_resources (insn, &target_set, 0, 1); + + for (i = 1; i < XVECLEN (PATTERN (insn), 0); i++) + INSN_FROM_TARGET_P (XVECEXP (PATTERN (insn), 0, i)) + = ! INSN_FROM_TARGET_P (XVECEXP (PATTERN (insn), 0, i)); + + mark_set_resources (insn, &set, 0, 1); + } + else + { + mark_set_resources (insn, &set, 0, 1); + target_set = set; + } + + target_res = *res; + COPY_HARD_REG_SET (scratch, target_set.regs); + AND_COMPL_HARD_REG_SET (scratch, needed.regs); + AND_COMPL_HARD_REG_SET (target_res.regs, scratch); + + fallthrough_res = *res; + COPY_HARD_REG_SET (scratch, set.regs); + AND_COMPL_HARD_REG_SET (scratch, needed.regs); + AND_COMPL_HARD_REG_SET (fallthrough_res.regs, scratch); + + find_dead_or_set_registers (JUMP_LABEL (this_jump_insn), + &target_res, 0, jump_count, + target_set, needed); + find_dead_or_set_registers (next, + &fallthrough_res, 0, jump_count, + set, needed); + IOR_HARD_REG_SET (fallthrough_res.regs, target_res.regs); + AND_HARD_REG_SET (res->regs, fallthrough_res.regs); + break; + } + else + break; + } + else + { + /* Don't try this optimization if we expired our jump count + above, since that would mean there may be an infinite loop + in the function being compiled. */ + jump_insn = 0; + break; + } + } + + mark_referenced_resources (insn, &needed, 1); + mark_set_resources (insn, &set, 0, 1); + + COPY_HARD_REG_SET (scratch, set.regs); + AND_COMPL_HARD_REG_SET (scratch, needed.regs); + AND_COMPL_HARD_REG_SET (res->regs, scratch); + } + + return jump_insn; +} + +/* Given X, a part of an insn, and a pointer to a `struct resource', + RES, indicate which resources are modified by the insn. If + INCLUDE_DELAYED_EFFECTS is nonzero, also mark resources potentially + set by the called routine. + + If IN_DEST is nonzero, it means we are inside a SET. Otherwise, + objects are being referenced instead of set. + + We never mark the insn as modifying the condition code unless it explicitly + SETs CC0 even though this is not totally correct. The reason for this is + that we require a SET of CC0 to immediately precede the reference to CC0. + So if some other insn sets CC0 as a side-effect, we know it cannot affect + our computation and thus may be placed in a delay slot. */ + +void +mark_set_resources (x, res, in_dest, include_delayed_effects) + register rtx x; + register struct resources *res; + int in_dest; + int include_delayed_effects; +{ + register enum rtx_code code; + register int i, j; + register char *format_ptr; + + restart: + + code = GET_CODE (x); + + switch (code) + { + case NOTE: + case BARRIER: + case CODE_LABEL: + case USE: + case CONST_INT: + case CONST_DOUBLE: + case LABEL_REF: + case SYMBOL_REF: + case CONST: + case PC: + /* These don't set any resources. */ + return; + + case CC0: + if (in_dest) + res->cc = 1; + return; + + case CALL_INSN: + /* Called routine modifies the condition code, memory, any registers + that aren't saved across calls, global registers and anything + explicitly CLOBBERed immediately after the CALL_INSN. */ + + if (include_delayed_effects) + { + rtx next = NEXT_INSN (x); + rtx prev = PREV_INSN (x); + rtx link; + + res->cc = res->memory = 1; + for (i = 0; i < FIRST_PSEUDO_REGISTER; i++) + if (call_used_regs[i] || global_regs[i]) + SET_HARD_REG_BIT (res->regs, i); + + /* If X is part of a delay slot sequence, then NEXT should be + the first insn after the sequence. */ + if (NEXT_INSN (prev) != x) + next = NEXT_INSN (NEXT_INSN (prev)); + + for (link = CALL_INSN_FUNCTION_USAGE (x); + link; link = XEXP (link, 1)) + if (GET_CODE (XEXP (link, 0)) == CLOBBER) + mark_set_resources (SET_DEST (XEXP (link, 0)), res, 1, 0); + + /* Check for a NOTE_INSN_SETJMP. If it exists, then we must + assume that this call can clobber any register. */ + if (next && GET_CODE (next) == NOTE + && NOTE_LINE_NUMBER (next) == NOTE_INSN_SETJMP) + SET_HARD_REG_SET (res->regs); + } + + /* ... and also what its RTL says it modifies, if anything. */ + + case JUMP_INSN: + case INSN: + + /* An insn consisting of just a CLOBBER (or USE) is just for flow + and doesn't actually do anything, so we ignore it. */ + +#ifdef INSN_SETS_ARE_DELAYED + if (! include_delayed_effects + && INSN_SETS_ARE_DELAYED (x)) + return; +#endif + + x = PATTERN (x); + if (GET_CODE (x) != USE && GET_CODE (x) != CLOBBER) + goto restart; + return; + + case SET: + /* If the source of a SET is a CALL, this is actually done by + the called routine. So only include it if we are to include the + effects of the calling routine. */ + + mark_set_resources (SET_DEST (x), res, + (include_delayed_effects + || GET_CODE (SET_SRC (x)) != CALL), + 0); + + mark_set_resources (SET_SRC (x), res, 0, 0); + return; + + case CLOBBER: + mark_set_resources (XEXP (x, 0), res, 1, 0); + return; + + case SEQUENCE: + for (i = 0; i < XVECLEN (x, 0); i++) + if (! (INSN_ANNULLED_BRANCH_P (XVECEXP (x, 0, 0)) + && INSN_FROM_TARGET_P (XVECEXP (x, 0, i)))) + mark_set_resources (XVECEXP (x, 0, i), res, 0, + include_delayed_effects); + return; + + case POST_INC: + case PRE_INC: + case POST_DEC: + case PRE_DEC: + mark_set_resources (XEXP (x, 0), res, 1, 0); + return; + + case ZERO_EXTRACT: + mark_set_resources (XEXP (x, 0), res, in_dest, 0); + mark_set_resources (XEXP (x, 1), res, 0, 0); + mark_set_resources (XEXP (x, 2), res, 0, 0); + return; + + case MEM: + if (in_dest) + { + res->memory = 1; + res->unch_memory = RTX_UNCHANGING_P (x); + res->volatil = MEM_VOLATILE_P (x); + } + + mark_set_resources (XEXP (x, 0), res, 0, 0); + return; + + case SUBREG: + if (in_dest) + { + if (GET_CODE (SUBREG_REG (x)) != REG) + mark_set_resources (SUBREG_REG (x), res, + in_dest, include_delayed_effects); + else + { + int regno = REGNO (SUBREG_REG (x)) + SUBREG_WORD (x); + int last_regno = regno + HARD_REGNO_NREGS (regno, GET_MODE (x)); + for (i = regno; i < last_regno; i++) + SET_HARD_REG_BIT (res->regs, i); + } + } + return; + + case REG: + if (in_dest) + for (i = 0; i < HARD_REGNO_NREGS (REGNO (x), GET_MODE (x)); i++) + SET_HARD_REG_BIT (res->regs, REGNO (x) + i); + return; + + default: + break; + } + + /* Process each sub-expression and flag what it needs. */ + format_ptr = GET_RTX_FORMAT (code); + for (i = 0; i < GET_RTX_LENGTH (code); i++) + switch (*format_ptr++) + { + case 'e': + mark_set_resources (XEXP (x, i), res, in_dest, include_delayed_effects); + break; + + case 'E': + for (j = 0; j < XVECLEN (x, i); j++) + mark_set_resources (XVECEXP (x, i, j), res, in_dest, + include_delayed_effects); + break; + } +} + +/* Set the resources that are live at TARGET. + + If TARGET is zero, we refer to the end of the current function and can + return our precomputed value. + + Otherwise, we try to find out what is live by consulting the basic block + information. This is tricky, because we must consider the actions of + reload and jump optimization, which occur after the basic block information + has been computed. + + Accordingly, we proceed as follows:: + + We find the previous BARRIER and look at all immediately following labels + (with no intervening active insns) to see if any of them start a basic + block. If we hit the start of the function first, we use block 0. + + Once we have found a basic block and a corresponding first insns, we can + accurately compute the live status from basic_block_live_regs and + reg_renumber. (By starting at a label following a BARRIER, we are immune + to actions taken by reload and jump.) Then we scan all insns between + that point and our target. For each CLOBBER (or for call-clobbered regs + when we pass a CALL_INSN), mark the appropriate registers are dead. For + a SET, mark them as live. + + We have to be careful when using REG_DEAD notes because they are not + updated by such things as find_equiv_reg. So keep track of registers + marked as dead that haven't been assigned to, and mark them dead at the + next CODE_LABEL since reload and jump won't propagate values across labels. + + If we cannot find the start of a basic block (should be a very rare + case, if it can happen at all), mark everything as potentially live. + + Next, scan forward from TARGET looking for things set or clobbered + before they are used. These are not live. + + Because we can be called many times on the same target, save our results + in a hash table indexed by INSN_UID. This is only done if the function + init_resource_info () was invoked before we are called. */ + +void +mark_target_live_regs (insns, target, res) + rtx insns; + rtx target; + struct resources *res; +{ + int b = -1; + int i; + struct target_info *tinfo = NULL; + rtx insn; + rtx jump_insn = 0; + rtx jump_target; + HARD_REG_SET scratch; + struct resources set, needed; + + /* Handle end of function. */ + if (target == 0) + { + *res = end_of_function_needs; + return; + } + + /* We have to assume memory is needed, but the CC isn't. */ + res->memory = 1; + res->volatil = res->unch_memory = 0; + res->cc = 0; + + /* See if we have computed this value already. */ + if (target_hash_table != NULL) + { + for (tinfo = target_hash_table[INSN_UID (target) % TARGET_HASH_PRIME]; + tinfo; tinfo = tinfo->next) + if (tinfo->uid == INSN_UID (target)) + break; + + /* Start by getting the basic block number. If we have saved + information, we can get it from there unless the insn at the + start of the basic block has been deleted. */ + if (tinfo && tinfo->block != -1 + && ! INSN_DELETED_P (BLOCK_HEAD (tinfo->block))) + b = tinfo->block; + } + + if (b == -1) + b = find_basic_block (target); + + if (target_hash_table != NULL) + { + if (tinfo) + { + /* If the information is up-to-date, use it. Otherwise, we will + update it below. */ + if (b == tinfo->block && b != -1 && tinfo->bb_tick == bb_ticks[b]) + { + COPY_HARD_REG_SET (res->regs, tinfo->live_regs); + return; + } + } + else + { + /* Allocate a place to put our results and chain it into the + hash table. */ + tinfo = (struct target_info *) oballoc (sizeof (struct target_info)); + tinfo->uid = INSN_UID (target); + tinfo->block = b; + tinfo->next = target_hash_table[INSN_UID (target) % TARGET_HASH_PRIME]; + target_hash_table[INSN_UID (target) % TARGET_HASH_PRIME] = tinfo; + } + } + + CLEAR_HARD_REG_SET (pending_dead_regs); + + /* If we found a basic block, get the live registers from it and update + them with anything set or killed between its start and the insn before + TARGET. Otherwise, we must assume everything is live. */ + if (b != -1) + { + regset regs_live = BASIC_BLOCK (b)->global_live_at_start; + int j; + int regno; + rtx start_insn, stop_insn; + + /* Compute hard regs live at start of block -- this is the real hard regs + marked live, plus live pseudo regs that have been renumbered to + hard regs. */ + + REG_SET_TO_HARD_REG_SET (current_live_regs, regs_live); + + EXECUTE_IF_SET_IN_REG_SET + (regs_live, FIRST_PSEUDO_REGISTER, i, + { + if ((regno = reg_renumber[i]) >= 0) + for (j = regno; + j < regno + HARD_REGNO_NREGS (regno, + PSEUDO_REGNO_MODE (i)); + j++) + SET_HARD_REG_BIT (current_live_regs, j); + }); + + /* Get starting and ending insn, handling the case where each might + be a SEQUENCE. */ + start_insn = (b == 0 ? insns : BLOCK_HEAD (b)); + stop_insn = target; + + if (GET_CODE (start_insn) == INSN + && GET_CODE (PATTERN (start_insn)) == SEQUENCE) + start_insn = XVECEXP (PATTERN (start_insn), 0, 0); + + if (GET_CODE (stop_insn) == INSN + && GET_CODE (PATTERN (stop_insn)) == SEQUENCE) + stop_insn = next_insn (PREV_INSN (stop_insn)); + + for (insn = start_insn; insn != stop_insn; + insn = next_insn_no_annul (insn)) + { + rtx link; + rtx real_insn = insn; + + /* If this insn is from the target of a branch, it isn't going to + be used in the sequel. If it is used in both cases, this + test will not be true. */ + if (INSN_FROM_TARGET_P (insn)) + continue; + + /* If this insn is a USE made by update_block, we care about the + underlying insn. */ + if (GET_CODE (insn) == INSN && GET_CODE (PATTERN (insn)) == USE + && GET_RTX_CLASS (GET_CODE (XEXP (PATTERN (insn), 0))) == 'i') + real_insn = XEXP (PATTERN (insn), 0); + + if (GET_CODE (real_insn) == CALL_INSN) + { + /* CALL clobbers all call-used regs that aren't fixed except + sp, ap, and fp. Do this before setting the result of the + call live. */ + for (i = 0; i < FIRST_PSEUDO_REGISTER; i++) + if (call_used_regs[i] + && i != STACK_POINTER_REGNUM && i != FRAME_POINTER_REGNUM + && i != ARG_POINTER_REGNUM +#if HARD_FRAME_POINTER_REGNUM != FRAME_POINTER_REGNUM + && i != HARD_FRAME_POINTER_REGNUM +#endif +#if ARG_POINTER_REGNUM != FRAME_POINTER_REGNUM + && ! (i == ARG_POINTER_REGNUM && fixed_regs[i]) +#endif +#ifdef PIC_OFFSET_TABLE_REGNUM + && ! (i == PIC_OFFSET_TABLE_REGNUM && flag_pic) +#endif + ) + CLEAR_HARD_REG_BIT (current_live_regs, i); + + /* A CALL_INSN sets any global register live, since it may + have been modified by the call. */ + for (i = 0; i < FIRST_PSEUDO_REGISTER; i++) + if (global_regs[i]) + SET_HARD_REG_BIT (current_live_regs, i); + } + + /* Mark anything killed in an insn to be deadened at the next + label. Ignore USE insns; the only REG_DEAD notes will be for + parameters. But they might be early. A CALL_INSN will usually + clobber registers used for parameters. It isn't worth bothering + with the unlikely case when it won't. */ + if ((GET_CODE (real_insn) == INSN + && GET_CODE (PATTERN (real_insn)) != USE + && GET_CODE (PATTERN (real_insn)) != CLOBBER) + || GET_CODE (real_insn) == JUMP_INSN + || GET_CODE (real_insn) == CALL_INSN) + { + for (link = REG_NOTES (real_insn); link; link = XEXP (link, 1)) + if (REG_NOTE_KIND (link) == REG_DEAD + && GET_CODE (XEXP (link, 0)) == REG + && REGNO (XEXP (link, 0)) < FIRST_PSEUDO_REGISTER) + { + int first_regno = REGNO (XEXP (link, 0)); + int last_regno + = (first_regno + + HARD_REGNO_NREGS (first_regno, + GET_MODE (XEXP (link, 0)))); + + for (i = first_regno; i < last_regno; i++) + SET_HARD_REG_BIT (pending_dead_regs, i); + } + + note_stores (PATTERN (real_insn), update_live_status); + + /* If any registers were unused after this insn, kill them. + These notes will always be accurate. */ + for (link = REG_NOTES (real_insn); link; link = XEXP (link, 1)) + if (REG_NOTE_KIND (link) == REG_UNUSED + && GET_CODE (XEXP (link, 0)) == REG + && REGNO (XEXP (link, 0)) < FIRST_PSEUDO_REGISTER) + { + int first_regno = REGNO (XEXP (link, 0)); + int last_regno + = (first_regno + + HARD_REGNO_NREGS (first_regno, + GET_MODE (XEXP (link, 0)))); + + for (i = first_regno; i < last_regno; i++) + CLEAR_HARD_REG_BIT (current_live_regs, i); + } + } + + else if (GET_CODE (real_insn) == CODE_LABEL) + { + /* A label clobbers the pending dead registers since neither + reload nor jump will propagate a value across a label. */ + AND_COMPL_HARD_REG_SET (current_live_regs, pending_dead_regs); + CLEAR_HARD_REG_SET (pending_dead_regs); + } + + /* The beginning of the epilogue corresponds to the end of the + RTL chain when there are no epilogue insns. Certain resources + are implicitly required at that point. */ + else if (GET_CODE (real_insn) == NOTE + && NOTE_LINE_NUMBER (real_insn) == NOTE_INSN_EPILOGUE_BEG) + IOR_HARD_REG_SET (current_live_regs, start_of_epilogue_needs.regs); + } + + COPY_HARD_REG_SET (res->regs, current_live_regs); + if (tinfo != NULL) + { + tinfo->block = b; + tinfo->bb_tick = bb_ticks[b]; + } + } + else + /* We didn't find the start of a basic block. Assume everything + in use. This should happen only extremely rarely. */ + SET_HARD_REG_SET (res->regs); + + CLEAR_RESOURCE (&set); + CLEAR_RESOURCE (&needed); + + jump_insn = find_dead_or_set_registers (target, res, &jump_target, 0, + set, needed); + + /* If we hit an unconditional branch, we have another way of finding out + what is live: we can see what is live at the branch target and include + anything used but not set before the branch. The only things that are + live are those that are live using the above test and the test below. */ + + if (jump_insn) + { + struct resources new_resources; + rtx stop_insn = next_active_insn (jump_insn); + + mark_target_live_regs (insns, next_active_insn (jump_target), + &new_resources); + CLEAR_RESOURCE (&set); + CLEAR_RESOURCE (&needed); + + /* Include JUMP_INSN in the needed registers. */ + for (insn = target; insn != stop_insn; insn = next_active_insn (insn)) + { + mark_referenced_resources (insn, &needed, 1); + + COPY_HARD_REG_SET (scratch, needed.regs); + AND_COMPL_HARD_REG_SET (scratch, set.regs); + IOR_HARD_REG_SET (new_resources.regs, scratch); + + mark_set_resources (insn, &set, 0, 1); + } + + AND_HARD_REG_SET (res->regs, new_resources.regs); + } + + if (tinfo != NULL) + { + COPY_HARD_REG_SET (tinfo->live_regs, res->regs); + } +} + +/* Initialize the resources required by mark_target_live_regs (). + This should be invoked before the first call to mark_target_live_regs. */ + +void +init_resource_info (epilogue_insn) + rtx epilogue_insn; +{ + int i; + + /* Indicate what resources are required to be valid at the end of the current + function. The condition code never is and memory always is. If the + frame pointer is needed, it is and so is the stack pointer unless + EXIT_IGNORE_STACK is non-zero. If the frame pointer is not needed, the + stack pointer is. Registers used to return the function value are + needed. Registers holding global variables are needed. */ + + end_of_function_needs.cc = 0; + end_of_function_needs.memory = 1; + end_of_function_needs.unch_memory = 0; + CLEAR_HARD_REG_SET (end_of_function_needs.regs); + + if (frame_pointer_needed) + { + SET_HARD_REG_BIT (end_of_function_needs.regs, FRAME_POINTER_REGNUM); +#if HARD_FRAME_POINTER_REGNUM != FRAME_POINTER_REGNUM + SET_HARD_REG_BIT (end_of_function_needs.regs, HARD_FRAME_POINTER_REGNUM); +#endif +#ifdef EXIT_IGNORE_STACK + if (! EXIT_IGNORE_STACK + || current_function_sp_is_unchanging) +#endif + SET_HARD_REG_BIT (end_of_function_needs.regs, STACK_POINTER_REGNUM); + } + else + SET_HARD_REG_BIT (end_of_function_needs.regs, STACK_POINTER_REGNUM); + + if (current_function_return_rtx != 0) + mark_referenced_resources (current_function_return_rtx, + &end_of_function_needs, 1); + + for (i = 0; i < FIRST_PSEUDO_REGISTER; i++) + if (global_regs[i] +#ifdef EPILOGUE_USES + || EPILOGUE_USES (i) +#endif + ) + SET_HARD_REG_BIT (end_of_function_needs.regs, i); + + /* The registers required to be live at the end of the function are + represented in the flow information as being dead just prior to + reaching the end of the function. For example, the return of a value + might be represented by a USE of the return register immediately + followed by an unconditional jump to the return label where the + return label is the end of the RTL chain. The end of the RTL chain + is then taken to mean that the return register is live. + + This sequence is no longer maintained when epilogue instructions are + added to the RTL chain. To reconstruct the original meaning, the + start of the epilogue (NOTE_INSN_EPILOGUE_BEG) is regarded as the + point where these registers become live (start_of_epilogue_needs). + If epilogue instructions are present, the registers set by those + instructions won't have been processed by flow. Thus, those + registers are additionally required at the end of the RTL chain + (end_of_function_needs). */ + + start_of_epilogue_needs = end_of_function_needs; + + while ((epilogue_insn = next_nonnote_insn (epilogue_insn))) + mark_set_resources (epilogue_insn, &end_of_function_needs, 0, 1); + + /* Allocate and initialize the tables used by mark_target_live_regs. */ + target_hash_table + = (struct target_info **) xmalloc ((TARGET_HASH_PRIME + * sizeof (struct target_info *))); + bzero ((char *) target_hash_table, + TARGET_HASH_PRIME * sizeof (struct target_info *)); + + bb_ticks = (int *) xmalloc (n_basic_blocks * sizeof (int)); + bzero ((char *) bb_ticks, n_basic_blocks * sizeof (int)); +} + +/* Free up the resources allcated to mark_target_live_regs (). This + should be invoked after the last call to mark_target_live_regs (). */ + +void +free_resource_info () +{ + if (target_hash_table != NULL) + { + free (target_hash_table); + target_hash_table = NULL; + } + + if (bb_ticks != NULL) + { + free (bb_ticks); + bb_ticks = NULL; + } +} + +/* Clear any hashed information that we have stored for INSN. */ + +void +clear_hashed_info_for_insn (insn) + rtx insn; +{ + struct target_info *tinfo; + + if (target_hash_table != NULL) + { + for (tinfo = target_hash_table[INSN_UID (insn) % TARGET_HASH_PRIME]; + tinfo; tinfo = tinfo->next) + if (tinfo->uid == INSN_UID (insn)) + break; + + if (tinfo) + tinfo->block = -1; + } +} + +/* Increment the tick count for the basic block that contains INSN. */ + +void +incr_ticks_for_insn (insn) + rtx insn; +{ + int b = find_basic_block (insn); + + if (b != -1) + bb_ticks[b]++; +} + +/* Add TRIAL to the set of resources used at the end of the current + function. */ +void +mark_end_of_function_resources (trial, include_delayed_effects) + rtx trial; + int include_delayed_effects; +{ + mark_referenced_resources (trial, &end_of_function_needs, + include_delayed_effects); +} + +/* Try to find an available hard register of mode MODE at + CURRENT_INSN, matching the register class in CLASS_STR. Registers + that already have bits set in REG_SET will not be considered. + + If an appropriate register is available, it will be returned and the + corresponding bit(s) in REG_SET will be set; otherwise, NULL_RTX is + returned. */ + +rtx +find_free_register (current_insn, class_str, mode, reg_set) + rtx current_insn; + char *class_str; + int mode; + HARD_REG_SET *reg_set; +{ + int i, j; + struct resources used; + unsigned char clet = class_str[0]; + enum reg_class class + = (clet == 'r' ? GENERAL_REGS : REG_CLASS_FROM_LETTER (clet)); + + mark_target_live_regs (get_insns (), current_insn, &used); + + for (i = 0; i < FIRST_PSEUDO_REGISTER; i++) + { + int success = 1; + + if (! TEST_HARD_REG_BIT (reg_class_contents[class], i)) + continue; + for (j = HARD_REGNO_NREGS (i, mode) - 1; j >= 0; j--) + { + if (TEST_HARD_REG_BIT (*reg_set, i + j) + || TEST_HARD_REG_BIT (used.regs, i + j)) + { + success = 0; + break; + } + } + if (success) + { + for (j = HARD_REGNO_NREGS (i, mode) - 1; j >= 0; j--) + { + SET_HARD_REG_BIT (*reg_set, i + j); + } + return gen_rtx_REG (mode, i); + } + } + return NULL_RTX; +} diff --git a/gcc/resource.h b/gcc/resource.h new file mode 100644 index 00000000000..d3a8e2c7088 --- /dev/null +++ b/gcc/resource.h @@ -0,0 +1,46 @@ +/* Definitions for computing resource usage of specific insns. + Copyright (C) 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. */ + +/* Macro to clear all resources. */ +#define CLEAR_RESOURCE(RES) \ + do { (RES)->memory = (RES)->unch_memory = (RES)->volatil = (RES)->cc = 0; \ + CLEAR_HARD_REG_SET ((RES)->regs); } while (0) + +/* The resources used by a given insn. */ +struct resources +{ + char memory; /* Insn sets or needs a memory location. */ + char unch_memory; /* Insn sets of needs a "unchanging" MEM. */ + char volatil; /* Insn sets or needs a volatile memory loc. */ + char cc; /* Insn sets or needs the condition codes. */ + HARD_REG_SET regs; /* Which registers are set or needed. */ +}; + +extern void mark_target_live_regs PROTO((rtx, rtx, struct resources *)); +extern void mark_set_resources PROTO((rtx, struct resources *, int, + int)); +extern void mark_referenced_resources PROTO((rtx, struct resources *, int)); +extern void clear_hashed_info_for_insn PROTO((rtx)); +extern void incr_ticks_for_insn PROTO((rtx)); +extern void mark_end_of_function_resources PROTO ((rtx, int)); +extern void init_resource_info PROTO((rtx)); +extern void free_resource_info PROTO((void)); +extern rtx find_free_register PROTO((rtx, char *, int, + HARD_REG_SET *)); diff --git a/gcc/sbitmap.c b/gcc/sbitmap.c new file mode 100644 index 00000000000..2a417922300 --- /dev/null +++ b/gcc/sbitmap.c @@ -0,0 +1,470 @@ +/* Simple bitmaps. + Copyright (C) 1999 Free Software Foundation, Inc. + +This file is part of GNU CC. + +GNU CC is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU CC is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU CC; see the file COPYING. If not, write to +the Free Software Foundation, 59 Temple Place - Suite 330, +Boston, MA 02111-1307, USA. */ + +#include "config.h" +#include "system.h" +#include "rtl.h" +#include "flags.h" +#include "basic-block.h" + +/* Bitmap manipulation routines. */ + +/* Allocate a simple bitmap of N_ELMS bits. */ + +sbitmap +sbitmap_alloc (n_elms) + int n_elms; +{ + int bytes, size, amt; + sbitmap bmap; + + size = SBITMAP_SET_SIZE (n_elms); + bytes = size * sizeof (SBITMAP_ELT_TYPE); + amt = (sizeof (struct simple_bitmap_def) + + bytes - sizeof (SBITMAP_ELT_TYPE)); + bmap = (sbitmap) xmalloc (amt); + bmap->n_bits = n_elms; + bmap->size = size; + bmap->bytes = bytes; + return bmap; +} + +/* Allocate a vector of N_VECS bitmaps of N_ELMS bits. */ + +sbitmap * +sbitmap_vector_alloc (n_vecs, n_elms) + int n_vecs, n_elms; +{ + int i, bytes, offset, elm_bytes, size, amt, vector_bytes; + sbitmap *bitmap_vector; + + size = SBITMAP_SET_SIZE (n_elms); + bytes = size * sizeof (SBITMAP_ELT_TYPE); + elm_bytes = (sizeof (struct simple_bitmap_def) + + bytes - sizeof (SBITMAP_ELT_TYPE)); + vector_bytes = n_vecs * sizeof (sbitmap *); + + /* Round up `vector_bytes' to account for the alignment requirements + of an sbitmap. One could allocate the vector-table and set of sbitmaps + separately, but that requires maintaining two pointers or creating + a cover struct to hold both pointers (so our result is still just + one pointer). Neither is a bad idea, but this is simpler for now. */ + { + /* Based on DEFAULT_ALIGNMENT computation in obstack.c. */ + struct { char x; SBITMAP_ELT_TYPE y; } align; + int alignment = (char *) & align.y - & align.x; + vector_bytes = (vector_bytes + alignment - 1) & ~ (alignment - 1); + } + + amt = vector_bytes + (n_vecs * elm_bytes); + bitmap_vector = (sbitmap *) xmalloc (amt); + + for (i = 0, offset = vector_bytes; + i < n_vecs; + i++, offset += elm_bytes) + { + sbitmap b = (sbitmap) ((char *) bitmap_vector + offset); + bitmap_vector[i] = b; + b->n_bits = n_elms; + b->size = size; + b->bytes = bytes; + } + + return bitmap_vector; +} + +/* Copy sbitmap SRC to DST. */ + +void +sbitmap_copy (dst, src) + sbitmap dst, src; +{ + bcopy ((PTR) src->elms, (PTR) dst->elms, + sizeof (SBITMAP_ELT_TYPE) * dst->size); +} + +/* Zero all elements in a bitmap. */ + +void +sbitmap_zero (bmap) + sbitmap bmap; +{ + bzero ((char *) bmap->elms, bmap->bytes); +} + +/* Set to ones all elements in a bitmap. */ + +void +sbitmap_ones (bmap) + sbitmap bmap; +{ + memset (bmap->elms, -1, bmap->bytes); +} + +/* Zero a vector of N_VECS bitmaps. */ + +void +sbitmap_vector_zero (bmap, n_vecs) + sbitmap *bmap; + int n_vecs; +{ + int i; + + for (i = 0; i < n_vecs; i++) + sbitmap_zero (bmap[i]); +} + +/* Set to ones a vector of N_VECS bitmaps. */ + +void +sbitmap_vector_ones (bmap, n_vecs) + sbitmap *bmap; + int n_vecs; +{ + int i; + + for (i = 0; i < n_vecs; i++) + sbitmap_ones (bmap[i]); +} + +/* Set DST to be A union (B - C). + DST = A | (B & ~C). + Return non-zero if any change is made. */ + +int +sbitmap_union_of_diff (dst, a, b, c) + sbitmap dst, a, b, c; +{ + int i,changed; + sbitmap_ptr dstp, ap, bp, cp; + + changed = 0; + dstp = dst->elms; + ap = a->elms; + bp = b->elms; + cp = c->elms; + for (i = 0; i < dst->size; i++) + { + SBITMAP_ELT_TYPE tmp = *ap | (*bp & ~*cp); + if (*dstp != tmp) + changed = 1; + *dstp = tmp; + dstp++; ap++; bp++; cp++; + } + return changed; +} + +/* Set bitmap DST to the bitwise negation of the bitmap SRC. */ + +void +sbitmap_not (dst, src) + sbitmap dst, src; +{ + int i; + sbitmap_ptr dstp, ap; + + dstp = dst->elms; + ap = src->elms; + for (i = 0; i < dst->size; i++) + { + SBITMAP_ELT_TYPE tmp = ~(*ap); + *dstp = tmp; + dstp++; ap++; + } +} + +/* Set the bits in DST to be the difference between the bits + in A and the bits in B. i.e. dst = a - b. + The - operator is implemented as a & (~b). */ + +void +sbitmap_difference (dst, a, b) + sbitmap dst, a, b; +{ + int i; + sbitmap_ptr dstp, ap, bp; + + dstp = dst->elms; + ap = a->elms; + bp = b->elms; + for (i = 0; i < dst->size; i++) + *dstp++ = *ap++ & (~*bp++); +} + +/* Set DST to be (A and B)). + Return non-zero if any change is made. */ + +int +sbitmap_a_and_b (dst, a, b) + sbitmap dst, a, b; +{ + int i,changed; + sbitmap_ptr dstp, ap, bp; + + changed = 0; + dstp = dst->elms; + ap = a->elms; + bp = b->elms; + for (i = 0; i < dst->size; i++) + { + SBITMAP_ELT_TYPE tmp = *ap & *bp; + if (*dstp != tmp) + changed = 1; + *dstp = tmp; + dstp++; ap++; bp++; + } + return changed; +} +/* Set DST to be (A or B)). + Return non-zero if any change is made. */ + +int +sbitmap_a_or_b (dst, a, b) + sbitmap dst, a, b; +{ + int i,changed; + sbitmap_ptr dstp, ap, bp; + + changed = 0; + dstp = dst->elms; + ap = a->elms; + bp = b->elms; + for (i = 0; i < dst->size; i++) + { + SBITMAP_ELT_TYPE tmp = *ap | *bp; + if (*dstp != tmp) + changed = 1; + *dstp = tmp; + dstp++; ap++; bp++; + } + return changed; +} + +/* Set DST to be (A or (B and C)). + Return non-zero if any change is made. */ + +int +sbitmap_a_or_b_and_c (dst, a, b, c) + sbitmap dst, a, b, c; +{ + int i,changed; + sbitmap_ptr dstp, ap, bp, cp; + + changed = 0; + dstp = dst->elms; + ap = a->elms; + bp = b->elms; + cp = c->elms; + for (i = 0; i < dst->size; i++) + { + SBITMAP_ELT_TYPE tmp = *ap | (*bp & *cp); + if (*dstp != tmp) + changed = 1; + *dstp = tmp; + dstp++; ap++; bp++; cp++; + } + return changed; +} + +/* Set DST to be (A ann (B or C)). + Return non-zero if any change is made. */ + +int +sbitmap_a_and_b_or_c (dst, a, b, c) + sbitmap dst, a, b, c; +{ + int i,changed; + sbitmap_ptr dstp, ap, bp, cp; + + changed = 0; + dstp = dst->elms; + ap = a->elms; + bp = b->elms; + cp = c->elms; + for (i = 0; i < dst->size; i++) + { + SBITMAP_ELT_TYPE tmp = *ap & (*bp | *cp); + if (*dstp != tmp) + changed = 1; + *dstp = tmp; + dstp++; ap++; bp++; cp++; + } + return changed; +} + +/* Set the bitmap DST to the intersection of SRC of all predecessors or + successors of block number BB (PRED_SUCC says which). */ + +void +sbitmap_intersect_of_predsucc (dst, src, bb, pred_succ) + sbitmap dst; + sbitmap *src; + int bb; + int_list_ptr *pred_succ; +{ + int_list_ptr ps; + int ps_bb; + int set_size = dst->size; + + ps = pred_succ[bb]; + + /* It is possible that there are no predecessors(/successors). + This can happen for example in unreachable code. */ + + if (ps == NULL) + { + /* In APL-speak this is the `and' reduction of the empty set and thus + the result is the identity for `and'. */ + sbitmap_ones (dst); + return; + } + + /* Set result to first predecessor/successor. */ + + for ( ; ps != NULL; ps = ps->next) + { + ps_bb = INT_LIST_VAL (ps); + if (ps_bb == ENTRY_BLOCK || ps_bb == EXIT_BLOCK) + continue; + sbitmap_copy (dst, src[ps_bb]); + /* Break out since we're only doing first predecessor. */ + break; + } + if (ps == NULL) + return; + + /* Now do the remaining predecessors/successors. */ + + for (ps = ps->next; ps != NULL; ps = ps->next) + { + int i; + sbitmap_ptr p,r; + + ps_bb = INT_LIST_VAL (ps); + if (ps_bb == ENTRY_BLOCK || ps_bb == EXIT_BLOCK) + continue; + + p = src[ps_bb]->elms; + r = dst->elms; + + for (i = 0; i < set_size; i++) + *r++ &= *p++; + } +} + +/* Set the bitmap DST to the union of SRC of all predecessors/successors of + block number BB. */ + +void +sbitmap_union_of_predsucc (dst, src, bb, pred_succ) + sbitmap dst; + sbitmap *src; + int bb; + int_list_ptr *pred_succ; +{ + int_list_ptr ps; + int ps_bb; + int set_size = dst->size; + + ps = pred_succ[bb]; + + /* It is possible that there are no predecessors(/successors). + This can happen for example in unreachable code. */ + + if (ps == NULL) + { + /* In APL-speak this is the `or' reduction of the empty set and thus + the result is the identity for `or'. */ + sbitmap_zero (dst); + return; + } + + /* Set result to first predecessor/successor. */ + + for ( ; ps != NULL; ps = ps->next) + { + ps_bb = INT_LIST_VAL (ps); + if (ps_bb == ENTRY_BLOCK || ps_bb == EXIT_BLOCK) + continue; + sbitmap_copy (dst, src[ps_bb]); + /* Break out since we're only doing first predecessor. */ + break; + } + if (ps == NULL) + return; + + /* Now do the remaining predecessors/successors. */ + + for (ps = ps->next; ps != NULL; ps = ps->next) + { + int i; + sbitmap_ptr p,r; + + ps_bb = INT_LIST_VAL (ps); + if (ps_bb == ENTRY_BLOCK || ps_bb == EXIT_BLOCK) + continue; + + p = src[ps_bb]->elms; + r = dst->elms; + + for (i = 0; i < set_size; i++) + *r++ |= *p++; + } +} + +void +dump_sbitmap (file, bmap) + FILE *file; + sbitmap bmap; +{ + int i,j,n; + int set_size = bmap->size; + int total_bits = bmap->n_bits; + + fprintf (file, " "); + for (i = n = 0; i < set_size && n < total_bits; i++) + { + for (j = 0; j < SBITMAP_ELT_BITS && n < total_bits; j++, n++) + { + if (n != 0 && n % 10 == 0) + fprintf (file, " "); + fprintf (file, "%d", (bmap->elms[i] & (1L << j)) != 0); + } + } + fprintf (file, "\n"); +} + +void +dump_sbitmap_vector (file, title, subtitle, bmaps, n_maps) + FILE *file; + const char *title, *subtitle; + sbitmap *bmaps; + int n_maps; +{ + int bb; + + fprintf (file, "%s\n", title); + for (bb = 0; bb < n_maps; bb++) + { + fprintf (file, "%s %d\n", subtitle, bb); + dump_sbitmap (file, bmaps[bb]); + } + fprintf (file, "\n"); +} diff --git a/gcc/sbitmap.h b/gcc/sbitmap.h new file mode 100644 index 00000000000..ca475fa756c --- /dev/null +++ b/gcc/sbitmap.h @@ -0,0 +1,122 @@ +/* Simple bitmaps. + Copyright (C) 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. */ + +/* It's not clear yet whether using bitmap.[ch] will be a win. + It should be straightforward to convert so for now we keep things simple + while more important issues are dealt with. */ + +#define SBITMAP_ELT_BITS HOST_BITS_PER_WIDE_INT +#define SBITMAP_ELT_TYPE unsigned HOST_WIDE_INT + +typedef struct simple_bitmap_def { + /* Number of bits. */ + int n_bits; + /* Size in elements. */ + int size; + /* Size in bytes. */ + int bytes; + /* The elements. */ + SBITMAP_ELT_TYPE elms[1]; +} *sbitmap; + +typedef SBITMAP_ELT_TYPE *sbitmap_ptr; + +/* Return the set size needed for N elements. */ +#define SBITMAP_SET_SIZE(n) (((n) + SBITMAP_ELT_BITS - 1) / SBITMAP_ELT_BITS) + +/* set bit number bitno in the bitmap */ +#define SET_BIT(bitmap, bitno) \ + ((bitmap)->elms [(bitno) / SBITMAP_ELT_BITS] \ + |= (SBITMAP_ELT_TYPE) 1 << (bitno) % SBITMAP_ELT_BITS) + +/* test if bit number bitno in the bitmap is set */ +#define TEST_BIT(bitmap, bitno) \ +((bitmap)->elms [(bitno) / SBITMAP_ELT_BITS] >> (bitno) % SBITMAP_ELT_BITS & 1) + +/* reset bit number bitno in the bitmap */ +#define RESET_BIT(bitmap, bitno) \ + ((bitmap)->elms [(bitno) / SBITMAP_ELT_BITS] \ + &= ~((SBITMAP_ELT_TYPE) 1 << (bitno) % SBITMAP_ELT_BITS)) + +/* Loop over all elements of SBITSET, starting with MIN. */ +#define EXECUTE_IF_SET_IN_SBITMAP(SBITMAP, MIN, N, CODE) \ +do { \ + unsigned int bit_num_ = (MIN) % (unsigned) SBITMAP_ELT_BITS; \ + unsigned int word_num_ = (MIN) / (unsigned) SBITMAP_ELT_BITS; \ + unsigned int size_ = (SBITMAP)->size; \ + SBITMAP_ELT_TYPE *ptr_ = (SBITMAP)->elms; \ + \ + while (word_num_ < size_) \ + { \ + SBITMAP_ELT_TYPE word_ = ptr_[word_num_]; \ + if (word_ != 0) \ + { \ + for (; bit_num_ < SBITMAP_ELT_BITS; ++bit_num_) \ + { \ + SBITMAP_ELT_TYPE mask_ = (SBITMAP_ELT_TYPE)1 << bit_num_; \ + if ((word_ & mask_) != 0) \ + { \ + word_ &= ~mask_; \ + (N) = word_num_ * SBITMAP_ELT_BITS + bit_num_; \ + CODE; \ + if (word_ == 0) \ + break; \ + } \ + } \ + } \ + bit_num_ = 0; \ + word_num_++; \ + } \ +} while (0) + +#define sbitmap_free(map) free(map) +#define sbitmap_vector_free(vec) free(vec) + +extern void dump_sbitmap PROTO ((FILE *, sbitmap)); +extern void dump_sbitmap_vector PROTO ((FILE *, const char *, const char *, + sbitmap *, int)); + +extern sbitmap sbitmap_alloc PROTO ((int)); +extern sbitmap *sbitmap_vector_alloc PROTO ((int, int)); + +extern void sbitmap_copy PROTO ((sbitmap, sbitmap)); +extern void sbitmap_zero PROTO ((sbitmap)); +extern void sbitmap_ones PROTO ((sbitmap)); +extern void sbitmap_vector_zero PROTO ((sbitmap *, int)); +extern void sbitmap_vector_ones PROTO ((sbitmap *, int)); + +extern int sbitmap_union_of_diff PROTO ((sbitmap, sbitmap, sbitmap, sbitmap)); +extern void sbitmap_difference PROTO ((sbitmap, sbitmap, sbitmap)); +extern void sbitmap_not PROTO ((sbitmap, sbitmap)); +extern int sbitmap_a_or_b_and_c PROTO ((sbitmap, sbitmap, sbitmap, sbitmap)); +extern int sbitmap_a_and_b_or_c PROTO ((sbitmap, sbitmap, sbitmap, sbitmap)); +extern int sbitmap_a_and_b PROTO ((sbitmap, sbitmap, sbitmap)); +extern int sbitmap_a_or_b PROTO ((sbitmap, sbitmap, sbitmap)); + +struct int_list; +extern void sbitmap_intersect_of_predsucc PROTO ((sbitmap, sbitmap *, + int, struct int_list **)); +#define sbitmap_intersect_of_predecessors sbitmap_intersect_of_predsucc +#define sbitmap_intersect_of_successors sbitmap_intersect_of_predsucc + +extern void sbitmap_union_of_predsucc PROTO ((sbitmap, sbitmap *, int, + struct int_list **)); +#define sbitmap_union_of_predecessors sbitmap_union_of_predsucc +#define sbitmap_union_of_successors sbitmap_union_of_predsucc diff --git a/gcc/testsuite/README b/gcc/testsuite/README new file mode 100644 index 00000000000..2b336f5b29d --- /dev/null +++ b/gcc/testsuite/README @@ -0,0 +1,50 @@ +This is a collection of tests for the C and C++ frontends of EGCS. For +further information please check README.gcc and README.g++, though the +latter may not be up-to-date any more. + +The driver that runs this testsuite is called DejaGnu and you will +need a current DejaGnu snapshot, which is available from +ftp://egcs.cygnus.com/pub/egcs/infrastructure, for example. + +Most of these tests were originally developed and/or collected by +Cygnus Solutions, but these days many are being added by the EGCS +developers. + +These tests are included "as is". If any of them fails, do not report +a bug. Bug reports for DejaGnu can go to bug-dejagnu@prep.ai.mit.edu. +Discussion and comments about this testsuite should be sent to +egcs@egcs.cygnus.com; additions and changes to should go to sent to +egcs-patches@egcs.cygnus.com. + +The entire testsuite is invoked by `make check` at the top level of +the EGCS tree. `make check-g++` runs the C++ testsuite only. + + +STRUCTURE OF THE TESTSUITE + +Almost all C++ tests reside in subdirectories of g++.old-deja, based on +the following structure: + + g++.benjamin Tests by Benjamin Koz + g++.bob + g++.brendan Tests by Brendan Kehoe + g++.bugs + g++.eh Tests for exception handling + g++.ext Tests for g++ extensions + g++.gb Tests by Gerald Baumgartner + g++.jason Tests by Jason Merill + g++.jeff Tests by Jeffrey A Law + g++.martin Tests by Martin v. Löwis + g++.mike Tests by Mike Stump + g++.niklas Tests by Niklas Hallqvist + g++.ns Tests for namespaces + g++.other + g++.pt Tests for templates + g++.rfg + g++.robertl Tests from egcs-bugs@egcs.cygnus.com, gathered by Robert Lipe + +g++.old-deja uses a fixed driver for all g++ tests based on the old +DejaGnu drivers. But just because its old, doesn't mean its redundant! +Tests that want to use the normal dg.exp driver can be put in g++.dg instead. +This may be required for platform-specific tests, or tests with other +special requirements. diff --git a/gcc/testsuite/g++.old-deja/g++.benjamin/13478.C b/gcc/testsuite/g++.old-deja/g++.benjamin/13478.C new file mode 100644 index 00000000000..97256ed7643 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.benjamin/13478.C @@ -0,0 +1,36 @@ +// 981203 bkoz +// g++/13478 +// Build don't link: + +class A {}; +class AData {}; + +typedef void (A::* hand) (void); + +struct hand_table { + const int data1; + const hand data2; +}; + +class Agent : public A { +public: + enum { first = 1, last }; +protected: + static const hand_table table_1[]; + static const AData table_2; +private: + void foo (void); +}; + +const hand_table Agent::table_1[] = +{ + {0, &Agent::table_2}, + {first, &Agent::foo}, + {last, &(hand)Agent::foo} // ERROR - // ERROR - +}; // ERROR - // ERROR - + + + + + + diff --git a/gcc/testsuite/g++.old-deja/g++.benjamin/13523.C b/gcc/testsuite/g++.old-deja/g++.benjamin/13523.C new file mode 100644 index 00000000000..eca71fa2f7b --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.benjamin/13523.C @@ -0,0 +1,12 @@ +// 981203 bkoz +// g++/13523 +// Build don't link: + +template<typename T> class latin_america; + +class peru +{ + friend class latin_america<int>; // Particular template class friend works + template<class T> friend class latin_america; // This does not work. +}; + diff --git a/gcc/testsuite/g++.old-deja/g++.benjamin/13908.C b/gcc/testsuite/g++.old-deja/g++.benjamin/13908.C new file mode 100644 index 00000000000..403a9988dfd --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.benjamin/13908.C @@ -0,0 +1,21 @@ +// 981203 bkoz +// g++/13908 +// Build don't link: + +class chile +{ +public: +protected: +private: +}; + +typedef void (chile::* pmf) (); + +void* foo; + +void bar (chile* pobj, pmf pmethod) +{ + //-edg: expected member name + //-g++: taking address of bound pointer-to-member expression + foo = (void*) &(pobj->*pmethod); // ERROR - +} diff --git a/gcc/testsuite/g++.old-deja/g++.benjamin/14139.C b/gcc/testsuite/g++.old-deja/g++.benjamin/14139.C new file mode 100644 index 00000000000..dc0c5695f15 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.benjamin/14139.C @@ -0,0 +1,22 @@ +// 981203 bkoz +// g++/14309 +// test for global functions, mf's, and templatized mf's. +// Build don't link: + +static int fooe_1(void) { return 5; } +static int fooe_2(int x = fooe_1()) { return x; } + +struct antigua { + static int& foo_1(); + static int foo_2(int& x = antigua::foo_1()); + static int foo_3(int x = fooe_2()); +}; + +template <typename T> + struct jamacia { + static int& foo_1(); + static int foo_2(int& x = antigua::foo_1()); + static int foo_3(int x = fooe_2()); + }; + +template class jamacia<int>; diff --git a/gcc/testsuite/g++.old-deja/g++.benjamin/14664-1.C b/gcc/testsuite/g++.old-deja/g++.benjamin/14664-1.C new file mode 100644 index 00000000000..b5dc839f884 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.benjamin/14664-1.C @@ -0,0 +1,16 @@ +// 981203 bkoz +// g++/14664 - test +// Build don't link: +// Special g++ Options: -fconst-strings + +char foo[26]; + +void bar() +{ + //-g++: incompatible types in assignment of 'const char[]' to 'char[]' + //-edg: expression must be a modifiable lvalue + foo = "0123456789012345678901234"; // ERROR - // ERROR - +} + + + diff --git a/gcc/testsuite/g++.old-deja/g++.benjamin/14664-2.C b/gcc/testsuite/g++.old-deja/g++.benjamin/14664-2.C new file mode 100644 index 00000000000..35dc0b2f6ad --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.benjamin/14664-2.C @@ -0,0 +1,16 @@ +// 981203 bkoz +// g++/14664 + test +// Build don't link: +// Special g++ Options: -fno-const-strings + +char foo[26]; + +void bar() +{ + // the addition of the flag "-fno-const-string-literal" reverts to pre-ISO. + // -g++: ANSI C++ forbids assignment of arrays + foo = "0123456789012345678901234"; // WARNING - +} + + + diff --git a/gcc/testsuite/g++.old-deja/g++.benjamin/14687.C b/gcc/testsuite/g++.old-deja/g++.benjamin/14687.C new file mode 100644 index 00000000000..c2a9a99d0c2 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.benjamin/14687.C @@ -0,0 +1,53 @@ +// 981203 bkoz +// g++/14687 +// excess errors test - XFAIL *-*-* + +#include <assert.h> +unsigned int gtest; + +// 7.3.3 the using declaration + +// p 3 +struct belieze { + void f(char); + void g(char); + enum E { e }; + union { int x; }; +}; + +struct dominica: belieze { + using belieze::f; + void f(int i) { f('c'); } // calls belieze::f(char) + void g(int i) { g('c'); } // recursively calls dominca::g(int) +}; + + +// p 6 +namespace A { + void f(int i) { gtest = 1; } +} + +using A::f; //f is a synonym for A::f, that is for A::f(int) + +namespace A { + void f(char c) { gtest = 3; } +} + +void foo(void) { + f('a'); //calls f(int), even though A::f(char) exits + assert (gtest = 1); +} + +void bar(void) { + using A::f; //f is a synonm for A::f, that is for A::f(int) and A::f(char) + f('a'); //calls f(char) + assert (gtest = 3); +} + +int main(void) +{ + foo(); + bar(); + + return 0; +} diff --git a/gcc/testsuite/g++.old-deja/g++.benjamin/15054.C b/gcc/testsuite/g++.old-deja/g++.benjamin/15054.C new file mode 100644 index 00000000000..65688f70a31 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.benjamin/15054.C @@ -0,0 +1,10 @@ +// 981203 bkoz +// g++/15054 +// Build don't link: +// Special g++ Options: -Wno-pointer-arith +// note that -pedantic also turns on this warning + +void cuba(void) { + void* p; + p++; +} diff --git a/gcc/testsuite/g++.old-deja/g++.benjamin/15071.C b/gcc/testsuite/g++.old-deja/g++.benjamin/15071.C new file mode 100644 index 00000000000..d05ba8c00dd --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.benjamin/15071.C @@ -0,0 +1,11 @@ +// 981203 bkoz +// g++/15071 +// gcc invocation fails to link in libstdc++ + +#include <iostream.h> + +int main() { + cout<<"hi"<<endl; + + return 0; +} diff --git a/gcc/testsuite/g++.old-deja/g++.benjamin/15309-1.C b/gcc/testsuite/g++.old-deja/g++.benjamin/15309-1.C new file mode 100644 index 00000000000..ec83fb46ae4 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.benjamin/15309-1.C @@ -0,0 +1,21 @@ +// 981203 bkoz +// g++/15309 +// Build don't link: +// Special g++ Options: -Wnon-virtual-dtor -Weffc++ + +class bahamian { +public: + bahamian (); + ~bahamian (); +}; + +class miami : public bahamian +{ +public: + miami (); + ~miami (); +}; // WARNING - // WARNING - + + + + diff --git a/gcc/testsuite/g++.old-deja/g++.benjamin/15309-2.C b/gcc/testsuite/g++.old-deja/g++.benjamin/15309-2.C new file mode 100644 index 00000000000..1b483c869b9 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.benjamin/15309-2.C @@ -0,0 +1,10 @@ +// 981203 bkoz +// g++/15309 +// Build don't link: +// Special g++ Options: -Wnon-virtual-dtor -Weffc++ + +class bermuda { +public: + virtual int func1(int); + ~bermuda(); +}; // WARNING - // WARNING - diff --git a/gcc/testsuite/g++.old-deja/g++.benjamin/15351-1.C b/gcc/testsuite/g++.old-deja/g++.benjamin/15351-1.C new file mode 100644 index 00000000000..755c3608fcb --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.benjamin/15351-1.C @@ -0,0 +1,27 @@ +// 981203 bkoz +// g++/15351 - test +// Special g++ Options: -fno-const-strings + +#include <assert.h> + +bool gtest; + +struct acapulco { + acapulco(const char *) { gtest = false; } + acapulco(char *) { gtest = true; } +}; + +void foo(void) +{ + acapulco("some such string\n"); +} + +int main() +{ + foo(); + if (!gtest) + assert (0); + + return !gtest; +} + diff --git a/gcc/testsuite/g++.old-deja/g++.benjamin/15351-2.C b/gcc/testsuite/g++.old-deja/g++.benjamin/15351-2.C new file mode 100644 index 00000000000..98ecaac29a1 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.benjamin/15351-2.C @@ -0,0 +1,27 @@ +// 981203 bkoz +// g++/15351 + test +// Special g++ Options: -fconst-strings + +#include <assert.h> + +bool gtest; + +struct acapulco { + acapulco(const char *) { gtest = true; } + acapulco(char *) { gtest = false; } +}; + +void foo(void) +{ + acapulco("some such string\n"); +} + +int main() +{ + foo(); + if (!gtest) + assert (0); + + return !gtest; +} + diff --git a/gcc/testsuite/g++.old-deja/g++.benjamin/15756-1.C b/gcc/testsuite/g++.old-deja/g++.benjamin/15756-1.C new file mode 100644 index 00000000000..cc44e6a74a0 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.benjamin/15756-1.C @@ -0,0 +1,36 @@ +// 981203 bkoz +// g++/15756 test1 +// Build don't link: +// Special g++ Options: -Wsign-promo + +enum e_value { first = 0, next = 30 }; + +struct sanjuan { + sanjuan(int value); + sanjuan(unsigned value); + friend sanjuan operator&(const sanjuan& x, const sanjuan& y); + friend int operator!=(const sanjuan& x, const sanjuan& y); +}; + +extern void mod_enum(e_value*); +extern int a; + +void foo(void) { + e_value mod = first; + mod_enum(&mod); + if (mod != next) + ++a; +} + + + + + + + + + + + + + diff --git a/gcc/testsuite/g++.old-deja/g++.benjamin/15756-2.C b/gcc/testsuite/g++.old-deja/g++.benjamin/15756-2.C new file mode 100644 index 00000000000..33c4b23963e --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.benjamin/15756-2.C @@ -0,0 +1,44 @@ +// 981203 bkoz +// g++/15756 test2 +// Build don't link: +// Special g++ Options: -Wsign-promo +// this test may only be valid for 32bit targets at present + +enum e_i { + vali +} +enum_int; + +enum e_ui { + valui = 0xF2345678 +} +enum_uint; + +int i; +unsigned int ui; + +struct caracas { + caracas(int); + caracas(unsigned int); + void foo(); +}; + +int main () +{ + caracas obj_ei ( enum_int ); // WARNING - // WARNING - + caracas obj_eui ( enum_uint ); // WARNING - // WARNING - + caracas obj_i ( i ); + caracas obj_ui ( ui ); + + obj_ei.foo(); + obj_eui.foo(); + obj_i.foo(); + obj_ui.foo(); +} + + + + + + + diff --git a/gcc/testsuite/g++.old-deja/g++.benjamin/15799.C b/gcc/testsuite/g++.old-deja/g++.benjamin/15799.C new file mode 100644 index 00000000000..5309daf8c63 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.benjamin/15799.C @@ -0,0 +1,29 @@ +// 981203 bkoz +// g++/15799 test1 +// Build don't link: + +/* +15799.cpp: In function `void foo()': +15799.cpp:21: call of overloaded `sanjose({anonymous enum})' is ambiguous +15799.cpp:13: candidates are: sanjose::sanjose(const sanjose &) <near match> +15799.cpp:14: sanjose::sanjose(unsigned int) +*/ + +typedef char int_8; +typedef unsigned long uint_32; + +class sanjose { +public: + sanjose(); + sanjose(const sanjose&); + sanjose(int_8 value); // ERROR - // ERROR - + sanjose(uint_32 value); // ERROR - // ERROR - +}; + +enum { first, last}; + +void foo(void) { + sanjose obj(first); // ERROR - // ERROR - +}; + + diff --git a/gcc/testsuite/g++.old-deja/g++.benjamin/15800-1.C b/gcc/testsuite/g++.old-deja/g++.benjamin/15800-1.C new file mode 100644 index 00000000000..49aabc9655c --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.benjamin/15800-1.C @@ -0,0 +1,17 @@ +// 981203 bkoz +// g++/15800 - test +// Build don't link: + +struct panama { + panama(); + panama(panama &); + panama& operator=(panama&); // ERROR - // ERROR - +}; + +extern panama dig(); + +void foo() { + panama obj; + obj = dig(); // ERROR - // ERROR - +} + diff --git a/gcc/testsuite/g++.old-deja/g++.benjamin/15800-2.C b/gcc/testsuite/g++.old-deja/g++.benjamin/15800-2.C new file mode 100644 index 00000000000..18e299aa44c --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.benjamin/15800-2.C @@ -0,0 +1,18 @@ +// 981203 bkoz +// g++/15800 + test +// Build don't link: + +struct panama { + panama(); + panama(panama &); + panama& operator=(panama&); + panama& getref() { return *this; } +}; + +extern panama dig(); + +void foo() { + panama obj; + obj = dig().getref(); +} + diff --git a/gcc/testsuite/g++.old-deja/g++.benjamin/15822.C b/gcc/testsuite/g++.old-deja/g++.benjamin/15822.C new file mode 100644 index 00000000000..ecd93afd869 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.benjamin/15822.C @@ -0,0 +1,27 @@ +// 981203 bkoz +// g++/15822 + +#include <assert.h> + +static unsigned int gcount; + +struct playahermosa { + playahermosa() { ++gcount; } + playahermosa(const playahermosa &) { ++gcount; } + ~playahermosa() { --gcount; } +}; + +struct playacoco { + playacoco(const playahermosa& = playahermosa()) { } //create a temporary +}; + +void foo(playacoco *) { } + +int main() +{ + playacoco bar[2]; + foo(bar); + assert (gcount == 0); + + return 0; +} diff --git a/gcc/testsuite/g++.old-deja/g++.benjamin/16077.C b/gcc/testsuite/g++.old-deja/g++.benjamin/16077.C new file mode 100644 index 00000000000..f38154ec507 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.benjamin/16077.C @@ -0,0 +1,28 @@ +// 981203 bkoz +// g++/16077 +// Build don't link: + +class nicaragua; +struct colombia { + colombia(); + colombia(const colombia &); + colombia(const nicaragua &); + colombia &operator= (const colombia&); +}; + +struct nicaragua { +public: + nicaragua(); + nicaragua(const nicaragua&); + operator colombia(); +}; + +void peace(const colombia&); // WARNING - // WARNING - + +void foo(nicaragua& b) { + peace(b); // WARNING - // WARNING - +} + + + + diff --git a/gcc/testsuite/g++.old-deja/g++.benjamin/16567.C b/gcc/testsuite/g++.old-deja/g++.benjamin/16567.C new file mode 100644 index 00000000000..8039f5babe6 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.benjamin/16567.C @@ -0,0 +1,44 @@ +// 981203 bkoz +// g++/16567 +// Build don't link: + +typedef bool Bool; +typedef unsigned char Uint8; +typedef unsigned short Uint16; +typedef unsigned int Uint32; + +enum e_ms { third = 3, fourth = 4 }; + +struct bitmask { + Uint8* anon1; + Uint32 anon2; + Uint8 anon3; + Uint8 here: 2; + Uint8 anon4: 2; + Uint8 anon5: 4; +}; + +struct control { + Uint8 foo_1(); +}; + +inline Uint8 foo_2(bitmask* p) { + return p->here; +} + +inline Uint8 control::foo_1() { + return foo_2((bitmask*) this); +} + +void foo(void) { + control obj; + control *fp = &obj; + e_ms result; + + result = (e_ms) fp->foo_1; // ERROR - // ERROR - +} + + + + + diff --git a/gcc/testsuite/g++.old-deja/g++.benjamin/17922.C b/gcc/testsuite/g++.old-deja/g++.benjamin/17922.C new file mode 100644 index 00000000000..471709287ef --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.benjamin/17922.C @@ -0,0 +1,19 @@ +// 981204 bkoz +// g++/17922 +// Build don't link: + +class base { }; + +struct derived : public base { + derived (const derived&); + derived (const base&); +}; + +class tahiti { +public: + static void mf (derived); +}; + +void foo (const derived aaa) { + tahiti::mf(aaa); +} diff --git a/gcc/testsuite/g++.old-deja/g++.benjamin/17930.C b/gcc/testsuite/g++.old-deja/g++.benjamin/17930.C new file mode 100644 index 00000000000..3d7fc65a326 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.benjamin/17930.C @@ -0,0 +1,6 @@ +// 981204 bkoz +// g++/17930 +// Build don't link: + +char const one[] = "test"; +char const two[] = one; // ERROR - // ERROR - diff --git a/gcc/testsuite/g++.old-deja/g++.benjamin/18208.C b/gcc/testsuite/g++.old-deja/g++.benjamin/18208.C new file mode 100644 index 00000000000..7ec1dc09098 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.benjamin/18208.C @@ -0,0 +1,25 @@ +// 981204 bkoz +// g++/18208 +// Build don't link: + +typedef unsigned int uint_32; + +class puertorico { +public: + void *f (); +private: + uint_32 member; +}; + +void foo( ) +{ + uint_32 ui; + puertorico obj; + + // Bug using static_cast<> + ui = static_cast<uint_32>(obj); // ERROR - // ERROR - + + // Bug when missing the pair of braces + ui = (uint_32) obj.f; // ERROR - // ERROR - +} + diff --git a/gcc/testsuite/g++.old-deja/g++.brendan/explicit1.C b/gcc/testsuite/g++.old-deja/g++.brendan/explicit1.C new file mode 100644 index 00000000000..148155e2f69 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.brendan/explicit1.C @@ -0,0 +1,4 @@ +// $7.1.2 disallows explicit on anything but declarations of +// constructors ... including friends. +class foo { public: foo(); }; +class bar { public: friend explicit foo::foo(); }; // ERROR - explicit friend diff --git a/gcc/testsuite/g++.old-deja/g++.eh/ctor1.C b/gcc/testsuite/g++.old-deja/g++.eh/ctor1.C new file mode 100644 index 00000000000..9874131a44d --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.eh/ctor1.C @@ -0,0 +1,15 @@ +struct A +{ + A(); + A(A&); // ERROR - referenced below +}; + +int +main () +{ + try + { + throw A(); // ERROR - can't copy + } + catch (...) { } +} diff --git a/gcc/testsuite/g++.old-deja/g++.eh/spec5.C b/gcc/testsuite/g++.old-deja/g++.eh/spec5.C new file mode 100644 index 00000000000..56154f973ee --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.eh/spec5.C @@ -0,0 +1,3 @@ +// Build don't link: + +extern void *f(unsigned int k) throw(); diff --git a/gcc/testsuite/g++.old-deja/g++.eh/spec6.C b/gcc/testsuite/g++.old-deja/g++.eh/spec6.C new file mode 100644 index 00000000000..e9e3e770012 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.eh/spec6.C @@ -0,0 +1,46 @@ +// Build don't link: + +// Copyright (C) 1999 Free Software Foundation, Inc. +// Contributed by Nathan Sidwell 19 Jan 1999 <nathan@acm.org> + +// Determine that throw specifiers are checked correctly. + +// [except.spec] 1, a type in an exception specifier shall not be incomplete, +// or pointer or ref to incomplete +struct X; // ERROR - forward declaration - XFAIL +void fn1() throw(X); // ERROR - incomplete type - XFAIL +void fn2() throw(X *); // ERROR - incomplete type - XFAIL +void fn3() throw(X &); // ERROR - incomplete type - XFAIL +void fn4() throw(void); // ERROR - incomplete type - XFAIL +// except for cv pointer to void +void fn5() throw(void *); + +// [except.spec] 2, exception specifiers must be the same set of types (but +// can be reordered) +void fn() throw(int, char); // gets bogus error - XFAIL +void fn() throw(char, int){} // gets bogus error - ordering is irrelevant - XFAIL + +// [except.spec] 3, virtual function overriders shall throw a subset of the +// overridden function +struct E {}; +struct F : public E {}; +struct A +{ + virtual void foo() throw(); + virtual void baz() throw(double, int); + virtual void bar(); + virtual void qux() throw(E); + virtual void quux() throw(F); +}; + +struct B : A +{ + virtual void foo() throw(int); // ERROR - not in base function - XFAIL + virtual void baz() throw(double); + virtual void bar(int) throw(int); + virtual void qux() throw(F); + virtual void quux() throw(E); // ERROR - not in base function - XFAIL +}; + +// [except.spec] 5, types shall not be defined in exception specifiers +void fn6() throw(struct Z {}); // ERROR - types shall not be defined - XFAIL diff --git a/gcc/testsuite/g++.old-deja/g++.eh/throw1.C b/gcc/testsuite/g++.old-deja/g++.eh/throw1.C new file mode 100644 index 00000000000..49a7d1e68fd --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.eh/throw1.C @@ -0,0 +1,12 @@ +// Build don't link: + +void athrow(const int & e) throw(int) +{ + throw e; +} + +int main(void) +{ + athrow(int()); + return 0; +} diff --git a/gcc/testsuite/g++.old-deja/g++.eh/throw2.C b/gcc/testsuite/g++.old-deja/g++.eh/throw2.C new file mode 100644 index 00000000000..fbf0cec9c35 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.eh/throw2.C @@ -0,0 +1,16 @@ +// Build don't link: + +// Submitted by Sebastian Ritterbusch <uabp@rz.uni-karlsruhe.de> + +#define ANY int // a class with a public constructor + +void athrow(const ANY & e) throw(ANY) +{ + throw e; // gets bogus error - discarding const +} + +int main(void) +{ + athrow(ANY()); + return 0; +} diff --git a/gcc/testsuite/g++.old-deja/g++.eh/tmpl2.C b/gcc/testsuite/g++.old-deja/g++.eh/tmpl2.C new file mode 100644 index 00000000000..af3dc7bc12a --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.eh/tmpl2.C @@ -0,0 +1,33 @@ +// Build don't link: +// Special g++ flags: -O +// crash test - XFAIL i*86-*-linux* + +// Posted by H. J. Lu <hjl@lucon.org> + +template<class T> +class FixSeq +{ +public: + void append(const T&); +}; +class foo +{ +public: + void setupIR(); +}; +typedef FixSeq<foo *> bar; +extern void dummy (foo *); +void * +foobar (bar &x, foo *p) +{ + try + { + p -> setupIR(); + } + catch(...) + { + dummy (p); + } + x.append(p); + return p; +} diff --git a/gcc/testsuite/g++.old-deja/g++.eh/tmpl3.C b/gcc/testsuite/g++.old-deja/g++.eh/tmpl3.C new file mode 100644 index 00000000000..521315e17e2 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.eh/tmpl3.C @@ -0,0 +1,11 @@ +// Build don't link: + +// Posted by Trevor Taylor <ttaylor@powerup.com.au> + +template<class T> struct A { + void X() throw(T); +}; + +template<class T> +inline void A<T>::X() +throw(T) { } diff --git a/gcc/testsuite/g++.old-deja/g++.ext/arrnew2.C b/gcc/testsuite/g++.old-deja/g++.ext/arrnew2.C new file mode 100644 index 00000000000..e572081cb81 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.ext/arrnew2.C @@ -0,0 +1,4 @@ +// Build don't link: +// Special g++ Options: + +int *foo = new int[1](0); // gets bogus error - diff --git a/gcc/testsuite/g++.old-deja/g++.ext/bound1.C b/gcc/testsuite/g++.old-deja/g++.ext/bound1.C new file mode 100644 index 00000000000..3b926a49561 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.ext/bound1.C @@ -0,0 +1,29 @@ +// Testcase for cast of bound pointer to member function. +// Special g++ Options: -Wno-pmf-conversions +// Build don't link: + +struct A { + int f (); +}; + +typedef int (*fptr)(A *); +typedef void* vptr; +typedef int (A::*pmf)(); + +int foo (A* ap, pmf fp, int A::* ip) +{ + fptr p; + vptr q; + A a; + + p = (fptr)(ap->*fp); + p = (fptr)(ap->*fp); + p = (fptr)(ap->*(&A::f)); + p = (fptr)(a.*fp); + p = (fptr)(a.*(&A::f)); + + q = (vptr)(ap->*fp); + q = (vptr)(ap->*(&A::f)); + q = (vptr)(a.*fp); + q = (vptr)(a.*(&A::f)); +} diff --git a/gcc/testsuite/g++.old-deja/g++.ext/typeof1.C b/gcc/testsuite/g++.old-deja/g++.ext/typeof1.C new file mode 100644 index 00000000000..a9c03b3ae60 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.ext/typeof1.C @@ -0,0 +1,17 @@ +// Build don't link: + +struct inttest { + int elem[1]; +}; + +template <class T> +void F(T x) +{ + typedef __typeof (x.elem[0]) dummy; + dummy i = 1; +} + +int main() { + inttest x; + F(x); +} diff --git a/gcc/testsuite/g++.old-deja/g++.law/weak.C b/gcc/testsuite/g++.old-deja/g++.law/weak.C new file mode 100644 index 00000000000..98465acf9b5 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.law/weak.C @@ -0,0 +1,20 @@ +// Bug: g++ fails to instantiate operator<<. +// Build don't run: +// Special g++ Options: -static +// Skip if not target: i?86-*-linux* + +// libc-5.4.xx has __IO_putc in its static C library, which can conflict +// with the copy of __IO_putc in the libstdc++ library built by egcs. +#include <iostream.h> +#include <streambuf.h> + +istream x; +extern "C" int putc(), fgets(); + +main () { + x.get(); + putc(); + fgets(); + x.gets(0, 0); +} + diff --git a/gcc/testsuite/g++.old-deja/g++.martin/access1.C b/gcc/testsuite/g++.old-deja/g++.martin/access1.C new file mode 100644 index 00000000000..a4e0f63168d --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.martin/access1.C @@ -0,0 +1,12 @@ +// Build don't link: +class A{ + public: + enum Foo{f1,f2}; + + class B{ + friend class A; + Foo f; + public: + B():f(f1){} + }; +}; diff --git a/gcc/testsuite/g++.old-deja/g++.martin/conv1.C b/gcc/testsuite/g++.old-deja/g++.martin/conv1.C new file mode 100644 index 00000000000..0227800d3cf --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.martin/conv1.C @@ -0,0 +1,13 @@ +struct S{ + operator bool() + { + return true; + } +}; + +int main() +{ + S a; + if (S &b = a); +} + diff --git a/gcc/testsuite/g++.old-deja/g++.martin/lookup1.C b/gcc/testsuite/g++.old-deja/g++.martin/lookup1.C new file mode 100644 index 00000000000..d45a02e0ec3 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.martin/lookup1.C @@ -0,0 +1,22 @@ +//Build don't link: +//In the base class list, the context of the current is used +//reported by Stephen Vavasis <vavasis@CS.Cornell.EDU> + +namespace N1 { + namespace N2 { + class A{}; + class B; + } +} + +class N1::N2::B : public A { +}; + + +class C1 { + class A{}; + class B; +}; + +class C1::B : A { +}; diff --git a/gcc/testsuite/g++.old-deja/g++.martin/new1.C b/gcc/testsuite/g++.old-deja/g++.martin/new1.C new file mode 100644 index 00000000000..835b42659b8 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.martin/new1.C @@ -0,0 +1,121 @@ +//Lifetime of temporaries: +//egcs 2.92 performs cleanup for temporaries inside new expressions +//after the new is complete, not at the end of the full expression. + +#include <new> +#include <cstdlib> +#include <cstdio> + +bool new_throws; +bool ctor_throws; + +int new_done; +int ctor_done; +int func_done; +int dtor_done; +int delete_done; + +int count; + +void init() +{ + new_throws = ctor_throws = false; + new_done = ctor_done = func_done = dtor_done = delete_done = count = 0; +} + +struct line_error{ + int line; + line_error(int i):line(i){} +}; + +#define CHECK(cond) if(!(cond))throw std::line_error(__LINE__); + +struct A{ + A(int){ + ctor_done = ++count; + if(ctor_throws) + throw 1; + } + A(const A&){ + CHECK(false); //no copy constructors in this code + } + ~A(){ + dtor_done = ++count; + } + A* addr(){return this;} +}; + +struct B{ + B(A*){} + void* operator new(size_t s){ + new_done = ++count; + if(new_throws) + throw 1; + return malloc(s); + } + void operator delete(void *){ + delete_done = ++count; + } +}; + +void func(B* ) +{ + func_done = ++count; +} + +void test1() +{ + init(); + try{ + func(new B(A(10).addr())); + }catch(int){ + } + CHECK(new_done==1); + CHECK(ctor_done==2); + CHECK(func_done==3); + CHECK(dtor_done==4); + CHECK(delete_done==0); +} + +void test2() +{ + init(); + new_throws = true; + try{ + func(new B(A(10).addr())); + }catch(int){ + } + CHECK(new_done==1); + CHECK(ctor_done==0); + CHECK(func_done==0); + CHECK(dtor_done==0); + CHECK(delete_done==0); +} + +void test3() +{ + init(); + ctor_throws = true; + try{ + func(new B(A(10).addr())); + }catch(int){ + } + CHECK(new_done==1); + CHECK(ctor_done==2); + CHECK(func_done==0); + CHECK(dtor_done==0); + CHECK(delete_done==3); +} + +int main() +{ + try{ + test1(); + test2(); + test3(); + }catch(line_error e){ + printf("Got error in line %d\n",e.line); + return 1; + } + return 0; +} diff --git a/gcc/testsuite/g++.old-deja/g++.martin/overload1.C b/gcc/testsuite/g++.old-deja/g++.martin/overload1.C new file mode 100644 index 00000000000..8464fba6f9b --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.martin/overload1.C @@ -0,0 +1,12 @@ +//Overload resolution should consider both declarations of func identically. + +struct S{}; +void func(S&){} + +int main() +{ + void func(S&); + S s; + func(s); +} + diff --git a/gcc/testsuite/g++.old-deja/g++.martin/sts_conv.C b/gcc/testsuite/g++.old-deja/g++.martin/sts_conv.C new file mode 100644 index 00000000000..7717561c5cb --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.martin/sts_conv.C @@ -0,0 +1,19 @@ +// ecgs-bugs 1999-02-22 14:21, Stefan Schwarzer +// sts@ica1.uni-stuttgart.de +// this code should compile quietly + +class CArray +{ +public: + operator double* (){ return a; } + // works if we comment this line: + operator double* () const { return const_cast<double *>(a); } +private: + double a[2]; +}; + +int main(){ + CArray a; + double *pa = a + 1; // gets bogus error - should convert + return 0; +} diff --git a/gcc/testsuite/g++.old-deja/g++.martin/sts_iarr.C b/gcc/testsuite/g++.old-deja/g++.martin/sts_iarr.C new file mode 100644 index 00000000000..a2b63b82a3c --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.martin/sts_iarr.C @@ -0,0 +1,45 @@ +// egcs-bugs 999-02-22 14:26 Stefan Schwarzer +// sts@ica1.uni-stuttgart.de +// should compile and return 0 + +template <int N> +struct Outer{ + struct Inner{ + Inner(int n): sum(n){} + + typename Outer<N-1>::Inner operator[](int n) const + { return typename Outer<N-1>::Inner(sum + n); } + + int sum; + }; + + typename Outer<N-1>::Inner operator[](int n) const + { return typename Outer<N-1>::Inner(n); } +}; + + +// specializations for N==1 +template<> +struct Outer<1> { + struct Inner { + Inner(int n): sum(n){} + + int operator[](int n) const + { return sum+n; } + + int sum; + }; + + int operator[](int n) const + { return n; } +}; + + +int main() +{ + Outer<1> sum1; + //std::cout << sum1[1] << "\n"; + Outer<2> sum2; + //std::cout << sum2[1][1] << "\n"; + return sum1[1] + sum2[1][1] - 3; +} diff --git a/gcc/testsuite/g++.old-deja/g++.martin/sts_partial.C b/gcc/testsuite/g++.old-deja/g++.martin/sts_partial.C new file mode 100644 index 00000000000..c2dc9411b54 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.martin/sts_partial.C @@ -0,0 +1,15 @@ +// excess errors test - XFAIL +// ecgs-bugs 1999-02-22 14:26 Stefan Schwarzer +// sts@ica1.uni-stuttgart.de +// partial ordering problem in egcs <= 1.1.1 + +template<class T> +int f(T &){ return 1; } + +template<class T> +int f( T[] ){ return 0; } + +int main(){ + int d[] ={2}; + return f(d); +} diff --git a/gcc/testsuite/g++.old-deja/g++.martin/sts_vectini.C b/gcc/testsuite/g++.old-deja/g++.martin/sts_vectini.C new file mode 100644 index 00000000000..56f7a1c6a5e --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.martin/sts_vectini.C @@ -0,0 +1,41 @@ +// Special g++ Options: -O2 +// egcs-bugs 1999-02-22 14:24 Stefan Schwarzer +// sts@ica1.uni-stuttgart.de +// optimizer problem in egcs <= 1.1.1 + +struct XTVec{ + XTVec(){x[0]=x[1] =x[2] =0;} + XTVec(int ax,int y=0.,int z=0.){x[0]=ax;x[1]=y; x[2]=z; } + int& operator[](int); + + int x[3]; +}; + +inline +int & XTVec::operator[](int i){ + return x[i]; +} + +inline +XTVec& operator+=(XTVec& lhs, XTVec& rhs){ + lhs[0]+=rhs[0]; + lhs[1]+=rhs[1]; + lhs[2]+=rhs[2]; + return lhs; +} + +inline +XTVec operator+(XTVec& lhs, XTVec& rhs){ + XTVec result(lhs); + return result += rhs; +} + +int main() +{ + XTVec ur(4.,0.,1.); + XTVec ll(0.,2.,0.); + XTVec initsum(ur + ll); + + // sum of components should be 7 + return (initsum[0] + initsum[1] + initsum[2] - 7); +} diff --git a/gcc/testsuite/g++.old-deja/g++.ns/alias7.C b/gcc/testsuite/g++.old-deja/g++.ns/alias7.C new file mode 100644 index 00000000000..ce1ebb86755 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.ns/alias7.C @@ -0,0 +1,11 @@ +//Build don't link: +namespace A{ + namespace B{int i;} + using namespace B; +} + +namespace C=A; + +void f(){ + C::i = 1; +} diff --git a/gcc/testsuite/g++.old-deja/g++.ns/crash2.C b/gcc/testsuite/g++.old-deja/g++.ns/crash2.C new file mode 100644 index 00000000000..d49189bfbe1 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.ns/crash2.C @@ -0,0 +1,12 @@ +// Build don't link: + +// Submitted by bjornw@fairplay.no + +// crash test - XFAIL *-*-* + +namespace hei { + class CSomeClass {}; + extern CSomeClass SomeClass; +}; + +hei::CSomeClass hei::CSomeClass; // ERROR - should be hei::SomeClass diff --git a/gcc/testsuite/g++.old-deja/g++.ns/crash3.C b/gcc/testsuite/g++.old-deja/g++.ns/crash3.C new file mode 100644 index 00000000000..842ed090bcc --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.ns/crash3.C @@ -0,0 +1,10 @@ +// Build don't link: + +namespace N { + template <class T> struct S; +}; + +void f() +{ + N::S(); // ERROR - invalid use of template +} diff --git a/gcc/testsuite/g++.old-deja/g++.ns/friend1.C b/gcc/testsuite/g++.old-deja/g++.ns/friend1.C new file mode 100644 index 00000000000..859a84ec3ec --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.ns/friend1.C @@ -0,0 +1,8 @@ +// Build don't link: +namespace A{ + void f(int); +} + +class X{ + friend void A::f(int); +}; diff --git a/gcc/testsuite/g++.old-deja/g++.ns/friend2.C b/gcc/testsuite/g++.old-deja/g++.ns/friend2.C new file mode 100644 index 00000000000..7d4a6c87d87 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.ns/friend2.C @@ -0,0 +1,11 @@ +//Build don't link: +namespace A{ + void foo(); +} + + +namespace B{ +class B{ + friend void A::foo(); +}; +} diff --git a/gcc/testsuite/g++.old-deja/g++.ns/main1.C b/gcc/testsuite/g++.old-deja/g++.ns/main1.C new file mode 100644 index 00000000000..0e5a07f6aae --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.ns/main1.C @@ -0,0 +1,15 @@ +// Build don't link: + +// main is only reserved in the global namespace [basic.start.main]/3 + +// submitted by Gerald Gutierrez <gutier@intergate.bc.ca> + +namespace A { void main () { } } +namespace B { void main () { } } +namespace C { + void main () { } + namespace D { + void main () { } + } +} + diff --git a/gcc/testsuite/g++.old-deja/g++.ns/ns17.C b/gcc/testsuite/g++.old-deja/g++.ns/ns17.C new file mode 100644 index 00000000000..8d1fdd7e2ac --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.ns/ns17.C @@ -0,0 +1,13 @@ +//Build don't link: +namespace foo +{ + class c + { + }; +}; + +int +foo::c:fn () // ERROR - syntax error +{ +} + diff --git a/gcc/testsuite/g++.old-deja/g++.ns/template7.C b/gcc/testsuite/g++.old-deja/g++.ns/template7.C new file mode 100644 index 00000000000..3c857355a50 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.ns/template7.C @@ -0,0 +1,13 @@ +// Build don't link: + +// crash test - XFAIL *-*-* + +// Based on bug report by Eric NICOLAS <nicolas@bnp-eng.remcomp.com> + +namespace foo { + template<class F> struct bar {}; +} + +void baz() { + foo::bar(); // ERROR - template used as expression +} diff --git a/gcc/testsuite/g++.old-deja/g++.ns/template8.C b/gcc/testsuite/g++.old-deja/g++.ns/template8.C new file mode 100644 index 00000000000..758f1927653 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.ns/template8.C @@ -0,0 +1,9 @@ +// Build don't link: +namespace X { + template <class T> class foo; +} + +template <class T> +class X::foo { + T worthless; +}; diff --git a/gcc/testsuite/g++.old-deja/g++.ns/using10.C b/gcc/testsuite/g++.old-deja/g++.ns/using10.C new file mode 100644 index 00000000000..cd5cd47627a --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.ns/using10.C @@ -0,0 +1,9 @@ +//Build don't link: +//Based on a report by Helmut Jarausch <jarausch@IGPM.Rwth-Aachen.DE> +template<class> +class foo{}; + +namespace ABC +{ + using ::foo; +} diff --git a/gcc/testsuite/g++.old-deja/g++.ns/using11.C b/gcc/testsuite/g++.old-deja/g++.ns/using11.C new file mode 100644 index 00000000000..23943f22a1a --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.ns/using11.C @@ -0,0 +1,9 @@ +// Build don't link: + +class joey { +public: + typedef int SVec; +}; + +using joey::SVec; // ERROR - joey is not a namespace + diff --git a/gcc/testsuite/g++.old-deja/g++.ns/using12.C b/gcc/testsuite/g++.old-deja/g++.ns/using12.C new file mode 100644 index 00000000000..edc863b08bf --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.ns/using12.C @@ -0,0 +1,19 @@ +// Build don't link: +// Origin: Brendan Kehoe <brendan@cygnus.com> + +namespace foo +{ + void x (bool); // ERROR - candidates + void x (char); // ERROR - candidates + void x (int); // ERROR - candidates + void x (double); // ERROR - candidates +} + +namespace baz { void x (int); } // ERROR - candidates + +void fn (int i) +{ + using foo::x; + using baz::x; + x(i); // ERROR - ambiguous +} diff --git a/gcc/testsuite/g++.old-deja/g++.ns/using13.C b/gcc/testsuite/g++.old-deja/g++.ns/using13.C new file mode 100644 index 00000000000..c1e96adcc96 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.ns/using13.C @@ -0,0 +1,23 @@ +namespace A{ + void foo(int){} +} +namespace B{ + void foo(bool){} +} + +void bar() +{ + using B::foo; + using A::foo; + foo(true); +} + +namespace Foo { + template<class N> void Hello(N) {} +} + +int main() { + using Foo::Hello; + Hello(4); + bar(); +} diff --git a/gcc/testsuite/g++.old-deja/g++.other/access3.C b/gcc/testsuite/g++.old-deja/g++.other/access3.C new file mode 100644 index 00000000000..2ba2c0c51d6 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.other/access3.C @@ -0,0 +1,26 @@ +// Build don't link: +// The standard sez that a use of a name gets the most access it can through +// the various paths that can reach it. Here, the access decl in B gives +// us access. + +struct A +{ + void f (); +}; + +struct B: private virtual A +{ + A::f; +}; + +struct C: private virtual A, public B +{ +}; + +int +main () +{ + C c; + + c.f (); +} diff --git a/gcc/testsuite/g++.old-deja/g++.other/access4.C b/gcc/testsuite/g++.old-deja/g++.other/access4.C new file mode 100644 index 00000000000..75f3a6191a3 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.other/access4.C @@ -0,0 +1,11 @@ +// Build don't link: + +struct A { + static int i; +}; + +struct B : private A { }; + +struct C : public B { + int f () { return A::i; } +}; diff --git a/gcc/testsuite/g++.old-deja/g++.other/access5.C b/gcc/testsuite/g++.old-deja/g++.other/access5.C new file mode 100644 index 00000000000..0d58ea0b3f3 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.other/access5.C @@ -0,0 +1,22 @@ +// Build don't link: + +class A +{ +protected: + int i; +}; + +class B : private A +{ +protected: + A::i; +}; + +struct C : public B { + friend int f(C *p); +}; + +int f(C *p) { + return p->i; +} + diff --git a/gcc/testsuite/g++.old-deja/g++.other/access6.C b/gcc/testsuite/g++.old-deja/g++.other/access6.C new file mode 100644 index 00000000000..7a7c7ff5941 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.other/access6.C @@ -0,0 +1,17 @@ +// Build don't link: + +template <int I> +struct S { + void g(); +}; + +class C { + static const int i = 3; // gets bogus error - private - XFAIL *-*-* +public: + S<C::i>* f(); // gets bogus error - redeclared - XFAIL *-*-* +}; + +S<C::i>* C::f() { // gets bogus error - private - XFAIL *-*-* + return 0; +} + diff --git a/gcc/testsuite/g++.old-deja/g++.other/array1.C b/gcc/testsuite/g++.old-deja/g++.other/array1.C new file mode 100644 index 00000000000..0ecba7778aa --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.other/array1.C @@ -0,0 +1,26 @@ +int i; + +struct S { + S (int) { + ++i; + if (i == 3) + throw 3; + }; + + S () {} + + ~S() { + --i; + } +}; + +int main() +{ + try { + S s[5] = { 0, 1, 2, 3, 4 }; + } catch (...) { + } + + if (i != 1) + return 1; +} diff --git a/gcc/testsuite/g++.old-deja/g++.other/array2.C b/gcc/testsuite/g++.old-deja/g++.other/array2.C new file mode 100644 index 00000000000..255d8cce2d3 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.other/array2.C @@ -0,0 +1,18 @@ +int i; + +struct S { + S () { + ++i; + }; + + S (int) { + }; +}; + +int main() +{ + S s[3][3] = { 2 }; + + if (i != 8) + return 1; +} diff --git a/gcc/testsuite/g++.old-deja/g++.other/const1.C b/gcc/testsuite/g++.old-deja/g++.other/const1.C new file mode 100644 index 00000000000..7c26da1aea3 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.other/const1.C @@ -0,0 +1,9 @@ +// Build don't link: + +struct S +{ + void f() + { + const int i; // ERROR - uninitialized const + } +}; diff --git a/gcc/testsuite/g++.old-deja/g++.other/const2.C b/gcc/testsuite/g++.old-deja/g++.other/const2.C new file mode 100644 index 00000000000..90b70d16619 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.other/const2.C @@ -0,0 +1,5 @@ +// Build don't link: + +struct S { + static const char* cp = "abc"; // ERROR - initialization of non-const +}; diff --git a/gcc/testsuite/g++.old-deja/g++.other/conv3.C b/gcc/testsuite/g++.old-deja/g++.other/conv3.C new file mode 100644 index 00000000000..7690f56ee94 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.other/conv3.C @@ -0,0 +1,13 @@ +// Build don't link: + +// submitted by David C Binderman <dcb@pncl.co.uk> + +typedef const int ci; +typedef ci aci[ 10]; +aci var = { 2, 3, 5, 7, 11, 13 }; + +void +f() +{ + int * ip = var; // ERROR - requires const_cast +} diff --git a/gcc/testsuite/g++.old-deja/g++.other/conv4.C b/gcc/testsuite/g++.old-deja/g++.other/conv4.C new file mode 100644 index 00000000000..0ed0ee86563 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.other/conv4.C @@ -0,0 +1,17 @@ +// Testcase for proper hiding of base conversion ops. + +struct A +{ + operator const char *(); +}; + +struct B : public A +{ + operator const char *() { return 0; } +}; + +int main( void ) +{ + B b; + const char *p = b; +} diff --git a/gcc/testsuite/g++.old-deja/g++.other/conv5.C b/gcc/testsuite/g++.old-deja/g++.other/conv5.C new file mode 100644 index 00000000000..97bf23889a9 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.other/conv5.C @@ -0,0 +1,8 @@ +// Build don't link: + +// Based on bug report by Thomas Kunert <kunert@physik.tu-dresden.de> + +// Special g++ Options: + +int foo(); +const int (*bar)() = foo; // ERROR - adding const - XFAIL *-*-* diff --git a/gcc/testsuite/g++.old-deja/g++.other/conv6.C b/gcc/testsuite/g++.old-deja/g++.other/conv6.C new file mode 100644 index 00000000000..918e69742d8 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.other/conv6.C @@ -0,0 +1,28 @@ +// Test for composite pointer types, as defined in [expr.rel], +// and common pointer to member types, as defined in [expr.eq]. + +struct A { int i; }; +struct B : public A { }; + +int main () +{ + B b; + + // The composite type is `A const *' + A* ap = &b; + const B* bp = &b; + if (ap != bp) // gets bogus error - distinct types XFAIL *-*-* + return 1; + + // The composite type is `B const *const *' + B *const * p = 0; + B const * * q = 0; + if (p != q) // gets bogus error - distinct types XFAIL *-*-* + return 1; + + // The common type is `int const B::*' + const int A::*apm = &A::i; + int B::*bpm = &A::i; + if (apm != bpm) // gets bogus error - distinct types XFAIL *-*-* + return 1; +} diff --git a/gcc/testsuite/g++.old-deja/g++.other/copy1.C b/gcc/testsuite/g++.old-deja/g++.other/copy1.C new file mode 100644 index 00000000000..5cc68a5623e --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.other/copy1.C @@ -0,0 +1,25 @@ +// Bug: expand_vec_init doesn't copy arrays of builtin types. + +struct B { + B() { } + B(const B&) { } +}; + +struct A +{ + B b; + int ar[5]; +}; + +int main() +{ + A a; + for (int i = 0; i < 5; ++i) + a.ar[i] = i; + + A a2 = a; + + for (int i = 0; i < 5; ++i) + if (a2.ar[i] != a.ar[i]) + return 1; +} diff --git a/gcc/testsuite/g++.old-deja/g++.other/crash6.C b/gcc/testsuite/g++.old-deja/g++.other/crash6.C new file mode 100644 index 00000000000..498c9833501 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.other/crash6.C @@ -0,0 +1,19 @@ +// Build don't link: +// Special g++ Options: -O2 + +struct E +{ + int f(int); +}; + +int ha() +{ + enum {X = 0}; + + int A, C; + + E vList[10]; + + A = (C + 1) % 3; + vList[1].f(A); +} diff --git a/gcc/testsuite/g++.old-deja/g++.other/crash7.C b/gcc/testsuite/g++.old-deja/g++.other/crash7.C new file mode 100644 index 00000000000..0f581988b1f --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.other/crash7.C @@ -0,0 +1,11 @@ +// Build don't link: + +void f() +{ + union { + private: + int i; // ERROR - private + } u; + + u.i = 3; // ERROR - within this context +} diff --git a/gcc/testsuite/g++.old-deja/g++.other/dcast1.C b/gcc/testsuite/g++.old-deja/g++.other/dcast1.C new file mode 100644 index 00000000000..d9dd6575aec --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.other/dcast1.C @@ -0,0 +1,15 @@ +// Build don't link: + +class C { +public: + virtual void f(); +}; + +extern volatile C* cp; +extern volatile C& cr; + +void f () +{ + dynamic_cast<void*>(cp); // ERROR - cannot dynamic_cast + dynamic_cast<C&>(cr); // ERROR - cannot dynamic_cast +} diff --git a/gcc/testsuite/g++.old-deja/g++.other/dcast2.C b/gcc/testsuite/g++.old-deja/g++.other/dcast2.C new file mode 100644 index 00000000000..bd343a7e61d --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.other/dcast2.C @@ -0,0 +1,17 @@ +// Build don't link: + +// Based on a testcase by Ruslan Shevchenko <Ruslan@Shevchenko.Kiev.UA> + +struct B { + virtual ~B(); +}; + +struct D : public B { +}; + +void foo() { + B x; + dynamic_cast<D*>(&x); // WARNING - will never succeed + B* p = &x; + dynamic_cast<D*>(p); +} diff --git a/gcc/testsuite/g++.old-deja/g++.other/debug2.C b/gcc/testsuite/g++.old-deja/g++.other/debug2.C new file mode 100644 index 00000000000..200aeb3cffc --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.other/debug2.C @@ -0,0 +1,31 @@ +// Build don't link: +// Special g++ Options: -funroll-loops -O2 -g + +inline void f() +{ + typedef int T; +} + +inline void g() +{ + typedef double U; +} + +int n; + +struct B +{ + ~B() { + for (int i = 0; i < n; ++i) + g(); + } +}; + +struct D : public B { + ~D() { + for (int j = 0; j < n; ++j) + f(); + } +}; + +D d; diff --git a/gcc/testsuite/g++.old-deja/g++.other/defarg1.C b/gcc/testsuite/g++.old-deja/g++.other/defarg1.C new file mode 100644 index 00000000000..68b07a510cc --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.other/defarg1.C @@ -0,0 +1,28 @@ +// Build don't link: + +int f (int x) +{ + extern void g (int i = f (x)); // ERROR - default argument uses local + + g(); + + return 0; +} + +int f (void); + +int h1 (int (*)(int) = f); +int h2 (int (*)(double) = f); // ERROR - no matching f + +template <class T> +int j (T t) +{ + extern void k (int i = j (t)); // ERROR - default argument uses local + + k (); + + return 0; +} + +template int j (double); // ERROR - instantiated from here + diff --git a/gcc/testsuite/g++.old-deja/g++.other/delete3.C b/gcc/testsuite/g++.old-deja/g++.other/delete3.C new file mode 100644 index 00000000000..eb56350371b --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.other/delete3.C @@ -0,0 +1,38 @@ +#include <new> + +int i; + +extern "C" void printf(const char*, ...); + +template <class T, class U> +struct map { + ~map (); +}; + +template <class T, class U> +map<T, U>::~map () +{} + +struct SomeClass { }; + +void* operator new(size_t numBytes, SomeClass&, const nothrow_t&) throw() +{ + return operator new(numBytes, nothrow); +} + +void operator delete(void* pMemory, SomeClass&, const nothrow_t&) throw() +{ + i = 7; + return operator delete(pMemory); +} + +int +main() +{ + map< int, int>* pMap = new map< int, int>; + + delete pMap; + + if (i == 7) + return 1; +} diff --git a/gcc/testsuite/g++.old-deja/g++.other/expr1.C b/gcc/testsuite/g++.old-deja/g++.other/expr1.C new file mode 100644 index 00000000000..fece8d48c29 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.other/expr1.C @@ -0,0 +1,11 @@ +// Build don't link: + +// Simplified from bug report by Trevor Taylor <ttaylor@powerup.com.au> + +struct T { + int operator()(int) { } // ERROR - candidate +}; + +int main() { + T()(); // ERROR - no such operator +} diff --git a/gcc/testsuite/g++.old-deja/g++.other/field2.C b/gcc/testsuite/g++.old-deja/g++.other/field2.C new file mode 100644 index 00000000000..5eb67554fdf --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.other/field2.C @@ -0,0 +1,20 @@ +// Test for proper handling of field calls. +// Contributed by Jason Merrill <jason@cygnus.com> + +struct A { + inline A* operator()() { return this; } +}; + +struct B { + int i; + union { A a; }; +}; + +int +main () +{ + B b; + A* ap = &b.a; + A* ap2 = b.a(); + return (ap != ap2); +} diff --git a/gcc/testsuite/g++.old-deja/g++.other/for1.C b/gcc/testsuite/g++.old-deja/g++.other/for1.C new file mode 100644 index 00000000000..31cd741a366 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.other/for1.C @@ -0,0 +1,41 @@ +// Build don't link: + +int i; +int j; + +struct S { + int operator()(int) + { + i = 1; + } + + typedef int I; + + void f() { + for (S I; false; ) + ; + int k = I(3); + } +}; + +typedef int J; + +struct T { + int operator()(int) + { + j = 1; + } + + void f() { + for (T J; false; ) + ; + int k = J(3); + } +}; + +int main() +{ + S s; + s.f(); + return 2 * i + j; +} diff --git a/gcc/testsuite/g++.old-deja/g++.other/friend5.C b/gcc/testsuite/g++.old-deja/g++.other/friend5.C new file mode 100644 index 00000000000..ab15fa58c5b --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.other/friend5.C @@ -0,0 +1,5 @@ +// submitted by David C Binderman <dcb@pncl.co.uk> + +struct A { + friend bool(); // ERROR - invalid declaration +}; diff --git a/gcc/testsuite/g++.old-deja/g++.other/incomplete.C b/gcc/testsuite/g++.old-deja/g++.other/incomplete.C new file mode 100644 index 00000000000..0c230c18777 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.other/incomplete.C @@ -0,0 +1,5 @@ +// Build don't link: + +struct S; + +void f(S s) {} // ERROR - incomplete type diff --git a/gcc/testsuite/g++.old-deja/g++.other/init10.C b/gcc/testsuite/g++.old-deja/g++.other/init10.C new file mode 100644 index 00000000000..fa238132f3f --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.other/init10.C @@ -0,0 +1,22 @@ +int i; + +struct D { + D () { + i++; + } +}; + +struct C { + C() {} + + D d[1]; +}; + + +int main () +{ + C c; + + if (i != 1) + return 1; +} diff --git a/gcc/testsuite/g++.old-deja/g++.other/init11.C b/gcc/testsuite/g++.old-deja/g++.other/init11.C new file mode 100644 index 00000000000..79d7d6caa71 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.other/init11.C @@ -0,0 +1,38 @@ +// Check that elements for which no explicit initializer was given are +// default-initialized properly. + +extern "C" int printf (const char *, ...); + +struct A +{ + int i; + A(): i (42) { } + A(int j): i(j) { } +}; + +A ar[4] = { 1, 2 }; + +struct B +{ + A a1, a2, a3, a4; +}; + +B b = { 1, 2 }; + +struct C +{ + A ar[4]; +}; + +C c = { 1, 2 }; + +int +main () +{ + printf ("%d %d %d %d\n%d %d %d %d\n%d %d %d %d\n", + ar[0].i, ar[1].i, ar[2].i, ar[3].i, + b.a1.i, b.a2.i, b.a3.i, b.a4.i, + c.ar[1-1].i, c.ar[2-1].i, c.ar[3-1].i, c.ar[4-1].i); + + return (b.a4.i != 42 || c.ar[3].i != 42); +} diff --git a/gcc/testsuite/g++.old-deja/g++.other/init8.C b/gcc/testsuite/g++.old-deja/g++.other/init8.C new file mode 100644 index 00000000000..80df498e6e1 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.other/init8.C @@ -0,0 +1,11 @@ +// Build don't link: + +// submitted by David C Binderman <dcb@pncl.co.uk> + +// According to [dcl.init]/9, this should be ill-formed + +void +f() +{ + const int var [ 10 ]; // ERROR - missing initializer +} diff --git a/gcc/testsuite/g++.old-deja/g++.other/init9.C b/gcc/testsuite/g++.old-deja/g++.other/init9.C new file mode 100644 index 00000000000..5626174bbe4 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.other/init9.C @@ -0,0 +1,40 @@ +// Build don't link: + +// Based on a testcase submitted by Tudor Hulubei <tudor@cs.unh.edu> + +// X is not a POD because it has a user-defined destructor. +// Therefore, we can't cross its initialization. + +// vector<int> is not even an aggregate; nevertheless, no error is +// reported... + +struct A { + A() {} +}; + +void a() { + goto bar; // ERROR - jump from here + A x; // ERROR - jump crosses initialization + bar: // ERROR - jump to here + ; +} + +struct X { + ~X() {} +}; + +void b() { + goto bar; // ERROR - jump from here + X x; // ERROR - jump crosses initialization + bar: // ERROR - jump to here + ; +} + +#include <vector> + +void c() { + goto bar; // ERROR - jump from here + vector<int> x; // ERROR - jump crosses initialization + bar: // ERROR - jump to here + ; +} diff --git a/gcc/testsuite/g++.old-deja/g++.other/lineno1.C b/gcc/testsuite/g++.old-deja/g++.other/lineno1.C new file mode 100644 index 00000000000..ab003e0ff95 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.other/lineno1.C @@ -0,0 +1,14 @@ +// Submitted by Nathan Sidwell <nathan@acm.org> +// Bug: g++ was giving the wrong line number for statics. +// Special g++ Options: -w + +class A +{ + A(); // ERROR - private + ~A(); // ERROR - private +}; + +static A a; // ERROR - here + + + diff --git a/gcc/testsuite/g++.old-deja/g++.other/lineno2.C b/gcc/testsuite/g++.old-deja/g++.other/lineno2.C new file mode 100644 index 00000000000..4d64d1abf1a --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.other/lineno2.C @@ -0,0 +1,14 @@ +// Submitted by Nathan Sidwell <nathan@acm.org> +// Bug: g++ wasn't listing candidates for a failed conversion. + +void f(int, double); // ERROR - candidate +void f(double, int); // ERROR - candidate +void f(int); // ERROR - candidate + +int +main () +{ + void (*ptr)(int, int); + + ptr = &f; // ERROR - no match +} diff --git a/gcc/testsuite/g++.old-deja/g++.other/linkage2.C b/gcc/testsuite/g++.old-deja/g++.other/linkage2.C new file mode 100644 index 00000000000..c9b6e2a3d62 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.other/linkage2.C @@ -0,0 +1,14 @@ +// Build don't link: +// From: Klaus-Georg Adams <Klaus-Georg.Adams@chemie.uni-karlsruhe.de> +extern "C" +{ +typedef struct {int dummy[10];} *GDBM_FILE; +extern GDBM_FILE gdbm_open(); +} + +typedef struct { int dummy[10]; } *FAIL_FILE; +extern FAIL_FILE fail_open(); // ERROR - non-local function + +typedef struct { int dummy[10]; } *SUCCESS_FILE, S; +extern SUCCESS_FILE success_open(); + diff --git a/gcc/testsuite/g++.old-deja/g++.other/lookup10.C b/gcc/testsuite/g++.old-deja/g++.other/lookup10.C new file mode 100644 index 00000000000..da2b485c5d3 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.other/lookup10.C @@ -0,0 +1,10 @@ +// Build don't link: + +struct A { + struct B { + static int i; + }; + enum { a }; +}; + +int A::B::i = a; diff --git a/gcc/testsuite/g++.old-deja/g++.other/lookup11.C b/gcc/testsuite/g++.old-deja/g++.other/lookup11.C new file mode 100644 index 00000000000..61a6e91d545 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.other/lookup11.C @@ -0,0 +1,12 @@ +// Build don't link: + +namespace A { + int i; +} +using namespace A; +namespace B { + int i; +} +using namespace B; + +int i; diff --git a/gcc/testsuite/g++.old-deja/g++.other/lookup3.C b/gcc/testsuite/g++.old-deja/g++.other/lookup3.C new file mode 100644 index 00000000000..347be4e295a --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.other/lookup3.C @@ -0,0 +1,17 @@ +// Test to make sure that the use of __typeof__ in WIFEXITED works. + +int main () +{ + int stat_loc = 0; + (__extension__ + ({ + union + { + __typeof__ (stat_loc) __in; + int __i; + } __u; + __u.__in = (stat_loc); + __u.__i; + }) + ); +} diff --git a/gcc/testsuite/g++.old-deja/g++.other/lookup4.C b/gcc/testsuite/g++.old-deja/g++.other/lookup4.C new file mode 100644 index 00000000000..59b7a75b2bd --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.other/lookup4.C @@ -0,0 +1,21 @@ +// Test for proper handling of references to overloaded member functions. + +struct A { + static void f (int) { } + void f (); +}; + +void (*p)(int) = &A::f; + +void A::f () +{ + p = f; +} + +int main() +{ + A a; + p = &a.f; + (a.f)(); + (a.f)(42); +} diff --git a/gcc/testsuite/g++.old-deja/g++.other/lookup5.C b/gcc/testsuite/g++.old-deja/g++.other/lookup5.C new file mode 100644 index 00000000000..9fe04151142 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.other/lookup5.C @@ -0,0 +1,11 @@ +// Build don't link: +// Simplified from bug report by Paris Smaragdis <paris@media.mit.edu> + +// crash test - XFAIL *-*-* + +template <class T> class vector {}; +class foo {}; +int main() { + foo f; + f.vector(); // ERROR - not a method +} diff --git a/gcc/testsuite/g++.old-deja/g++.other/lookup6.C b/gcc/testsuite/g++.old-deja/g++.other/lookup6.C new file mode 100644 index 00000000000..08f5ac521ed --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.other/lookup6.C @@ -0,0 +1,25 @@ +int f(int i) +{ + struct C { + int i; + C () : i(1) {} + int f() { + struct D { + int i; + D () : i(2) {} + int g() { return i; } + } d; + + return d.g(); + } + } c; + + return c.f(); +} + + +int main() +{ + if (f(0) != 2) + return 1; +} diff --git a/gcc/testsuite/g++.old-deja/g++.other/lookup7.C b/gcc/testsuite/g++.old-deja/g++.other/lookup7.C new file mode 100644 index 00000000000..55726a5d613 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.other/lookup7.C @@ -0,0 +1,12 @@ +// Test for handling of type shadowing in function scope. + +int main() +{ + int A = 42; + struct A + { + enum { a }; + }; + A = A::a; + return A; +} diff --git a/gcc/testsuite/g++.old-deja/g++.other/lookup8.C b/gcc/testsuite/g++.old-deja/g++.other/lookup8.C new file mode 100644 index 00000000000..f81572ab260 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.other/lookup8.C @@ -0,0 +1,14 @@ +// Build don't link: + +struct S { + int A; + struct A { + enum { a = 0 }; + }; + + void f(); +}; + +void S::f() { + A = A::a; +} diff --git a/gcc/testsuite/g++.old-deja/g++.other/lookup9.C b/gcc/testsuite/g++.old-deja/g++.other/lookup9.C new file mode 100644 index 00000000000..250040071d2 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.other/lookup9.C @@ -0,0 +1,9 @@ +// Build don't link: + +struct S { + typedef long I; +}; + +struct D : virtual public S { + I i; +}; diff --git a/gcc/testsuite/g++.old-deja/g++.other/loop1.C b/gcc/testsuite/g++.old-deja/g++.other/loop1.C new file mode 100644 index 00000000000..3380dd4d74d --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.other/loop1.C @@ -0,0 +1,30 @@ +// Test for bad loop optimization of goto fixups. +// Special g++ Options: -O2 + +typedef bool (*ftype) (); + +int c, d; +struct A { + A() { ++c; } + A(const A&) { ++c; } + ~A() { ++d; } +}; + +void f (ftype func) +{ + A a; + do { + if ((*func)()) return; + } while (true); +} + +bool test () +{ + return true; +} + +main () +{ + f (test); + return (c != d); +} diff --git a/gcc/testsuite/g++.old-deja/g++.other/mangle1.C b/gcc/testsuite/g++.old-deja/g++.other/mangle1.C new file mode 100644 index 00000000000..0ffc5d1a262 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.other/mangle1.C @@ -0,0 +1,42 @@ +// Test for proper mangling by setting up name clashes. +// Special g++ Options: -fno-squangle + +class A { }; +typedef A A2; +typedef int I; +typedef void V; +typedef I I2; + +void f (const A2&, int, const A2&, const A&) { } // ERROR - name clash +int f__FRC1AiT0T0 = 0; // ERROR - name clash + +void f (int, long, int, I) { } // ERROR - name clash +int f__Filii = 0; // ERROR - name clash + +void f (I, float, I, I2) { } // ERROR - name clash +int f__Fifii = 0; // ERROR - name clash + +void f (void*, float, void*, V*) { } // ERROR - name clash +int f__FPvfT0T0 = 0; // ERROR - name clash + +void f (wchar_t) { } // ERROR - name clash +int f__Fw = 0; // ERROR - name clash + +void f(int, A, A2, A) { } // ERROR - name clash +int f__FiG1AN21 = 0; // ERROR - name clash + +void f(const A2&, const A2&, const A2&, const A2&, + int&) { } // ERROR - name clash +int f__FRC1AN30Ri = 0; // ERROR - name clash + +void f(const A2&, int, const A2&, const A2&, const A2&, + int&) { } // ERROR - name clash +int f__FRC1AiT0N20Ri = 0; // ERROR - name clash + +void f(const A2&, int, const A2&, const A2&, const A2&, int&, int&, + int&) { } // ERROR - name clash +int f__FRC1AiT0N20RiN25 = 0; // ERROR - name clash + +void f(const A2&, int, const A2&, const A2&, const A2&, int, int, + int) { } // ERROR - name clash +int f__FRC1AiT0N20iii = 0; // ERROR - name clash diff --git a/gcc/testsuite/g++.old-deja/g++.other/mangle2.C b/gcc/testsuite/g++.old-deja/g++.other/mangle2.C new file mode 100644 index 00000000000..873cb369e76 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.other/mangle2.C @@ -0,0 +1,42 @@ +// Test for proper mangling by setting up name clashes. +// Special g++ Options: -fsquangle + +class A; +typedef A A2; +typedef int I; +typedef void V; +typedef I I2; + +void f (const A2&, int, const A2&, const A&) { } // ERROR - name clash +int f__FRC1AiRCB0n1 = 0; // ERROR - name clash + +void f (int, long, int, I) { } // ERROR - name clash +int f__Filii = 0; // ERROR - name clash + +void f (I, float, I, I2) { } // ERROR - name clash +int f__Fifii = 0; // ERROR - name clash + +void f (void*, float, void*, V*) { } // ERROR - name clash +int f__FPvfPvn1 = 0; // ERROR - name clash + +void f (wchar_t) { } // ERROR - name clash +int f__Fw = 0; // ERROR - name clash + +void f(int, A, A2, A) { } // ERROR - name clash +int f__FiG1An2 = 0; // ERROR - name clash + +void f(const A2&, const A2&, const A2&, const A2&, + int&) { } // ERROR - name clash +int f__FRC1An3Ri = 0; // ERROR - name clash + +void f(const A2&, int, const A2&, const A2&, const A2&, + int&) { } // ERROR - name clash +int f__FRC1AiRCB0n2Ri = 0; // ERROR - name clash + +void f(const A2&, int, const A2&, const A2&, const A2&, int&, int&, + int&) { } // ERROR - name clash +int f__FRC1AiRCB0n2Rin2 = 0; // ERROR - name clash + +void f(const A2&, int, const A2&, const A2&, const A2&, int, int, + int) { } // ERROR - name clash +int f__FRC1AiRCB0n2in2 = 0; // ERROR - name clash diff --git a/gcc/testsuite/g++.old-deja/g++.other/mutable1.C b/gcc/testsuite/g++.old-deja/g++.other/mutable1.C new file mode 100644 index 00000000000..3fd0c3e6b7c --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.other/mutable1.C @@ -0,0 +1,43 @@ +// Copyright (C) 1999 Free Software Foundation, Inc. +// Contributed by Nathan Sidwell 14 Jan 1999 <nathan@acm.org> + +// Make sure objects with mutable members are never placed in a read only +// section. + +// All these are POD structs, and hence do not need ctors +struct A { mutable int i; }; +struct B { A a; }; +struct C { A a[1]; }; +struct D { static A const a; }; + +// all these are static consts and hence naively suitable for a read only +// section. But they contain a mutable, so must be in a writable section. +static int const i = 0; +static A const a = {0}; +static B const b = {{0}}; +static C const c = {{{0}}}; +static A const aa[] = {{0}}; +static B const bb[] = {{{0}}}; +static C const cc[] = {{{{0}}}}; +A const D::a = {0}; + +int main() +{ + a.i = 05; + b.a.i = 05; + c.a[0].i = 05; + aa[0].i = 05; + bb[0].a.i = 05; + cc[0].a[0].i = 05; + D::a.i = 05; + + if(!a.i) return 1; + if(!b.a.i) return 1; + if(!c.a[0].i) return 1; + if(!aa[0].i) return 1; + if(!bb[0].a.i) return 1; + if(!cc[0].a[0].i) return 1; + if(!D::a.i) return 1; + + return 0; +} diff --git a/gcc/testsuite/g++.old-deja/g++.other/null3.C b/gcc/testsuite/g++.old-deja/g++.other/null3.C new file mode 100644 index 00000000000..aef456e974a --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.other/null3.C @@ -0,0 +1,6 @@ +// Build don't link: + +void x() +{ + int* p = 1==0; +} diff --git a/gcc/testsuite/g++.old-deja/g++.other/overload7.C b/gcc/testsuite/g++.old-deja/g++.other/overload7.C new file mode 100644 index 00000000000..57bec8bed2d --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.other/overload7.C @@ -0,0 +1,22 @@ +// Check that object call works when there are multiple conversion ops +// returning the same type. + +typedef int (*pfn)(); + +int zero () { return 0; } +int one () { return 1; } +int two () { return 2; } + +struct A { + A() { } + operator pfn () { return one; } + operator pfn () const { return zero; } + operator pfn () volatile { return two; } +}; + +int +main () +{ + const A a; + return a(); +} diff --git a/gcc/testsuite/g++.old-deja/g++.other/overload8.C b/gcc/testsuite/g++.old-deja/g++.other/overload8.C new file mode 100644 index 00000000000..d2c1483a9b2 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.other/overload8.C @@ -0,0 +1,22 @@ +class a { +public: + int f() { return 0; } + int f() const { return 1; } +}; + +class b : public a { +}; + +int main() +{ + int (b::* ptr1)() = &b::f; + int (b::* ptr2)() const = &b::f; + + b ao; + + if ((ao.*ptr1)() != 0) + return 1; + if ((ao.*ptr2)() != 1) + return 1; +} + diff --git a/gcc/testsuite/g++.old-deja/g++.other/overload9.C b/gcc/testsuite/g++.old-deja/g++.other/overload9.C new file mode 100644 index 00000000000..521f4bd4d06 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.other/overload9.C @@ -0,0 +1,31 @@ +struct T { ~T() {}; }; + +int g () +{ + foo: + T t; + int f(int); + bar: + T t2; + int f(double); + return f(3); +} + + +int f(int) +{ + return 0; +} + + +int f(double) +{ + return 1; +} + + +int main() +{ + return g(); +} + diff --git a/gcc/testsuite/g++.old-deja/g++.other/pmf2.C b/gcc/testsuite/g++.old-deja/g++.other/pmf2.C new file mode 100644 index 00000000000..92935c0e451 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.other/pmf2.C @@ -0,0 +1,18 @@ +// Build don't link: + +// submitted by David C Binderman <dcb@pncl.co.uk> + +struct S +{ + void f(); +}; + +void (S ::* pmf) (); + +S * pf; + +void +f() +{ + pmf = & pf->f; // ERROR - not a valid pmf expression +} diff --git a/gcc/testsuite/g++.old-deja/g++.other/pmf3.C b/gcc/testsuite/g++.old-deja/g++.other/pmf3.C new file mode 100644 index 00000000000..237812246e5 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.other/pmf3.C @@ -0,0 +1,24 @@ +// Submitted by Nathan Sidwell <nathan@acm.org> +// Bug: g++ was crashing after giving errors. + +template<class T> + void connect_to_method( + T *receiver, + void (T::*method)()) + {} + +class Gtk_Base +{ +public: + void expose(); + void show(); + void show(int); + Gtk_Base(); +}; + + +Gtk_Base::Gtk_Base() +{ + connect_to_method(this,&show); // ERROR - invalid pmf expression + connect_to_method(this,&expose); // ERROR - invalid pmf expression +} diff --git a/gcc/testsuite/g++.old-deja/g++.other/printf1.C b/gcc/testsuite/g++.old-deja/g++.other/printf1.C new file mode 100644 index 00000000000..04c4d9f8de5 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.other/printf1.C @@ -0,0 +1,14 @@ +// Build don't link: +// Special g++ Options: -Wall + +struct a +{ + void x(char *f,...) __attribute__((format(printf,2,3))); +}; + +int main() +{ + a A; + A.x("%d"); // WARNING - too few arguments for format + return 0; +} diff --git a/gcc/testsuite/g++.old-deja/g++.other/ptrmem4.C b/gcc/testsuite/g++.old-deja/g++.other/ptrmem4.C new file mode 100644 index 00000000000..dc378b23e6f --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.other/ptrmem4.C @@ -0,0 +1,12 @@ +// Test to make sure g++ can handle target types that aren't identical +// with pointers to members. + +struct A { int i; }; +struct B : public A { }; + +int main () +{ + int A::*p = &A::i; + const int B::*q = &A::i; + return p != q; +} diff --git a/gcc/testsuite/g++.old-deja/g++.other/redecl2.C b/gcc/testsuite/g++.old-deja/g++.other/redecl2.C new file mode 100644 index 00000000000..7dcdeb4cbe8 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.other/redecl2.C @@ -0,0 +1,9 @@ +// Build don't link: + +struct S { + S(int); + S(int); // ERROR - already declared + + ~S(); + ~S(); // ERROR - already declared +}; diff --git a/gcc/testsuite/g++.old-deja/g++.other/signed.C b/gcc/testsuite/g++.old-deja/g++.other/signed.C new file mode 100644 index 00000000000..3bdce03a3e4 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.other/signed.C @@ -0,0 +1,16 @@ +// Build don't link: + +// Copyright (C) 1999 Free Software Foundation, Inc. +// Contributed by Nathan Sidwell 24 Mar 1999 <nathan@acm.org> + +// Determine that function style casts are groked + +void fn() +{ + +char(5); + +short(5); + +int(5); + +long(5); + +signed(5); + +unsigned(5); +} diff --git a/gcc/testsuite/g++.old-deja/g++.other/static3.C b/gcc/testsuite/g++.old-deja/g++.other/static3.C new file mode 100644 index 00000000000..b75771e76e2 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.other/static3.C @@ -0,0 +1,14 @@ +// Build don't link: + +class S +{ + ~S(); +public: + friend void f(); +}; + + +S::~S() +{ + static S s; +} diff --git a/gcc/testsuite/g++.old-deja/g++.other/string1.C b/gcc/testsuite/g++.old-deja/g++.other/string1.C new file mode 100644 index 00000000000..425e9bf817c --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.other/string1.C @@ -0,0 +1,20 @@ +// Build don't link: +// Origin: mrs@wrs.com (Mike Stump) + +class Wrapper { +public: + static const char msgPtr[]; + static const char *JunkFunc() { + return &msgPtr[0]; + } +}; + +const char Wrapper::msgPtr[] = "Hello world."; + +int main() { + const char *p1 = &Wrapper::msgPtr[0]; + const char *p2 = Wrapper::JunkFunc(); + + if (p1 != p2) + return 1; +} diff --git a/gcc/testsuite/g++.old-deja/g++.other/typeck1.C b/gcc/testsuite/g++.old-deja/g++.other/typeck1.C new file mode 100644 index 00000000000..6dd5fed5c25 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.other/typeck1.C @@ -0,0 +1,17 @@ +// Build don't link: + +extern int a[][]; // ERROR - invalid multidimensional array +extern int b[7][]; // ERROR - invalid multidimensional array +extern int c[][7]; // OK + +extern int (*i)[]; // ERROR - previous declaration +extern int (*i)[7]; // ERROR - conflicting types for `i' + +extern int m[]; +extern int m[7]; // OK + +void f(int (*j)[3]) +{ + extern int (*k)[]; + f(k); // ERROR - passing wrong type +} diff --git a/gcc/testsuite/g++.old-deja/g++.other/typedef6.C b/gcc/testsuite/g++.old-deja/g++.other/typedef6.C new file mode 100644 index 00000000000..53b81669172 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.other/typedef6.C @@ -0,0 +1,17 @@ +// Submitted by Jason Merrill <jason@cygnus.com>. +// Bug: g++ fails to see through the T typedef in the C ctor. +// Build don't link: + +struct A { + A (int) { } +}; + +typedef A T; + +struct B: public virtual T { + B (): T(1) { } +}; + +struct C: public B { + C (): T(1) { } +}; diff --git a/gcc/testsuite/g++.old-deja/g++.other/union1.C b/gcc/testsuite/g++.old-deja/g++.other/union1.C new file mode 100644 index 00000000000..6573b4d055f --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.other/union1.C @@ -0,0 +1,16 @@ +// Build don't link: + +class A +{ + private: + int myInt; + + public: + A& operator = (int right) {myInt = right; return *this;} +}; + +union B +{ + char f1; + A f2; // gets bogus error - non-copy assignment op is OK +}; diff --git a/gcc/testsuite/g++.old-deja/g++.other/using5.C b/gcc/testsuite/g++.old-deja/g++.other/using5.C new file mode 100644 index 00000000000..57a9507b0b3 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.other/using5.C @@ -0,0 +1,17 @@ +// Build don't link: + +// Based on bug report by Klaus-Georg Adams +// <Klaus-Georg.Adams@chemie.uni-karlsruhe.de> + +// crash test - XFAIL *-*-* + +struct bar { + typedef bar t; +}; + +struct foo : bar { + using bar::t; + t field; + t meth(); + void baz(t arg); +}; diff --git a/gcc/testsuite/g++.old-deja/g++.other/virtual2.C b/gcc/testsuite/g++.old-deja/g++.other/virtual2.C new file mode 100644 index 00000000000..a3ebbcd40e1 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.other/virtual2.C @@ -0,0 +1,19 @@ +struct B +{ + virtual int f() volatile + { return 0; } +}; + + +struct D : public B +{ + virtual int f() + { return 1; } +}; + +int main() +{ + volatile D d; + volatile B& b = d; + return b.f(); +} diff --git a/gcc/testsuite/g++.old-deja/g++.other/virtual3.C b/gcc/testsuite/g++.old-deja/g++.other/virtual3.C new file mode 100644 index 00000000000..b9a77191030 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.other/virtual3.C @@ -0,0 +1,24 @@ +struct B +{ + virtual int f() volatile + { return 1; } +}; + +struct D : public B +{ + int f() + { return 0; } +}; + +struct D2 : public D +{ + int f() + { return 2; } +}; + +int main() +{ + D2 d2; + D& d = d2; + return d.f(); +} diff --git a/gcc/testsuite/g++.old-deja/g++.other/virtual4.C b/gcc/testsuite/g++.old-deja/g++.other/virtual4.C new file mode 100644 index 00000000000..8a44ee14135 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.other/virtual4.C @@ -0,0 +1,25 @@ +// Build don't link: + +class A { +public: + virtual int foo() = 0; // ERROR - original definition +}; + +class B { +public: + virtual double foo() = 0; +}; + +class C + : public A, public B +{ +public: + virtual double foo() { return 2; } // ERROR - conflicting return type +}; + +class D + : public B, public A +{ +public: + virtual double foo() { return 2; } // ERROR - conflicting return type +}; diff --git a/gcc/testsuite/g++.old-deja/g++.pt/array2.C b/gcc/testsuite/g++.old-deja/g++.pt/array2.C new file mode 100644 index 00000000000..6c5810ed77b --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.pt/array2.C @@ -0,0 +1,14 @@ +// Build don't link: + +template<int N, class C> +class Bar {}; + +template<class C> +class Huh {}; + +template<int N> +void foo(const Bar<N,Huh<float[1]> > &x) {} + +int main() { + foo(Bar<3,Huh<float[1]> >()); +} diff --git a/gcc/testsuite/g++.old-deja/g++.pt/array3.C b/gcc/testsuite/g++.old-deja/g++.pt/array3.C new file mode 100644 index 00000000000..ec5e1e0e3a7 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.pt/array3.C @@ -0,0 +1,5 @@ +// Build don't link: +// Origin: Brendan Kehoe <brendan@cygnus.com> + + template <int x> int foo(char[4][x]) { return x; } + int (*bar)(char[4][3]) = &foo; diff --git a/gcc/testsuite/g++.old-deja/g++.pt/array4.C b/gcc/testsuite/g++.old-deja/g++.pt/array4.C new file mode 100644 index 00000000000..fab2d5b1527 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.pt/array4.C @@ -0,0 +1,14 @@ +// Test to make sure that the array bounds are treated as an expression +// in template parm substitution. + +// Written by Jason Merrill <jason@cygnus.com> + +// Build don't link: + +template <class T> void f (T t) { int ar[sizeof (T)]; } + +int +main () +{ + f (1); +} diff --git a/gcc/testsuite/g++.old-deja/g++.pt/copy1.C b/gcc/testsuite/g++.old-deja/g++.pt/copy1.C new file mode 100644 index 00000000000..7981530f697 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.pt/copy1.C @@ -0,0 +1,29 @@ +int i = 0; + +template <class T> +class F +{ +public: + F() {} + + template <class T2> F(F<T2>) + { + i = 1; + } +}; + + +F<int> +foo() +{ + F<int> f1; + F<int> f2(f1); + return f1; +} + +int +main() +{ + return i; +} + diff --git a/gcc/testsuite/g++.old-deja/g++.pt/crash25.C b/gcc/testsuite/g++.old-deja/g++.pt/crash25.C new file mode 100644 index 00000000000..f5875854562 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.pt/crash25.C @@ -0,0 +1,7 @@ +// Build don't link: + +template <class T> +void f() +{ + int i[1 << 3]; +} diff --git a/gcc/testsuite/g++.old-deja/g++.pt/crash26.C b/gcc/testsuite/g++.old-deja/g++.pt/crash26.C new file mode 100644 index 00000000000..d2101bd3b63 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.pt/crash26.C @@ -0,0 +1,15 @@ +// Build don't link: +// Origin: Theodore Papadopoulo <Theodore.Papadopoulo@sophia.inria.fr> + +double f(double); +typedef double (*M)(double); + +class A { +public: + template <const M n> void g(); +}; + +class B: public A { +public: + void g() { A::g<f>(); } +}; diff --git a/gcc/testsuite/g++.old-deja/g++.pt/crash27.C b/gcc/testsuite/g++.old-deja/g++.pt/crash27.C new file mode 100644 index 00000000000..f52f1ba9e02 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.pt/crash27.C @@ -0,0 +1,13 @@ +// Build don't link: + +template<int i> int f (void) +{ + if (__extension__ ({ 1; })) + return 0; + return 1; +} + +void g (void) +{ + f<1> (); +} diff --git a/gcc/testsuite/g++.old-deja/g++.pt/crash28.C b/gcc/testsuite/g++.old-deja/g++.pt/crash28.C new file mode 100644 index 00000000000..752c9706990 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.pt/crash28.C @@ -0,0 +1,14 @@ +// Build don't link: +// Special g++ Options: + +template <class ARRY> +inline unsigned int asize(ARRY &a) +{ + return sizeof(a) / sizeof(a[0]); +} + +int f(unsigned int n) { + int x[n]; + + asize(x); // ERROR - no matching function +}; diff --git a/gcc/testsuite/g++.old-deja/g++.pt/crash29.C b/gcc/testsuite/g++.old-deja/g++.pt/crash29.C new file mode 100644 index 00000000000..05bef969836 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.pt/crash29.C @@ -0,0 +1,69 @@ +// Build don't link: +// Origin: Steven Parkes <parkes@sierravista.com> + +typedef __SIZE_TYPE__ size_t; + +class UUId {}; + +template <class T> class MetaClass; + +class TypeInfo; + +struct MetaClassGeneric +{ + MetaClassGeneric( TypeInfo& ); +}; + +struct TypeInfo +{ + void (*constructor)( void* ); + void initialize( void* ); +}; + +template <class T> +class TypeIDInit { +public: + TypeIDInit(); + static void initialize(); + static TypeInfo info; + static int storage[]; + static void metaclassConstructor( void* ); +}; + +template <class T> +TypeInfo TypeIDInit<T>::info = +{ + TypeIDInit<T>::metaclassConstructor +}; + +template <class T> +inline +TypeIDInit<T>::TypeIDInit() +{ + info.initialize(storage); +} + +template <class T> +class NameInfo : public MetaClassGeneric { +public: + NameInfo() + : MetaClassGeneric( TypeIDInit<T>::info ) {} +}; + +class MetaClass<UUId> +: public NameInfo<UUId> +{ +}; + +extern "C++" +inline void *operator new(size_t, void *place) throw() { return place; } + +template <class T> +void +TypeIDInit<T>::metaclassConstructor( void* place ) +{ + new ( place ) MetaClass<T>; +} + +template class TypeIDInit<UUId> ; + diff --git a/gcc/testsuite/g++.old-deja/g++.pt/crash30.C b/gcc/testsuite/g++.old-deja/g++.pt/crash30.C new file mode 100644 index 00000000000..13dc37af68d --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.pt/crash30.C @@ -0,0 +1,15 @@ +// Build don't link: + +extern "C" int printf(const char *, ...); +template <class T> struct A { + typedef typename T::X B; // ERROR - not a class + A(double); +}; + +template <class T> void xxx(typename A<T>::B); + +template <class T> struct B { + friend void xxx<T>(T); // ERROR - does not match any template +}; + +template struct B<double>; // ERROR - diff --git a/gcc/testsuite/g++.old-deja/g++.pt/crash31.C b/gcc/testsuite/g++.old-deja/g++.pt/crash31.C new file mode 100644 index 00000000000..34758967c2e --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.pt/crash31.C @@ -0,0 +1,19 @@ +// Build don't link: +// Origin: Corey Kosak + +struct cow_t { + template<bool Q> + static void tfunc(cow_t *cowp) {} + + void moo() { + cow_t *cowp; + cow_t::tfunc<true>(cowp); + } +}; + + +int main() +{ + cow_t *cowp; + cow_t::tfunc<true>(cowp); +} diff --git a/gcc/testsuite/g++.old-deja/g++.pt/decl2.C b/gcc/testsuite/g++.old-deja/g++.pt/decl2.C new file mode 100644 index 00000000000..2e2b91cde86 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.pt/decl2.C @@ -0,0 +1,9 @@ +// Build don't link: + +// Simplified from testcase by Christophe Boyanique <boyan@imac.u-paris2.fr> + +// crash test - XFAIL *-*-* + +template <class T> struct foo { foo(); }; +template<class T> foo<T>::foo() {} +T // ERROR - currently an ICE diff --git a/gcc/testsuite/g++.old-deja/g++.pt/deduct1.C b/gcc/testsuite/g++.old-deja/g++.pt/deduct1.C new file mode 100644 index 00000000000..a87b2a7566e --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.pt/deduct1.C @@ -0,0 +1,27 @@ +// Build don't link: + +template<class CoordinateSystem, class MeshTag> +struct Mesh { }; + +struct RectGrid { }; + +struct RectMesh { }; + +struct Cartesian { }; + +template<class CS> +struct Mesh<CS, RectGrid> { }; + +template<class CS> +struct Mesh<CS, RectMesh> : public Mesh<CS, RectGrid> { }; + +template<class CS> +void foo(const Mesh<CS, RectGrid> &) +{ +} + +int main() +{ + Mesh<Cartesian, RectMesh> m; + foo(m); +} diff --git a/gcc/testsuite/g++.old-deja/g++.pt/defarg5.C b/gcc/testsuite/g++.old-deja/g++.pt/defarg5.C new file mode 100644 index 00000000000..6a68bad8251 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.pt/defarg5.C @@ -0,0 +1,24 @@ +// Build don't link: + +template <int dim> +class Point { + public: + Point (Point<dim> &); + Point<dim> & operator = (Point<dim> &); +}; + + + +template <int dim> +class bar{ + public: + void foo (Point<dim> p = Point<dim>()); +}; + + + +template <> +void bar<2>::foo (Point<2> p) { + const int dim = 2; + Point<dim> q = p; +}; diff --git a/gcc/testsuite/g++.old-deja/g++.pt/defarg6.C b/gcc/testsuite/g++.old-deja/g++.pt/defarg6.C new file mode 100644 index 00000000000..0094c5ca7e0 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.pt/defarg6.C @@ -0,0 +1,27 @@ +// Build don't link: + +template <class T> +struct C { + template <class U> + void f(U); // OK + + template <class V = int> + struct I {}; // OK + + template <class W = int> + void h(W); // ERROR - default argument + + template <class Y> + void k(Y); +}; + +template <class T> +template <class U = double> +void C<T>::f(U) {} // ERROR - default argument + +template <class X = void*> +void g(X); // ERROR - default argument + +template <class T = double> +template <class Y> +void C<T>::k(Y) {} // ERROR - default argument diff --git a/gcc/testsuite/g++.old-deja/g++.pt/defarg7.C b/gcc/testsuite/g++.old-deja/g++.pt/defarg7.C new file mode 100644 index 00000000000..0db043fb633 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.pt/defarg7.C @@ -0,0 +1,11 @@ +// Build don't link: + +template <int Dim, class T, class EngineTag> +class Engine {}; + +struct Brick; + +template<int Dim, class T = double , class EngineTag = Brick > +struct ConstArray { + static const int dimensions = Engine<Dim, T, EngineTag>::dimensions; +}; diff --git a/gcc/testsuite/g++.old-deja/g++.pt/defarg8.C b/gcc/testsuite/g++.old-deja/g++.pt/defarg8.C new file mode 100644 index 00000000000..6bb1125259c --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.pt/defarg8.C @@ -0,0 +1,14 @@ +// Build don't link: + +// Default arguments containing more than one non-nested explicit +// template argument leads to parse error + +template <class T> class foo1; +template <class T, class U> class foo2; + +struct bar { + template <class T, class U> + bar(int i = foo1<T>::baz, // ok + int j = int(foo2<T, U>::baz), // ok + int k = foo2<T, U>::baz) {} // gets bogus error - before > - XFAIL *-*-* +}; diff --git a/gcc/testsuite/g++.old-deja/g++.pt/derived1.C b/gcc/testsuite/g++.old-deja/g++.pt/derived1.C new file mode 100644 index 00000000000..e2275f4328d --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.pt/derived1.C @@ -0,0 +1,24 @@ +// Build don't link: + +class A +{ +public: + typedef int Info; +}; + +template <class T> +class B : public A +{ +public: + typedef struct{ + int a; + int b; + } Info; +}; + +void f() +{ + B<A>::Info ie; + ie.a=1; + ie.b=2; +} diff --git a/gcc/testsuite/g++.old-deja/g++.pt/derived2.C b/gcc/testsuite/g++.old-deja/g++.pt/derived2.C new file mode 100644 index 00000000000..737792cab9f --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.pt/derived2.C @@ -0,0 +1,35 @@ +// Build don't link: +// Special g++ Options: + +template <typename T> +void f(T); +template <> +void f(int) {} + +struct B { + typedef int I; +}; + +template <typename T> +struct D1 : virtual public B { + typedef T I; +}; + + +template <typename T> +struct D : virtual public B, public D1<T> +{ + void g() + { + I i; + f(i); + } +}; + +int +main() +{ + D<double> d; + d.g(); +} + diff --git a/gcc/testsuite/g++.old-deja/g++.pt/explicit74.C b/gcc/testsuite/g++.old-deja/g++.pt/explicit74.C new file mode 100644 index 00000000000..c49d16919a8 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.pt/explicit74.C @@ -0,0 +1,10 @@ +// Reduced from a testcase by Yotam Medini <yotam@avanticorp.com> + +// egcs 1.1 seems to generate code that deletes a NULL pointer. + +template <class bar> struct foo { void fuz(); ~foo(); }; +struct baz { int i; foo<baz> j; } *p = 0; +template <class bar> void foo<bar>::fuz() { delete p; } +template <class bar> foo<bar>::~foo() { delete p; } +template class foo<baz>; +int main() { foo<baz>(); } diff --git a/gcc/testsuite/g++.old-deja/g++.pt/explicit75.C b/gcc/testsuite/g++.old-deja/g++.pt/explicit75.C new file mode 100644 index 00000000000..433f0b193e3 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.pt/explicit75.C @@ -0,0 +1,11 @@ +// Test for not complaining about mismatches during unification. +// Build don't link: + +template <void (*F)(int)> void f(); +template <void (*F)(double)> void f(); +extern void g(double); + +void h () +{ + f<g>(); +} diff --git a/gcc/testsuite/g++.old-deja/g++.pt/explicit76.C b/gcc/testsuite/g++.old-deja/g++.pt/explicit76.C new file mode 100644 index 00000000000..18c161c6e27 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.pt/explicit76.C @@ -0,0 +1,11 @@ +// Build don't link: + +// Based on bug report by Simon A. Crase <s.crase@ieee.org> + +// crash test - XFAIL *-*-* + +struct foo { + template <class T> void bar(); +}; + +template void foo::bar<void>(); // gets bogus error - ICE - XFAIL *-*-* diff --git a/gcc/testsuite/g++.old-deja/g++.pt/explicit77.C b/gcc/testsuite/g++.old-deja/g++.pt/explicit77.C new file mode 100644 index 00000000000..5a07f8e0168 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.pt/explicit77.C @@ -0,0 +1,18 @@ +// Build don't link: + +template <int I, int J, int K> +struct S {}; + +template <int I, int J> +struct S<I, J, 2> : public S<I, I, I>, S<J, J, J> {}; + +template <int I, int J, int K> +void f(S<I, J, K>, S<I, I, I>); + +void g() { + S<0, 0, 0> s0; + S<0, 1, 2> s2; + + f<0>(s0, s2); + f(s0, s2); // ERROR - no matching function +} diff --git a/gcc/testsuite/g++.old-deja/g++.pt/explicit78.C b/gcc/testsuite/g++.old-deja/g++.pt/explicit78.C new file mode 100644 index 00000000000..2375816af87 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.pt/explicit78.C @@ -0,0 +1,28 @@ +// Build don't link: + +template <int I> +struct A { +}; + +template <int I, int J> +struct B { + operator A<3> (); + operator B<3, 7> (); +}; + + +template <int I, int J> +void f(B<I, J>); + +template <int I> +void f(A<I>) +{ +} + +int main() +{ + // Deduction fails with the first `f'. Since `3' is explicitly + // specified, we don't try any deduction with the second `f'. So, + // we call the second `f'. + f<3>(B<2, 7>()); +} diff --git a/gcc/testsuite/g++.old-deja/g++.pt/explicit79.C b/gcc/testsuite/g++.old-deja/g++.pt/explicit79.C new file mode 100644 index 00000000000..16429ba6213 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.pt/explicit79.C @@ -0,0 +1,12 @@ +// Build don't link: + +template <int I> +void f(int (*)[I] = 0); + +template <int J> +void f(); + +void g() +{ + f<-1>(); +} diff --git a/gcc/testsuite/g++.old-deja/g++.pt/expr6.C b/gcc/testsuite/g++.old-deja/g++.pt/expr6.C new file mode 100644 index 00000000000..e1d38de7e56 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.pt/expr6.C @@ -0,0 +1,9 @@ +// Build don't link: + +// Based on a bug report by tveldhui <tveldhui@extreme.indiana.edu> + +// excess errors test - XFAIL *-*-* + +template <int X> class foo {}; + +foo< true ? 1 : 0 > bar; diff --git a/gcc/testsuite/g++.old-deja/g++.pt/expr7.C b/gcc/testsuite/g++.old-deja/g++.pt/expr7.C new file mode 100644 index 00000000000..5fb567b5b77 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.pt/expr7.C @@ -0,0 +1,8 @@ +// Build don't link: + +template<int I> struct A { }; +template<int I, int J> int f(A<I+J>); +int g() { + A<3> a; + return f<1,2>(a); +} diff --git a/gcc/testsuite/g++.old-deja/g++.pt/friend36.C b/gcc/testsuite/g++.old-deja/g++.pt/friend36.C new file mode 100644 index 00000000000..4a9042ad3ec --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.pt/friend36.C @@ -0,0 +1,12 @@ +// Build don't link: + +template <class T> +void f(T) {} // ERROR - previously defined here + +template <class U> +struct S { + template <class T> + friend void f(T) {} // ERROR - redeclaration +}; + +S<int> si; diff --git a/gcc/testsuite/g++.old-deja/g++.pt/friend37.C b/gcc/testsuite/g++.old-deja/g++.pt/friend37.C new file mode 100644 index 00000000000..2379d5f1da7 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.pt/friend37.C @@ -0,0 +1,8 @@ +// Build don't link: +// Simplified from report by Volker Dobler <volker@hugo.physik.uni-konstanz.de> + +// crash test - XFAIL *-*-* + +template <class T> class A { + friend int ice<>( int k=0 ); // ERROR - undeclared +}; diff --git a/gcc/testsuite/g++.old-deja/g++.pt/friend38.C b/gcc/testsuite/g++.old-deja/g++.pt/friend38.C new file mode 100644 index 00000000000..e3a6a060ef6 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.pt/friend38.C @@ -0,0 +1,8 @@ +// Build don't link: + +// Overly simplified from testcase by "B. K. Oxley" <binkley@bigfoot.com> + +template<class P> struct foo { + typedef P parent_type; + friend parent_type; // ERROR - template parameters cannot be friends - XFAIL *-*-* +}; diff --git a/gcc/testsuite/g++.old-deja/g++.pt/friend39.C b/gcc/testsuite/g++.old-deja/g++.pt/friend39.C new file mode 100644 index 00000000000..836c83054bb --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.pt/friend39.C @@ -0,0 +1,23 @@ +// Build don't link: + +template <class T> +struct S; + +template <class T> +class C +{ + friend void S<T>::f(); + + int i; +}; + +template <class T> +struct S +{ + void f() { + C<T> c; + c.i = 3; + } +}; + +template void S<int>::f(); diff --git a/gcc/testsuite/g++.old-deja/g++.pt/friend40.C b/gcc/testsuite/g++.old-deja/g++.pt/friend40.C new file mode 100644 index 00000000000..90288e8a336 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.pt/friend40.C @@ -0,0 +1,12 @@ +// Build don't link: +// Origin: Jason Merrill <jason@cygnus.com> +// Special g++ Options: -Wno-non-template-friend + +template<class T> struct A +{ + friend void f (); +}; + +A<short> a; +A<int> b; + diff --git a/gcc/testsuite/g++.old-deja/g++.pt/inherit1.C b/gcc/testsuite/g++.old-deja/g++.pt/inherit1.C new file mode 100644 index 00000000000..6ae70c1bb9e --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.pt/inherit1.C @@ -0,0 +1,25 @@ +// Origin: Wolfgang Bangerth <wolf@gaia.iwr.uni-heidelberg.de> + +int i = 1; + +struct Base1 { int local1; }; +struct Base2 { int local2; }; + +template <int dim> class Derived; + +template <> +class Derived<1> : public Base1, public Base2 {}; + +template <int dim> +class FinalClass : public Derived<dim> { +public: + FinalClass () { + if (&local1 != &local2) + i = 0; + } +}; + +int main () { + FinalClass<1> a1; + return i; +} diff --git a/gcc/testsuite/g++.old-deja/g++.pt/instantiate4.C b/gcc/testsuite/g++.old-deja/g++.pt/instantiate4.C new file mode 100644 index 00000000000..296356b713f --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.pt/instantiate4.C @@ -0,0 +1,27 @@ +// Build then link: + +// Special g++ Options: -frepo -Werror + +// Submitted by Melissa O'Neill <oneill@cs.sfu.ca> +// the vtable of Foo<int> wouldn't be generated + +template <typename A> +struct Foo { + virtual void foo() {} +}; + +template <typename A> +struct Bar { + void bar(); +}; + +template <typename A> +void Bar<A>::bar() { + Foo<A> oof; +} + +int main () { + Bar<int> rab; + + rab.bar(); +} diff --git a/gcc/testsuite/g++.old-deja/g++.pt/instantiate5-main.cc b/gcc/testsuite/g++.old-deja/g++.pt/instantiate5-main.cc new file mode 100644 index 00000000000..be64bdbc4c2 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.pt/instantiate5-main.cc @@ -0,0 +1,3 @@ +// this file is part of testcase instantiate5.C + +int main() {} diff --git a/gcc/testsuite/g++.old-deja/g++.pt/instantiate5.C b/gcc/testsuite/g++.old-deja/g++.pt/instantiate5.C new file mode 100644 index 00000000000..70eefcbb455 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.pt/instantiate5.C @@ -0,0 +1,14 @@ +// Build don't run: + +// Additional sources: instantiate5.cc instantiate5-main.cc + +// `global constructors' are given the same name, based on foo(), on +// both translation units, which is wrong, because it must be possible +// to define template functions in multiple translation units, as long +// as they're given the same definition + +// simplified from test case submitted by Daniel X. Pape <dpape@canis.uiuc.edu> + +template <class T> void foo() { } +inline int bar() { foo<void>(); return 1; } +static int i = bar(); diff --git a/gcc/testsuite/g++.old-deja/g++.pt/instantiate5.cc b/gcc/testsuite/g++.old-deja/g++.pt/instantiate5.cc new file mode 100644 index 00000000000..fc86e0f8309 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.pt/instantiate5.cc @@ -0,0 +1,5 @@ +// this file is part of testcase instantiate5.C + +template <class T> void foo() { } +inline int bar() { foo<void>(); return 1; } +static int i = bar(); diff --git a/gcc/testsuite/g++.old-deja/g++.pt/instantiate6.C b/gcc/testsuite/g++.old-deja/g++.pt/instantiate6.C new file mode 100644 index 00000000000..e896ed32570 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.pt/instantiate6.C @@ -0,0 +1,26 @@ +// Build then link: +// Special g++ Options: -frepo + +// Simplified from testcase by Erez Louidor Lior <s3824888@techst02.technion.ac.il> +// excess errors test - XFAIL *-*-* + +template <class T> +class foo{ +public: + void g(); + void h(); +}; + +template <class T> +void foo<T>::g() { + h(); +} + +template <class T> +void foo<T>::h() { +} + +int main() { + foo<int> f; + f.g(); +} diff --git a/gcc/testsuite/g++.old-deja/g++.pt/lookup6.C b/gcc/testsuite/g++.old-deja/g++.pt/lookup6.C new file mode 100644 index 00000000000..ae1f5ca2c5b --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.pt/lookup6.C @@ -0,0 +1,15 @@ +// Build don't link: + +// Based on bug report by Miniussi <miniussi@ilog.fr> + +class t {}; + +template <class T> struct A { typedef T t; typedef T u; }; + +template <class T> struct B : public A<T> { + // according to [temp.dep.type], `t' and `u' cannot be dependent types, + // and so there's no reason to delay lookup to specialization time. + void f(t p); // this is ::t [temp.dep]/3 + void f(typename A<T>::t p); // gets bogus error - redefinition + void g(u p); // ERROR - unknown type name +}; diff --git a/gcc/testsuite/g++.old-deja/g++.pt/memclass17.C b/gcc/testsuite/g++.old-deja/g++.pt/memclass17.C new file mode 100644 index 00000000000..96024e21859 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.pt/memclass17.C @@ -0,0 +1,22 @@ +// Build don't link: + +template <class T> struct S +{ + template <class U> struct I + { + }; + + S(); + S(S& s); + S(I<T>); + + template <class U> operator I<U>(); +}; + +S<int> f(); +void g(S<int>); + +void h() +{ + g(f()); +} diff --git a/gcc/testsuite/g++.old-deja/g++.pt/memclass18.C b/gcc/testsuite/g++.old-deja/g++.pt/memclass18.C new file mode 100644 index 00000000000..bb7f6f12b99 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.pt/memclass18.C @@ -0,0 +1,9 @@ +// Build don't link: + +template <class T> struct A { + template <class U> struct B; +}; + +template <class T> template <class U> struct A<T>::B { }; + +A<int>::B<int> b; diff --git a/gcc/testsuite/g++.old-deja/g++.pt/memclass19.C b/gcc/testsuite/g++.old-deja/g++.pt/memclass19.C new file mode 100644 index 00000000000..6a8b0a7d11c --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.pt/memclass19.C @@ -0,0 +1,9 @@ +// Build don't link: + +template <class T> struct A { + template <class U> struct B; +}; + +template <class T> template <class U> struct A<T>::B<U*> { }; + +A<int>::B<int*> b; diff --git a/gcc/testsuite/g++.old-deja/g++.pt/memtemp78.C b/gcc/testsuite/g++.old-deja/g++.pt/memtemp78.C new file mode 100644 index 00000000000..945e7ff68f0 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.pt/memtemp78.C @@ -0,0 +1,56 @@ +// Build don't link: + +struct A +{ + void f() {} + + template <class U> + void f() {} +}; + + +template <class T> +struct B +{ + void f() {} + + template <class U> + void f() {} +}; + +template struct B<int>; + +struct C +{ + template <class U> + void f() {} + + template <class U> + void f() {} // ERROR - redeclaration +}; + + +template <class T, class U> +struct D +{ + void f(T); + void f(U); +}; + +template struct D<int, double>; + +template <class T, class U> +struct D2 +{ + void f(T); + void f(U); // ERROR - redeclaration +}; + +template struct D2<int, int>; + +struct E +{ + void f(); + void f(); // ERROR - redeclaration +}; + diff --git a/gcc/testsuite/g++.old-deja/g++.pt/memtemp79.C b/gcc/testsuite/g++.old-deja/g++.pt/memtemp79.C new file mode 100644 index 00000000000..4eeffde4e7c --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.pt/memtemp79.C @@ -0,0 +1,6 @@ +// Build don't link: + +struct foo { + template<typename T> static void bar( foo* ); + template<typename T> void bar() const; // gets bogus error - quals XFAIL *-*-* +}; diff --git a/gcc/testsuite/g++.old-deja/g++.pt/memtemp80.C b/gcc/testsuite/g++.old-deja/g++.pt/memtemp80.C new file mode 100644 index 00000000000..61a2fb87033 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.pt/memtemp80.C @@ -0,0 +1,16 @@ +// Build don't link: + +template<typename T> T baz() { return 0; } + +struct foo { + template<typename T> static T staticbar() { return 0; } + template<typename T> T bar() { return 0; } +}; + +void f() +{ + foo t; + int i = baz<int>(); + int j = foo::staticbar<int>(); + int k = t.bar<int>(); +} diff --git a/gcc/testsuite/g++.old-deja/g++.pt/memtemp81.C b/gcc/testsuite/g++.old-deja/g++.pt/memtemp81.C new file mode 100644 index 00000000000..1584f88b802 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.pt/memtemp81.C @@ -0,0 +1,24 @@ +// Build don't link: + +template <int i> class a +{ +public : +int k; + +template <int j> int f() const { return this->f<j-1>(); } + +int g() const { return f<i>(); }; +}; + +template <> +template <> +int a<2>::f<0>() const { + return 0; +} + +int main() +{ +a<2> x; +return x.g(); +} + diff --git a/gcc/testsuite/g++.old-deja/g++.pt/memtemp82.C b/gcc/testsuite/g++.old-deja/g++.pt/memtemp82.C new file mode 100644 index 00000000000..d4bb37aa410 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.pt/memtemp82.C @@ -0,0 +1,13 @@ +// Build don't link: +// excess errors test + +struct foo { + template<typename T> T bar() { return staticbar<T>( this ); } + template<typename T> static T staticbar( foo* ) { return 0; } +}; + +void f() +{ + foo t; + int k = t.bar<int>(); +} diff --git a/gcc/testsuite/g++.old-deja/g++.pt/memtemp83.C b/gcc/testsuite/g++.old-deja/g++.pt/memtemp83.C new file mode 100644 index 00000000000..69ab94820b0 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.pt/memtemp83.C @@ -0,0 +1,19 @@ +// Build don't link: +// Origin: Corey Kosak <kosak@cs.cmu.edu> + +struct cow_t { + template<bool Q> + static void tfunc(cow_t *cowp) {} + + void moo() { + cow_t *cowp; + tfunc<true>(cowp); + } +}; + + +int main() +{ + cow_t *cowp; + cow_t::tfunc<true>(cowp); +} diff --git a/gcc/testsuite/g++.old-deja/g++.pt/nttp1.C b/gcc/testsuite/g++.old-deja/g++.pt/nttp1.C new file mode 100644 index 00000000000..36b743848c4 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.pt/nttp1.C @@ -0,0 +1,21 @@ +// Test for nested template template parameter feature + +template <template<template <class> class> class TTT> struct C +{ + int f(); +}; + +template <template<template <class> class> class TTT> int C<TTT>::f() +{ + return 0; +} + +template <template <class> class TT> struct D +{ +}; + +int main() +{ + C<D> c; + c.f(); +} diff --git a/gcc/testsuite/g++.old-deja/g++.pt/nttp2.C b/gcc/testsuite/g++.old-deja/g++.pt/nttp2.C new file mode 100644 index 00000000000..08781daf516 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.pt/nttp2.C @@ -0,0 +1,30 @@ +// Test for nested template template parameter feature + +template <template<template <class> class> class TTT> struct C +{ + int f() { return 0; } +}; + +template <template <class> class TT> struct D +{ + int a; +}; + +template <template <class> class TT> struct E +{ + int a; + int b; +}; + +template <template <template <template<class> class> class> class TTT> +int g(TTT<E> t) +{ + TTT<D> tt; + return tt.f(); +} + +int main() +{ + C<E> c; + g(c); +} diff --git a/gcc/testsuite/g++.old-deja/g++.pt/overload10.C b/gcc/testsuite/g++.old-deja/g++.pt/overload10.C new file mode 100644 index 00000000000..19dd174a019 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.pt/overload10.C @@ -0,0 +1,16 @@ +struct B { + int f(int) { return 1; } +}; + +struct D { + template <class T> + int f(T) { return 0; } +}; + +int main() +{ + int (D::*g)(int) = &D::f; + + D d; + return (d.*g)(0); +} diff --git a/gcc/testsuite/g++.old-deja/g++.pt/overload11.C b/gcc/testsuite/g++.old-deja/g++.pt/overload11.C new file mode 100644 index 00000000000..300d91ea2b8 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.pt/overload11.C @@ -0,0 +1,27 @@ +// Build don't run: + +template <class T> +int f(int (*fn)(T)) +{ + return (*fn)(3); +} + +struct S { + static int g(int) { return 1; } + static void g(); + + int h(); +}; + +int S::h() +{ + return f(&g); +} + + +int main() +{ + S s; + if (s.h () != 1) + return 1; +} diff --git a/gcc/testsuite/g++.old-deja/g++.pt/overload12.C b/gcc/testsuite/g++.old-deja/g++.pt/overload12.C new file mode 100644 index 00000000000..bf37bb66867 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.pt/overload12.C @@ -0,0 +1,21 @@ +// Testcase for not trying a candidate that would generate an ill-formed +// instantiation. + +template <int N> struct A { + int ar[N]; +}; + +template <int N> struct B { + B () { }; + B (const A<N> &) { }; + B (const A<N-1> &, int); +}; + +int +main () +{ + A<1> a; + B<1> b1; + B<1> b2 (a); +} + diff --git a/gcc/testsuite/g++.old-deja/g++.pt/overload6.C b/gcc/testsuite/g++.old-deja/g++.pt/overload6.C new file mode 100644 index 00000000000..10f793a8633 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.pt/overload6.C @@ -0,0 +1,13 @@ +// Check that foo<int> isn't resolved too early. + +template <class T> void foo(T*); +template <class T, class U> void foo(T*, U) { } + +template <class T, class U> void bar(void (*)(T, U), U) { } + +int main() { + bar<int*>(&foo, 1); + bar<int*>(&foo<int>, 1); + bar<int*>(foo, 1); + bar<int*>(foo<int>, 1); +} diff --git a/gcc/testsuite/g++.old-deja/g++.pt/overload7.C b/gcc/testsuite/g++.old-deja/g++.pt/overload7.C new file mode 100644 index 00000000000..bfd8b5a5eb4 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.pt/overload7.C @@ -0,0 +1,20 @@ +// Build don't link: + +// Adapted from testcase by Corey Kosak <kosak@cs.cmu.edu> + +template<class T> +struct moo_t { + struct cow_t {}; +}; + +template<class T> void foo(typename moo_t<T>::cow_t) {} + +template<class T> void foo(moo_t<T>) { + typename moo_t<T>::cow_t p; + foo(p); // gets bogus error - no matching function for call - XFAIL *-*-* +} + +int main() { + moo_t<int> x; + foo(x); // gets bogus error - instantiated from here - XFAIL *-*-* +} diff --git a/gcc/testsuite/g++.old-deja/g++.pt/overload8.C b/gcc/testsuite/g++.old-deja/g++.pt/overload8.C new file mode 100644 index 00000000000..9f38a5cb256 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.pt/overload8.C @@ -0,0 +1,12 @@ +// Build don't link: + +// Simplified from bug report by Tim Rowley <tor@cs.brown.edu> + +struct baz; + +void operator*(baz&, double); + +template <class T> inline T operator*(double s, const T &p) + ; // gets bogus error - must have argument of class type - XFAIL *-*-* + +void m(baz& a) { a * .5; } diff --git a/gcc/testsuite/g++.old-deja/g++.pt/overload9.C b/gcc/testsuite/g++.old-deja/g++.pt/overload9.C new file mode 100644 index 00000000000..bd9eeb1791a --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.pt/overload9.C @@ -0,0 +1,21 @@ +template <class T> +int f(T) +{ + return 1; +} + + +template <class T> +int f(T*) +{ + return 0; +} + + +int main() +{ + int (*h)(int*) = &f; + int (&k)(int*) = f; + + return (*h)(0) || (*k)(0); +} diff --git a/gcc/testsuite/g++.old-deja/g++.pt/ptrmem3.C b/gcc/testsuite/g++.old-deja/g++.pt/ptrmem3.C new file mode 100644 index 00000000000..8b7c373c1b7 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.pt/ptrmem3.C @@ -0,0 +1,12 @@ +// Build don't link: + +template <class T> +struct S : public S<T*> {}; +template <> +struct S<int**> {}; + +void g() +{ + int S<int*>::*p; + int S<int>::*q = p; +} diff --git a/gcc/testsuite/g++.old-deja/g++.pt/ptrmem4.C b/gcc/testsuite/g++.old-deja/g++.pt/ptrmem4.C new file mode 100644 index 00000000000..139be923550 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.pt/ptrmem4.C @@ -0,0 +1,28 @@ +// Build don't run: + +template<class T,class T1> +int connect_to_method(T* receiver, + int (T1::*method)()) +{ + return (receiver->*method)(); +} + +class Gtk_Container +{ +public: + int remove_callback() { return 1; } + void remove_callback(int); + int f(); +}; + +int Gtk_Container::f() +{ + return connect_to_method(this, &Gtk_Container::remove_callback); +} + +int main() +{ + Gtk_Container gc; + if (gc.f () != 1) + return 1; +} diff --git a/gcc/testsuite/g++.old-deja/g++.pt/ptrmem5.C b/gcc/testsuite/g++.old-deja/g++.pt/ptrmem5.C new file mode 100644 index 00000000000..c9e6c9b9841 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.pt/ptrmem5.C @@ -0,0 +1,17 @@ +// Build don't link: + +// Based on testcase by adriang@campbellsoft.com + +struct Null { + template <typename T> operator T*() { return 0; } + template <typename C, typename T> operator T C::*() { return 0; } +#if WORK_AROUND + typedef int pmf(); + template <typename C> operator pmf C::* () { return 0; } +#endif +} NULL; + +int *pd = NULL; +int (*pf)() = NULL; +int Null::*pmd = NULL; +int (Null::*pmf)() = NULL; // gets bogus error - cannot convert - XFAIL *-*-* diff --git a/gcc/testsuite/g++.old-deja/g++.pt/ptrmem6.C b/gcc/testsuite/g++.old-deja/g++.pt/ptrmem6.C new file mode 100644 index 00000000000..946e6244f4a --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.pt/ptrmem6.C @@ -0,0 +1,34 @@ +// Build don't link: + +class A { +public: + virtual void f(); + int i; +}; + +class B : public A { +public: + void f(); + int j; +}; + +template <void (A::*)() > +void g() {} +template <int A::*> +void h() {} + + +int main() { + g<&A::f>(); + h<&A::i>(); + g<&B::f>(); // ERROR - + h<&B::j>(); // ERROR - + g<(void (A::*)()) &A::f>(); // ERROR - XFAIL *-*-* + h<(int A::*) &A::i>(); // ERROR - + g<(void (A::*)()) &B::f>(); // ERROR - + h<(int A::*) &B::j>(); // ERROR - + g<(void (A::*)()) 0>(); // ERROR - + h<(int A::*) 0>(); // ERROR - + + return 0; +} diff --git a/gcc/testsuite/g++.old-deja/g++.pt/ptrmem7.C b/gcc/testsuite/g++.old-deja/g++.pt/ptrmem7.C new file mode 100644 index 00000000000..9efeec87a68 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.pt/ptrmem7.C @@ -0,0 +1,14 @@ +// Build don't link: +// Origin: Jason Merrill <jason@cygnus.com> + +struct A { + int i; +}; + +template<const int A::* P> +struct B { }; + +int main() +{ + B<&A::i> b; +} diff --git a/gcc/testsuite/g++.old-deja/g++.pt/redecl2.C b/gcc/testsuite/g++.old-deja/g++.pt/redecl2.C new file mode 100644 index 00000000000..0b65e1ec957 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.pt/redecl2.C @@ -0,0 +1,14 @@ +// Build don't link: + +struct A +{ + template <class A> + void f(A) {} +}; + +void g() +{ + A a; + a.f(3); +} + diff --git a/gcc/testsuite/g++.old-deja/g++.pt/ref1.C b/gcc/testsuite/g++.old-deja/g++.pt/ref1.C new file mode 100644 index 00000000000..8b117a5fffb --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.pt/ref1.C @@ -0,0 +1,16 @@ +// Build don't link: + +int i; + +template <void (&FN)()> +void g () +{ + FN (); +} + +void h () +{ + i = 7; +} + +template void g<h>(); diff --git a/gcc/testsuite/g++.old-deja/g++.pt/shadow1.C b/gcc/testsuite/g++.old-deja/g++.pt/shadow1.C new file mode 100644 index 00000000000..dfe99c7b22d --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.pt/shadow1.C @@ -0,0 +1,19 @@ +// Build don't link: + +template <class T> +struct S { + typedef T X; + + class C { + typedef T X; + }; +}; + +template <int I> +struct S2 { + enum { A = I }; + + void f() { + int A; + } +}; diff --git a/gcc/testsuite/g++.old-deja/g++.pt/sizeof2.C b/gcc/testsuite/g++.old-deja/g++.pt/sizeof2.C new file mode 100644 index 00000000000..566665af23c --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.pt/sizeof2.C @@ -0,0 +1,20 @@ +// Although template class B is not used at all, it causes the +// incorrect specialization of A to be selected + +// Adapted from testcase by Oskar Enoksson <osken393@student.liu.se> + +extern "C" void abort(); + +template<int N, class T> // Base class +class A { public: static int n() { return sizeof(T); } }; + +template<int N> // Derived #1 +class B: public A<N,char[N]> {}; + +template<int N, int M> // Derived #2 (wrong!) +class C: public A<N,char[M]> {}; + +int main() { + if (C<1,2>::n() != 2) + abort(); +} diff --git a/gcc/testsuite/g++.old-deja/g++.pt/sizeof3.C b/gcc/testsuite/g++.old-deja/g++.pt/sizeof3.C new file mode 100644 index 00000000000..cd5f701f20f --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.pt/sizeof3.C @@ -0,0 +1,25 @@ +// Adapted from testcase by Oskar Enoksson <osken393@student.liu.se> + +extern "C" void abort(); + +template<class T0> +class A { +public: + typedef T0 T; +}; + +template<int K> +class B { + typedef A<char[K]> BC; +}; + +template<int N, int M> +class C { +public: + typedef A<char[M]> AC; +}; + +int main() { + if (sizeof(C<3,7>::AC::T) != 7) + abort(); +} diff --git a/gcc/testsuite/g++.old-deja/g++.pt/spec23.C b/gcc/testsuite/g++.old-deja/g++.pt/spec23.C new file mode 100644 index 00000000000..0e9ee61d253 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.pt/spec23.C @@ -0,0 +1,10 @@ +/* [temp.expl.spec] p18. */ + +template<class T> +struct A { + template <class U> class B { }; +}; + +template<class T> +class A<T>::B<void> { // ERROR - only one template header +}; diff --git a/gcc/testsuite/g++.old-deja/g++.pt/spec24.C b/gcc/testsuite/g++.old-deja/g++.pt/spec24.C new file mode 100644 index 00000000000..2b7d336698f --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.pt/spec24.C @@ -0,0 +1,5 @@ +// Build don't link: + +template <class T> class A; +// template <> +class A<int>; // ERROR - missing template header - XFAIL *-*-* diff --git a/gcc/testsuite/g++.old-deja/g++.pt/spec25.C b/gcc/testsuite/g++.old-deja/g++.pt/spec25.C new file mode 100644 index 00000000000..884abf07dee --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.pt/spec25.C @@ -0,0 +1,15 @@ +// Build don't link: + +template <class T, int I> +struct S { +}; + +template <int I> +struct S <double, I> { +}; + +template <class T> +void f () +{ + S<double, T::x> s; +} diff --git a/gcc/testsuite/g++.old-deja/g++.pt/spec26.C b/gcc/testsuite/g++.old-deja/g++.pt/spec26.C new file mode 100644 index 00000000000..1bd40b6083c --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.pt/spec26.C @@ -0,0 +1,11 @@ +// From: lat@iki.fi (Lassi A. Tuura) +// Test that a specialization without an initializer is not a definition, +// as specified in [temp.expl.spec]. + +// Build don't link: + +struct X; +template <class T> struct Y { static const X array[]; }; +template <> const X Y<int>::array []; +struct X { int i; }; +template <> const X Y<int>::array [] = { 0, 1, 2, 3 }; diff --git a/gcc/testsuite/g++.old-deja/g++.pt/spec27.C b/gcc/testsuite/g++.old-deja/g++.pt/spec27.C new file mode 100644 index 00000000000..63aae4c9bf6 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.pt/spec27.C @@ -0,0 +1,18 @@ +// Build don't link: + +template <class T, class U> +struct Y {}; + +template <class T> +struct X {}; + +template <class T, class U> +void f() +{ + typename X<Y<T, U> >::A a; +} + +template <class T, class U> +struct X<Y<T, U> > +{ +}; diff --git a/gcc/testsuite/g++.old-deja/g++.pt/spec28.C b/gcc/testsuite/g++.old-deja/g++.pt/spec28.C new file mode 100644 index 00000000000..d63e7967672 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.pt/spec28.C @@ -0,0 +1,25 @@ +// Build don't link: + +template <class T> +struct S1 { + friend bool f<>(const S1&); + typedef T X; +}; + +template <class T> +struct S2 { +}; + +template <class T> +struct S2<S1<T> > { + typedef typename S1<T>::X Y; +}; + +template <class T> +bool f(T); + +template <class T> +typename S2<S1<T> >::Y +f(const S1<T>&); + +template struct S1<int>; diff --git a/gcc/testsuite/g++.old-deja/g++.pt/spec29.C b/gcc/testsuite/g++.old-deja/g++.pt/spec29.C new file mode 100644 index 00000000000..9f27a8e53a3 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.pt/spec29.C @@ -0,0 +1,31 @@ +char c; + +struct S { + template <typename T> + operator T*(); + + template <typename T> + operator T(); +}; + +template <> +S::operator int() +{ + return 2; +} + +template <> +S::operator char*() +{ + return &c; +} + +int main() +{ + S s; + int i = s; + char* cp = s; + + if (i != 2 || cp != &c) + return 1; +} diff --git a/gcc/testsuite/g++.old-deja/g++.pt/spec30.C b/gcc/testsuite/g++.old-deja/g++.pt/spec30.C new file mode 100644 index 00000000000..5d36e254a40 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.pt/spec30.C @@ -0,0 +1,41 @@ +#include <cstddef> + +template <class T> +struct S { + void *operator new (size_t); + void *operator new (size_t, int); + void operator delete (void*); +}; + +static void* s[2]; + +template <> +void* S<int>::operator new (size_t b) +{ + s[0] = ::operator new(b); + return s[0]; +} + +template <> +void* S<int>::operator new (size_t b, int) +{ + s[1] = ::operator new(b); + return s[1]; +} + +template <> +void S<int>::operator delete (void*) +{ +} + +int main() +{ + S<int>* s1 = new S<int>; + S<int>* s2 = new(3) S<int>; + + if (s1 != s[0] || s2 != s[1]) + return 1; + + delete s1; + delete s2; +} diff --git a/gcc/testsuite/g++.old-deja/g++.pt/spec31.C b/gcc/testsuite/g++.old-deja/g++.pt/spec31.C new file mode 100644 index 00000000000..a66e03f62eb --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.pt/spec31.C @@ -0,0 +1,2 @@ +template <> struct A {}; // ERROR - not a specialization +template <> void f (); // ERROR - not a specialization diff --git a/gcc/testsuite/g++.old-deja/g++.pt/static5.C b/gcc/testsuite/g++.old-deja/g++.pt/static5.C new file mode 100644 index 00000000000..f6e125dbfb7 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.pt/static5.C @@ -0,0 +1,9 @@ +// Build don't link: + +template <class T> +struct S +{ + static const T t = 3; // ERROR - initializing non-integral type +}; + +double d = S<double>::t; diff --git a/gcc/testsuite/g++.old-deja/g++.pt/static6.C b/gcc/testsuite/g++.old-deja/g++.pt/static6.C new file mode 100644 index 00000000000..c52c3cb2af5 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.pt/static6.C @@ -0,0 +1,14 @@ +// Build don't run: + +// Simplified from testcase by Erez Louidor Lior <s3824888@techst02.technion.ac.il> + +template <class T> struct A { + static const int l[1]; +}; + +template<class T> +const int A<T>::l[1] = {1}; + +int i = A<int>::l[0]; + +int main(){} diff --git a/gcc/testsuite/g++.old-deja/g++.pt/ttp53.C b/gcc/testsuite/g++.old-deja/g++.pt/ttp53.C new file mode 100644 index 00000000000..e5e87b46089 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.pt/ttp53.C @@ -0,0 +1,35 @@ +// Build don't link: + +// Submitted by Erez Louidor Lior <s3824888@techst02.technion.ac.il> + +template <typename> class H; +template <typename Target, typename Source> +H<Target> foo(const H<Source>&); + +template <typename Type> +class H{ + +#ifdef OK +public: +#endif + template<template<class, class> class Caster, typename Source> + static H<Type> cast(const H<Source>& s); + +#ifndef OK + template <typename Target, typename Source> + friend H<Target> foo(const H<Source>&); +#endif + +}; + +template <class, class> class caster; + +template <typename Target, typename Source> +H<Target> foo(const H<Source>& s){ + return H<Target>::template cast<caster, Source>(s); +} + +int main(){ + H<int> i; + foo<const int>(i); +} diff --git a/gcc/testsuite/g++.old-deja/g++.pt/ttp54.C b/gcc/testsuite/g++.old-deja/g++.pt/ttp54.C new file mode 100644 index 00000000000..bae649a3dfa --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.pt/ttp54.C @@ -0,0 +1,20 @@ +// Build don't link: + +// Reported by Bruce Eckel <Bruce@EckelObjects.com> + +// [temp.deduct.type] +// Make sure we treat <T> in the construct TT<T> as any type containing T. + +template <class T> class C +{ +}; + +template <class T, template <class> class TT> void f (TT<T *> &t) +{ +} + +int main () +{ + C<char *> c; + f(c); +} diff --git a/gcc/testsuite/g++.old-deja/g++.pt/ttp55.C b/gcc/testsuite/g++.old-deja/g++.pt/ttp55.C new file mode 100644 index 00000000000..10af608bcba --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.pt/ttp55.C @@ -0,0 +1,23 @@ +// Build don't link: + +// Testing overloading of function argument involving template template +// parameters + +// Reported by Thomus Kunert <kunert@physik.tu-dresden.de> + +template<class A> +class H{}; + +template <class T> +void f( const T& ){} // #1 + +template< template<class, class> class X, + class A, class B> +void f( const X<A,B> & x ) // #2 +{} + +int main() +{ + H<int> h; + f(h); // #3 +} diff --git a/gcc/testsuite/g++.old-deja/g++.pt/typename14.C b/gcc/testsuite/g++.old-deja/g++.pt/typename14.C new file mode 100644 index 00000000000..7365b66801d --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.pt/typename14.C @@ -0,0 +1,15 @@ +// Build don't link: +// Special g++ Options: + +template <class T> +struct B { + typedef T X; +}; + +template <class T> +struct S : public B<T> +{ + struct I { + void f(X x); + }; +}; diff --git a/gcc/testsuite/g++.old-deja/g++.pt/typename15.C b/gcc/testsuite/g++.old-deja/g++.pt/typename15.C new file mode 100644 index 00000000000..8e26057922e --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.pt/typename15.C @@ -0,0 +1,18 @@ +// Build don't link: +// Special g++ Options: + +template <class T, bool B> +struct R { + struct X {}; +}; + +template <class T, bool B = false> +struct S : public R <T, B> { +}; + +template <class T> void f() +{ + S<T>::X(); +} + +template void f<int>(); diff --git a/gcc/testsuite/g++.old-deja/g++.pt/typename16.C b/gcc/testsuite/g++.old-deja/g++.pt/typename16.C new file mode 100644 index 00000000000..51a8765e9ac --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.pt/typename16.C @@ -0,0 +1,31 @@ +// Build don't run: +// Special g++ Options: + +struct B { + typedef int I; +}; + +template <class T> +struct D1 : public B { +}; + +template <class T> +struct D2 : public D1<T> { + I i; +}; + +template <> +struct D1<int> { + typedef double I; +}; + +template <class T> +void f(T); +template <> +void f(double) {} + +int main() +{ + D2<int> d2i; + f(d2i.i); +} diff --git a/gcc/testsuite/g++.old-deja/g++.pt/typename17.C b/gcc/testsuite/g++.old-deja/g++.pt/typename17.C new file mode 100644 index 00000000000..87b0ab3b905 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.pt/typename17.C @@ -0,0 +1,20 @@ +// Build don't link: + +template <class T> +struct A +{ + typedef T A_Type; +}; + + +template <class U> +struct B : public A<U> +{ + typename B<U>::A_Type Func(); +}; + + +template <class U> +typename B<U>::A_Type B<U>::Func() +{ +} diff --git a/gcc/testsuite/g++.old-deja/g++.pt/unify4.C b/gcc/testsuite/g++.old-deja/g++.pt/unify4.C new file mode 100644 index 00000000000..259920d4565 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.pt/unify4.C @@ -0,0 +1,11 @@ +template <class T> void f (T); + +void g (); +void g (int); + +int +main () +{ + f (g); // ERROR - ambiguous unification + return 0; +} diff --git a/gcc/testsuite/g++.old-deja/g++.pt/union1.C b/gcc/testsuite/g++.old-deja/g++.pt/union1.C new file mode 100644 index 00000000000..a1da446e570 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.pt/union1.C @@ -0,0 +1,18 @@ +// Build don't link: + +union Un {int i;}; + +template<class T1, class T2> struct St1 {}; +template<class T> struct St1<Un,T> {}; + +template<class T> struct St2 {}; +template<> struct St2<Un> {}; + +template<class T1, class T2> struct St3 {}; +template<> struct St3<Un,int> {}; + +void f() { + St1<int,int> s1; + St2<int> s2; + St3<int,int> s3; +} diff --git a/gcc/testsuite/g77.f-torture/compile/19990218-0.f b/gcc/testsuite/g77.f-torture/compile/19990218-0.f new file mode 100644 index 00000000000..3e34117ec69 --- /dev/null +++ b/gcc/testsuite/g77.f-torture/compile/19990218-0.f @@ -0,0 +1,13 @@ + program test + double precision a,b,c + data a,b/1.0d-46,1.0d0/ + c=fun(a,b) + print*,'in main: fun=',c + end + double precision function fun(a,b) + double precision a,b + print*,'in sub: a,b=',a,b + fun=a*b + print*,'in sub: fun=',fun + return + end diff --git a/gcc/testsuite/g77.f-torture/compile/19990305-0.f b/gcc/testsuite/g77.f-torture/compile/19990305-0.f new file mode 100644 index 00000000000..32c656d90a6 --- /dev/null +++ b/gcc/testsuite/g77.f-torture/compile/19990305-0.f @@ -0,0 +1,55 @@ +* Date: Fri, 5 Mar 1999 00:35:44 -0500 (EST) +* From: Denes Molnar <molnard@phys.columbia.edu> +* To: fortran@gnu.org +* Subject: f771 gets fatal signal 6 +* Content-Type: TEXT/PLAIN; charset=US-ASCII +* X-UIDL: 8d81e9cbdcc96209c6e9b298d966ba7f +* +* Hi, +* +* +* Comiling object from the source code below WORKS FINE with +* 'g77 -o hwuci2 -c hwuci2.F' +* but FAILS with fatal signal 6 +* 'g77 -o hwuci2 -O -c hwuci2.F' +* +* Any explanations? +* +* I am running GNU Fortran 0.5.23 with GCC 2.8.1 (glibc1). +* +* +* Denes Molnar +* +* %%%%%%%%%%%%%%%%%%%%%%%%% +* %the source: +* %%%%%%%%%%%%%%%%%%%%%%%%% +* +CDECK ID>, HWUCI2. +*CMZ :- -23/08/94 13.22.29 by Mike Seymour +*-- Author : Ulrich Baur & Nigel Glover, adapted by Ian Knowles +C----------------------------------------------------------------------- + FUNCTION HWUCI2(A,B,Y0) +C----------------------------------------------------------------------- +C Integral LOG(A-EPSI-BY(1-Y))/(Y-Y0) +C----------------------------------------------------------------------- + IMPLICIT NONE + DOUBLE COMPLEX HWUCI2,HWULI2,EPSI,Y1,Y2,Z1,Z2,Z3,Z4 + DOUBLE PRECISION A,B,Y0,ZERO,ONE,FOUR,HALF + EXTERNAL HWULI2 + COMMON/SMALL/EPSI + PARAMETER (ZERO=0.D0, ONE =1.D0, FOUR= 4.D0, HALF=0.5D0) + IF(B.EQ.ZERO)THEN + HWUCI2=CMPLX(ZERO,ZERO) + ELSE + Y1=HALF*(ONE+SQRT(ONE-FOUR*(A+EPSI)/B)) + Y2=ONE-Y1 + Z1=Y0/(Y0-Y1) + Z2=(Y0-ONE)/(Y0-Y1) + Z3=Y0/(Y0-Y2) + Z4=(Y0-ONE)/(Y0-Y2) + HWUCI2=HWULI2(Z1)-HWULI2(Z2)+HWULI2(Z3)-HWULI2(Z4) + ENDIF + RETURN + END +* +* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/gcc/testsuite/g77.f-torture/compile/960317-1.f b/gcc/testsuite/g77.f-torture/compile/960317-1.f new file mode 100644 index 00000000000..4bb0a37278e --- /dev/null +++ b/gcc/testsuite/g77.f-torture/compile/960317-1.f @@ -0,0 +1,103 @@ +* Date: Sat, 16 Mar 1996 19:58:37 -0500 (EST) +* From: Kate Hedstrom <kate@ahab.Rutgers.EDU> +* To: burley@gnu.ai.mit.edu +* Subject: g77 bug in assign +* +* I found some files in the NCAR graphics source code which used to +* compile with g77 and now don't. All contain the following combination +* of "save" and "assign". It fails on a Sun running SunOS 4.1.3 and a +* Sun running SunOS 5.5 (slightly older g77), but compiles on an +* IBM/RS6000: +* +C + SUBROUTINE QUICK + SAVE +C + ASSIGN 101 TO JUMP + 101 Continue +C + RETURN + END +* +* Everything else in the NCAR distribution compiled, including quite a +* few C routines. +* +* Kate +* +* +* nemo% g77 -v -c quick.f +* gcc -v -c -xf77 quick.f +* Reading specs from /usr/local/lib/gcc-lib/sparc-sun-sunos4.1.3/2.7.2/specs +* gcc version 2.7.2 +* /usr/local/lib/gcc-lib/sparc-sun-sunos4.1.3/2.7.2/f771 quick.f -fset-g77-defaults -quiet -dumpbase quick.f -version -fversion -o /usr/tmp/cca24166.s +* GNU F77 version 2.7.2 (sparc) compiled by GNU C version 2.7.1. +* GNU Fortran Front End version 0.5.18-960314 compiled: Mar 16 1996 14:28:11 +* gcc: Internal compiler error: program f771 got fatal signal 11 +* +* +* nemo% gdb /usr/local/lib/gcc-lib/*/*/f771 core +* GDB is free software and you are welcome to distribute copies of it +* under certain conditions; type "show copying" to see the conditions. +* There is absolutely no warranty for GDB; type "show warranty" for details. +* GDB 4.14 (sparc-sun-sunos4.1.3), +* Copyright 1995 Free Software Foundation, Inc... +* Core was generated by `f771'. +* Program terminated with signal 11, Segmentation fault. +* Couldn't read input and local registers from core file +* find_solib: Can't read pathname for load map: I/O error +* +* Couldn't read input and local registers from core file +* #0 0x21aa4 in ffecom_sym_transform_assign_ (s=???) at f/com.c:7881 +* 7881 if ((ffesymbol_save (s) || ffe_is_saveall ()) +* (gdb) where +* #0 0x21aa4 in ffecom_sym_transform_assign_ (s=???) at f/com.c:7881 +* Error accessing memory address 0xefffefcc: Invalid argument. +* (gdb) +* +* +* ahab% g77 -v -c quick.f +* gcc -v -c -xf77 quick.f +* Reading specs from /usr/local/lib/gcc-lib/sparc-sun-solaris2.5/2.7.2/specs +* gcc version 2.7.2 +* /usr/local/lib/gcc-lib/sparc-sun-solaris2.5/2.7.2/f771 quick.f -quiet -dumpbase quick.f -version -fversion -o /var/tmp/cca003D2.s +* GNU F77 version 2.7.2 (sparc) compiled by GNU C version 2.7.2. +* GNU Fortran Front End version 0.5.18-960304 compiled: Mar 5 1996 16:12:46 +* gcc: Internal compiler error: program f771 got fatal signal 11 +* +* +* ahab% !gdb +* gdb /usr/local/lib/gcc-lib/*/*/f771 core +* GDB is free software and you are welcome to distribute copies of it +* under certain conditions; type "show copying" to see the conditions. +* There is absolutely no warranty for GDB; type "show warranty" for details. +* GDB 4.15.1 (sparc-sun-solaris2.4), +* Copyright 1995 Free Software Foundation, Inc... +* Core was generated by +* `/usr/local/lib/gcc-lib/sparc-sun-solaris2.5/2.7.2/f771 quick.f -quiet -dumpbase'. +* Program terminated with signal 11, Segmentation fault. +* Reading symbols from /usr/lib/libc.so.1...done. +* Reading symbols from /usr/lib/libdl.so.1...done. +* #0 0x43e04 in ffecom_sym_transform_assign_ (s=0x3a22f8) at f/com.c:7963 +* Source file is more recent than executable. +* 7963 assert (st != NULL); +* (gdb) where +* #0 0x43e04 in ffecom_sym_transform_assign_ (s=0x3a22f8) at f/com.c:7963 +* #1 0x38044 in ffecom_expr_ (expr=0x3a23c0, dest_tree=0x0, dest=0x0, dest_used=0x0, assignp=true) at f/com.c:2100 +* #2 0x489c8 in ffecom_expr_assign_w (expr=0x3a23c0) at f/com.c:10238 +* #3 0xe9228 in ffeste_R838 (label=0x3a1ba8, target=0x3a23c0) at f/ste.c:2769 +* #4 0xdae60 in ffestd_stmt_pass_ () at f/std.c:840 +* #5 0xdc090 in ffestd_exec_end () at f/std.c:1405 +* #6 0xcb534 in ffestc_shriek_subroutine_ (ok=true) at f/stc.c:4849 +* #7 0xd8f00 in ffestc_R1225 (name=0x0) at f/stc.c:12307 +* #8 0xcc808 in ffestc_end () at f/stc.c:5572 +* #9 0x9fa84 in ffestb_end3_ (t=0x3a19c8) at f/stb.c:3216 +* #10 0x9f30c in ffestb_end (t=0x3a19c8) at f/stb.c:2995 +* #11 0x98414 in ffesta_save_ (t=0x3a19c8) at f/sta.c:453 +* #12 0x997ec in ffesta_second_ (t=0x3a19c8) at f/sta.c:1178 +* #13 0x8ed84 in ffelex_send_token_ () at f/lex.c:1614 +* #14 0x8cab8 in ffelex_finish_statement_ () at f/lex.c:946 +* #15 0x91684 in ffelex_file_fixed (wf=0x397780, f=0x37a560) at f/lex.c:2946 +* #16 0x107a94 in ffe_file (wf=0x397780, f=0x37a560) at f/top.c:456 +* #17 0x96218 in yyparse () at f/parse.c:77 +* #18 0x10beac in compile_file (name=0xdffffaf7 "quick.f") at toplev.c:2239 +* #19 0x110dc0 in main (argc=9, argv=0xdffff994, envp=0xdffff9bc) at toplev.c:3927 diff --git a/gcc/testsuite/g77.f-torture/compile/981117-1.f b/gcc/testsuite/g77.f-torture/compile/981117-1.f new file mode 100644 index 00000000000..019167064fa --- /dev/null +++ b/gcc/testsuite/g77.f-torture/compile/981117-1.f @@ -0,0 +1,23 @@ +* egcs-bugs: +* From: Martin Kahlert <martin.kahlert@mchp.siemens.de> +* Subject: ICE in g77 from egcs-19981109 +* Message-Id: <199811101134.MAA29838@keksy.mchp.siemens.de> + +* As of 1998-11-17, fails -O2 -fomit-frame-pointer with +* egcs/gcc/testsuite/g77.f-torture/compile/981117-1.f:8: internal error--insn does not satisfy its constraints: +* (insn 31 83 32 (set (reg:SF 8 %st(0)) +* (mult:SF (reg:SF 8 %st(0)) +* (const_double:SF (mem/u:SF (symbol_ref/u:SI ("*.LC1")) 0) 0 0 1073643520))) 350 {strlensi-3} (nil) +* (nil)) +* ../../egcs/gcc/toplev.c:1390: Internal compiler error in function fatal_insn + +* Fixed sometime before 1998-11-21 -- don't know by which change. + + SUBROUTINE SSPTRD + PARAMETER (HALF = 0.5 ) + DO I = 1, N + CALL SSPMV(TAUI) + ALPHA = -HALF*TAUI + CALL SAXPY(ALPHA) + ENDDO + END diff --git a/gcc/testsuite/g77.f-torture/compile/990115-1.f b/gcc/testsuite/g77.f-torture/compile/990115-1.f new file mode 100644 index 00000000000..187e1b463b5 --- /dev/null +++ b/gcc/testsuite/g77.f-torture/compile/990115-1.f @@ -0,0 +1,8 @@ +C Derived from lapack + SUBROUTINE ZGELSX( M, N, NRHS, A, LDA, B, LDB, JPVT, RCOND, RANK, + $ WORK, RWORK, INFO ) + COMPLEX*16 WORK( * ) + DO 20 I = 1, RANK + WORK( ISMAX+I-1 ) = S2*WORK( ISMAX+I-1 ) + 20 CONTINUE + END diff --git a/gcc/testsuite/g77.f-torture/execute/19981119-0.f b/gcc/testsuite/g77.f-torture/execute/19981119-0.f new file mode 100644 index 00000000000..5cfab57a5fc --- /dev/null +++ b/gcc/testsuite/g77.f-torture/execute/19981119-0.f @@ -0,0 +1,40 @@ +* X-Delivered: at request of burley on mescaline.gnu.org +* Date: Sat, 31 Oct 1998 18:26:29 +0200 (EET) +* From: "B. Yanchitsky" <yan@im.imag.kiev.ua> +* To: fortran@gnu.org +* Subject: Bug report +* MIME-Version: 1.0 +* Content-Type: TEXT/PLAIN; charset=US-ASCII +* +* There is a trouble with g77 on Alpha. +* My configuration: +* Digital Personal Workstation 433au, +* Digital Unix 4.0D, +* GNU Fortran 0.5.23 and GNU C 2.8.1. +* +* The following program treated successfully but crashed when running. +* +* C --- PROGRAM BEGIN ------- +* + subroutine sub(N,u) + integer N + double precision u(-N:N,-N:N) + +C vvvv CRASH HERE vvvvv + u(-N,N)=0d0 + return + end + + + program bug + integer N + double precision a(-10:10,-10:10) + data a/441*1d0/ + N=10 + call sub(N,a) + if (a(-N,N) .ne. 0d0) call abort + end +* +* C --- PROGRAM END ------- +* +* Good luck! diff --git a/gcc/testsuite/g77.f-torture/execute/19990313-0.f b/gcc/testsuite/g77.f-torture/execute/19990313-0.f new file mode 100644 index 00000000000..abf898fb793 --- /dev/null +++ b/gcc/testsuite/g77.f-torture/execute/19990313-0.f @@ -0,0 +1,33 @@ +* To: craig@jcb-sc.com +* Subject: Re: G77 and KIND=2 +* Content-Type: text/plain; charset=us-ascii +* From: Dave Love <d.love@dl.ac.uk> +* Date: 03 Mar 1999 18:20:11 +0000 +* In-Reply-To: craig@jcb-sc.com's message of "1 Mar 1999 21:04:38 -0000" +* User-Agent: Gnus/5.07007 (Pterodactyl Gnus v0.70) Emacs/20.3 +* X-UIDL: d442bafe961c2a6ec6904f492e05d7b0 +* +* ISTM that there is a real problem printing integer*8 (on x86): +* +* $ cat x.f +*[modified for test suite] + integer *8 foo, bar + data r/4e10/ + foo = 4e10 + bar = r + if (foo .ne. bar) call abort + end +* $ g77 x.f && ./a.out +* 1345294336 +* 123 +* $ f2c x.f && g77 x.c && ./a.out +* x.f: +* MAIN: +* 40000000000 +* 123 +* $ +* +* Gdb shows the upper half of the buffer passed to do_lio is zeroed in +* the g77 case. +* +* I've forgotten how the code generation happens. diff --git a/gcc/testsuite/g77.f-torture/execute/19990313-1.f b/gcc/testsuite/g77.f-torture/execute/19990313-1.f new file mode 100644 index 00000000000..d99c72f2fde --- /dev/null +++ b/gcc/testsuite/g77.f-torture/execute/19990313-1.f @@ -0,0 +1,7 @@ + integer *8 foo, bar + double precision r + data r/4d10/ + foo = 4d10 + bar = r + if (foo .ne. bar) call abort + end diff --git a/gcc/testsuite/g77.f-torture/execute/19990313-2.f b/gcc/testsuite/g77.f-torture/execute/19990313-2.f new file mode 100644 index 00000000000..ffb7549d413 --- /dev/null +++ b/gcc/testsuite/g77.f-torture/execute/19990313-2.f @@ -0,0 +1,7 @@ + integer *8 foo, bar + complex c + data c/(4e10,0)/ + foo = 4e10 + bar = c + if (foo .ne. bar) call abort + end diff --git a/gcc/testsuite/g77.f-torture/execute/19990313-3.f b/gcc/testsuite/g77.f-torture/execute/19990313-3.f new file mode 100644 index 00000000000..6366dccd890 --- /dev/null +++ b/gcc/testsuite/g77.f-torture/execute/19990313-3.f @@ -0,0 +1,7 @@ + integer *8 foo, bar + double complex c + data c/(4d10,0)/ + foo = 4d10 + bar = c + if (foo .ne. bar) call abort + end diff --git a/gcc/testsuite/g77.f-torture/execute/19990325-0.f b/gcc/testsuite/g77.f-torture/execute/19990325-0.f new file mode 100644 index 00000000000..13f57a15f90 --- /dev/null +++ b/gcc/testsuite/g77.f-torture/execute/19990325-0.f @@ -0,0 +1,313 @@ +* test whether complex operators properly handle +* full and partial aliasing. +* (libf2c/libF77 routines used to assume no aliasing, +* then were changed to accommodate full aliasing, while +* the libg2c/libF77 versions were changed to accommodate +* both full and partial aliasing.) +* +* NOTE: this (19990325-0.f) is the single-precision version. +* See 19990325-1.f for the double-precision version. + + program complexalias + implicit none + +* Make sure non-aliased cases work. (Catch roundoff/precision +* problems, etc., here. Modify subroutine check if they occur.) + + call tryfull (1, 3, 5) + +* Now check various combinations of aliasing. + +* Full aliasing. + call tryfull (1, 1, 5) + +* Partial aliasing. + call trypart (2, 3, 5) + call trypart (2, 1, 5) + call trypart (2, 5, 3) + call trypart (2, 5, 1) + + end + + subroutine tryfull (xout, xin1, xin2) + implicit none + integer xout, xin1, xin2 + +* out, in1, and in2 are the desired indexes into the REAL array (array). + + complex expect + integer pwr + integer out, in1, in2 + + real array(6) + complex carray(3) + equivalence (carray(1), array(1)) + +* Make sure the indexes can be accommodated by the equivalences above. + + if (mod (xout, 2) .ne. 1) call abort + if (mod (xin1, 2) .ne. 1) call abort + if (mod (xin2, 2) .ne. 1) call abort + +* Convert the indexes into ones suitable for the COMPLEX array (carray). + + out = (xout + 1) / 2 + in1 = (xin1 + 1) / 2 + in2 = (xin2 + 1) / 2 + +* Check some open-coded stuff, just in case. + + call prepare1 (carray(in1)) + expect = + carray(in1) + carray(out) = + carray(in1) + call check (expect, carray(out)) + + call prepare1 (carray(in1)) + expect = - carray(in1) + carray(out) = - carray(in1) + call check (expect, carray(out)) + + call prepare2 (carray(in1), carray(in2)) + expect = carray(in1) + carray(in2) + carray(out) = carray(in1) + carray(in2) + call check (expect, carray(out)) + + call prepare2 (carray(in1), carray(in2)) + expect = carray(in1) - carray(in2) + carray(out) = carray(in1) - carray(in2) + call check (expect, carray(out)) + + call prepare2 (carray(in1), carray(in2)) + expect = carray(in1) * carray(in2) + carray(out) = carray(in1) * carray(in2) + call check (expect, carray(out)) + + call prepare1 (carray(in1)) + expect = carray(in1) ** 2 + carray(out) = carray(in1) ** 2 + call check (expect, carray(out)) + + call prepare1 (carray(in1)) + expect = carray(in1) ** 3 + carray(out) = carray(in1) ** 3 + call check (expect, carray(out)) + + call prepare1 (carray(in1)) + expect = abs (carray(in1)) + array(out*2-1) = abs (carray(in1)) + array(out*2) = 0 + call check (expect, carray(out)) + +* Now check the stuff implemented in libF77. + + call prepare1 (carray(in1)) + expect = cos (carray(in1)) + carray(out) = cos (carray(in1)) + call check (expect, carray(out)) + + call prepare1 (carray(in1)) + expect = exp (carray(in1)) + carray(out) = exp (carray(in1)) + call check (expect, carray(out)) + + call prepare1 (carray(in1)) + expect = log (carray(in1)) + carray(out) = log (carray(in1)) + call check (expect, carray(out)) + + call prepare1 (carray(in1)) + expect = sin (carray(in1)) + carray(out) = sin (carray(in1)) + call check (expect, carray(out)) + + call prepare1 (carray(in1)) + expect = sqrt (carray(in1)) + carray(out) = sqrt (carray(in1)) + call check (expect, carray(out)) + + call prepare1 (carray(in1)) + expect = conjg (carray(in1)) + carray(out) = conjg (carray(in1)) + call check (expect, carray(out)) + + call prepare1i (carray(in1), pwr) + expect = carray(in1) ** pwr + carray(out) = carray(in1) ** pwr + call check (expect, carray(out)) + + call prepare2 (carray(in1), carray(in2)) + expect = carray(in1) / carray(in2) + carray(out) = carray(in1) / carray(in2) + call check (expect, carray(out)) + + call prepare2 (carray(in1), carray(in2)) + expect = carray(in1) ** carray(in2) + carray(out) = carray(in1) ** carray(in2) + call check (expect, carray(out)) + + call prepare1 (carray(in1)) + expect = carray(in1) ** .2 + carray(out) = carray(in1) ** .2 + call check (expect, carray(out)) + + end + + subroutine trypart (xout, xin1, xin2) + implicit none + integer xout, xin1, xin2 + +* out, in1, and in2 are the desired indexes into the REAL array (array). + + complex expect + integer pwr + integer out, in1, in2 + + real array(6) + complex carray(3), carrayp(2) + equivalence (carray(1), array(1)) + equivalence (carrayp(1), array(2)) + +* Make sure the indexes can be accommodated by the equivalences above. + + if (mod (xout, 2) .ne. 0) call abort + if (mod (xin1, 2) .ne. 1) call abort + if (mod (xin2, 2) .ne. 1) call abort + +* Convert the indexes into ones suitable for the COMPLEX array (carray). + + out = xout / 2 + in1 = (xin1 + 1) / 2 + in2 = (xin2 + 1) / 2 + +* Check some open-coded stuff, just in case. + + call prepare1 (carray(in1)) + expect = + carray(in1) + carrayp(out) = + carray(in1) + call check (expect, carrayp(out)) + + call prepare1 (carray(in1)) + expect = - carray(in1) + carrayp(out) = - carray(in1) + call check (expect, carrayp(out)) + + call prepare2 (carray(in1), carray(in2)) + expect = carray(in1) + carray(in2) + carrayp(out) = carray(in1) + carray(in2) + call check (expect, carrayp(out)) + + call prepare2 (carray(in1), carray(in2)) + expect = carray(in1) - carray(in2) + carrayp(out) = carray(in1) - carray(in2) + call check (expect, carrayp(out)) + + call prepare2 (carray(in1), carray(in2)) + expect = carray(in1) * carray(in2) + carrayp(out) = carray(in1) * carray(in2) + call check (expect, carrayp(out)) + + call prepare1 (carray(in1)) + expect = carray(in1) ** 2 + carrayp(out) = carray(in1) ** 2 + call check (expect, carrayp(out)) + + call prepare1 (carray(in1)) + expect = carray(in1) ** 3 + carrayp(out) = carray(in1) ** 3 + call check (expect, carrayp(out)) + + call prepare1 (carray(in1)) + expect = abs (carray(in1)) + array(out*2) = abs (carray(in1)) + array(out*2+1) = 0 + call check (expect, carrayp(out)) + +* Now check the stuff implemented in libF77. + + call prepare1 (carray(in1)) + expect = cos (carray(in1)) + carrayp(out) = cos (carray(in1)) + call check (expect, carrayp(out)) + + call prepare1 (carray(in1)) + expect = exp (carray(in1)) + carrayp(out) = exp (carray(in1)) + call check (expect, carrayp(out)) + + call prepare1 (carray(in1)) + expect = log (carray(in1)) + carrayp(out) = log (carray(in1)) + call check (expect, carrayp(out)) + + call prepare1 (carray(in1)) + expect = sin (carray(in1)) + carrayp(out) = sin (carray(in1)) + call check (expect, carrayp(out)) + + call prepare1 (carray(in1)) + expect = sqrt (carray(in1)) + carrayp(out) = sqrt (carray(in1)) + call check (expect, carrayp(out)) + + call prepare1 (carray(in1)) + expect = conjg (carray(in1)) + carrayp(out) = conjg (carray(in1)) + call check (expect, carrayp(out)) + + call prepare1i (carray(in1), pwr) + expect = carray(in1) ** pwr + carrayp(out) = carray(in1) ** pwr + call check (expect, carrayp(out)) + + call prepare2 (carray(in1), carray(in2)) + expect = carray(in1) / carray(in2) + carrayp(out) = carray(in1) / carray(in2) + call check (expect, carrayp(out)) + + call prepare2 (carray(in1), carray(in2)) + expect = carray(in1) ** carray(in2) + carrayp(out) = carray(in1) ** carray(in2) + call check (expect, carrayp(out)) + + call prepare1 (carray(in1)) + expect = carray(in1) ** .2 + carrayp(out) = carray(in1) ** .2 + call check (expect, carrayp(out)) + + end + + subroutine prepare1 (in) + implicit none + complex in + + in = (3.2, 4.2) + + end + + subroutine prepare1i (in, i) + implicit none + complex in + integer i + + in = (2.3, 2.5) + i = 4 + + end + + subroutine prepare2 (in1, in2) + implicit none + complex in1, in2 + + in1 = (1.3, 2.4) + in2 = (3.5, 7.1) + + end + + subroutine check (expect, got) + implicit none + complex expect, got + + if (aimag(expect) .ne. aimag(got)) call abort + if (real(expect) .ne. real(expect)) call abort + + end diff --git a/gcc/testsuite/g77.f-torture/execute/19990325-1.f b/gcc/testsuite/g77.f-torture/execute/19990325-1.f new file mode 100644 index 00000000000..a146f6efab8 --- /dev/null +++ b/gcc/testsuite/g77.f-torture/execute/19990325-1.f @@ -0,0 +1,313 @@ +* test whether complex operators properly handle +* full and partial aliasing. +* (libf2c/libF77 routines used to assume no aliasing, +* then were changed to accommodate full aliasing, while +* the libg2c/libF77 versions were changed to accommodate +* both full and partial aliasing.) +* +* NOTE: this (19990325-1.f) is the double-precision version. +* See 19990325-0.f for the single-precision version. + + program doublecomplexalias + implicit none + +* Make sure non-aliased cases work. (Catch roundoff/precision +* problems, etc., here. Modify subroutine check if they occur.) + + call tryfull (1, 3, 5) + +* Now check various combinations of aliasing. + +* Full aliasing. + call tryfull (1, 1, 5) + +* Partial aliasing. + call trypart (2, 3, 5) + call trypart (2, 1, 5) + call trypart (2, 5, 3) + call trypart (2, 5, 1) + + end + + subroutine tryfull (xout, xin1, xin2) + implicit none + integer xout, xin1, xin2 + +* out, in1, and in2 are the desired indexes into the REAL array (array). + + double complex expect + integer pwr + integer out, in1, in2 + + double precision array(6) + double complex carray(3) + equivalence (carray(1), array(1)) + +* Make sure the indexes can be accommodated by the equivalences above. + + if (mod (xout, 2) .ne. 1) call abort + if (mod (xin1, 2) .ne. 1) call abort + if (mod (xin2, 2) .ne. 1) call abort + +* Convert the indexes into ones suitable for the COMPLEX array (carray). + + out = (xout + 1) / 2 + in1 = (xin1 + 1) / 2 + in2 = (xin2 + 1) / 2 + +* Check some open-coded stuff, just in case. + + call prepare1 (carray(in1)) + expect = + carray(in1) + carray(out) = + carray(in1) + call check (expect, carray(out)) + + call prepare1 (carray(in1)) + expect = - carray(in1) + carray(out) = - carray(in1) + call check (expect, carray(out)) + + call prepare2 (carray(in1), carray(in2)) + expect = carray(in1) + carray(in2) + carray(out) = carray(in1) + carray(in2) + call check (expect, carray(out)) + + call prepare2 (carray(in1), carray(in2)) + expect = carray(in1) - carray(in2) + carray(out) = carray(in1) - carray(in2) + call check (expect, carray(out)) + + call prepare2 (carray(in1), carray(in2)) + expect = carray(in1) * carray(in2) + carray(out) = carray(in1) * carray(in2) + call check (expect, carray(out)) + + call prepare1 (carray(in1)) + expect = carray(in1) ** 2 + carray(out) = carray(in1) ** 2 + call check (expect, carray(out)) + + call prepare1 (carray(in1)) + expect = carray(in1) ** 3 + carray(out) = carray(in1) ** 3 + call check (expect, carray(out)) + + call prepare1 (carray(in1)) + expect = abs (carray(in1)) + array(out*2-1) = abs (carray(in1)) + array(out*2) = 0 + call check (expect, carray(out)) + +* Now check the stuff implemented in libF77. + + call prepare1 (carray(in1)) + expect = cos (carray(in1)) + carray(out) = cos (carray(in1)) + call check (expect, carray(out)) + + call prepare1 (carray(in1)) + expect = exp (carray(in1)) + carray(out) = exp (carray(in1)) + call check (expect, carray(out)) + + call prepare1 (carray(in1)) + expect = log (carray(in1)) + carray(out) = log (carray(in1)) + call check (expect, carray(out)) + + call prepare1 (carray(in1)) + expect = sin (carray(in1)) + carray(out) = sin (carray(in1)) + call check (expect, carray(out)) + + call prepare1 (carray(in1)) + expect = sqrt (carray(in1)) + carray(out) = sqrt (carray(in1)) + call check (expect, carray(out)) + + call prepare1 (carray(in1)) + expect = conjg (carray(in1)) + carray(out) = conjg (carray(in1)) + call check (expect, carray(out)) + + call prepare1i (carray(in1), pwr) + expect = carray(in1) ** pwr + carray(out) = carray(in1) ** pwr + call check (expect, carray(out)) + + call prepare2 (carray(in1), carray(in2)) + expect = carray(in1) / carray(in2) + carray(out) = carray(in1) / carray(in2) + call check (expect, carray(out)) + + call prepare2 (carray(in1), carray(in2)) + expect = carray(in1) ** carray(in2) + carray(out) = carray(in1) ** carray(in2) + call check (expect, carray(out)) + + call prepare1 (carray(in1)) + expect = carray(in1) ** .2 + carray(out) = carray(in1) ** .2 + call check (expect, carray(out)) + + end + + subroutine trypart (xout, xin1, xin2) + implicit none + integer xout, xin1, xin2 + +* out, in1, and in2 are the desired indexes into the REAL array (array). + + double complex expect + integer pwr + integer out, in1, in2 + + double precision array(6) + double complex carray(3), carrayp(2) + equivalence (carray(1), array(1)) + equivalence (carrayp(1), array(2)) + +* Make sure the indexes can be accommodated by the equivalences above. + + if (mod (xout, 2) .ne. 0) call abort + if (mod (xin1, 2) .ne. 1) call abort + if (mod (xin2, 2) .ne. 1) call abort + +* Convert the indexes into ones suitable for the COMPLEX array (carray). + + out = xout / 2 + in1 = (xin1 + 1) / 2 + in2 = (xin2 + 1) / 2 + +* Check some open-coded stuff, just in case. + + call prepare1 (carray(in1)) + expect = + carray(in1) + carrayp(out) = + carray(in1) + call check (expect, carrayp(out)) + + call prepare1 (carray(in1)) + expect = - carray(in1) + carrayp(out) = - carray(in1) + call check (expect, carrayp(out)) + + call prepare2 (carray(in1), carray(in2)) + expect = carray(in1) + carray(in2) + carrayp(out) = carray(in1) + carray(in2) + call check (expect, carrayp(out)) + + call prepare2 (carray(in1), carray(in2)) + expect = carray(in1) - carray(in2) + carrayp(out) = carray(in1) - carray(in2) + call check (expect, carrayp(out)) + + call prepare2 (carray(in1), carray(in2)) + expect = carray(in1) * carray(in2) + carrayp(out) = carray(in1) * carray(in2) + call check (expect, carrayp(out)) + + call prepare1 (carray(in1)) + expect = carray(in1) ** 2 + carrayp(out) = carray(in1) ** 2 + call check (expect, carrayp(out)) + + call prepare1 (carray(in1)) + expect = carray(in1) ** 3 + carrayp(out) = carray(in1) ** 3 + call check (expect, carrayp(out)) + + call prepare1 (carray(in1)) + expect = abs (carray(in1)) + array(out*2) = abs (carray(in1)) + array(out*2+1) = 0 + call check (expect, carrayp(out)) + +* Now check the stuff implemented in libF77. + + call prepare1 (carray(in1)) + expect = cos (carray(in1)) + carrayp(out) = cos (carray(in1)) + call check (expect, carrayp(out)) + + call prepare1 (carray(in1)) + expect = exp (carray(in1)) + carrayp(out) = exp (carray(in1)) + call check (expect, carrayp(out)) + + call prepare1 (carray(in1)) + expect = log (carray(in1)) + carrayp(out) = log (carray(in1)) + call check (expect, carrayp(out)) + + call prepare1 (carray(in1)) + expect = sin (carray(in1)) + carrayp(out) = sin (carray(in1)) + call check (expect, carrayp(out)) + + call prepare1 (carray(in1)) + expect = sqrt (carray(in1)) + carrayp(out) = sqrt (carray(in1)) + call check (expect, carrayp(out)) + + call prepare1 (carray(in1)) + expect = conjg (carray(in1)) + carrayp(out) = conjg (carray(in1)) + call check (expect, carrayp(out)) + + call prepare1i (carray(in1), pwr) + expect = carray(in1) ** pwr + carrayp(out) = carray(in1) ** pwr + call check (expect, carrayp(out)) + + call prepare2 (carray(in1), carray(in2)) + expect = carray(in1) / carray(in2) + carrayp(out) = carray(in1) / carray(in2) + call check (expect, carrayp(out)) + + call prepare2 (carray(in1), carray(in2)) + expect = carray(in1) ** carray(in2) + carrayp(out) = carray(in1) ** carray(in2) + call check (expect, carrayp(out)) + + call prepare1 (carray(in1)) + expect = carray(in1) ** .2 + carrayp(out) = carray(in1) ** .2 + call check (expect, carrayp(out)) + + end + + subroutine prepare1 (in) + implicit none + double complex in + + in = (3.2d0, 4.2d0) + + end + + subroutine prepare1i (in, i) + implicit none + double complex in + integer i + + in = (2.3d0, 2.5d0) + i = 4 + + end + + subroutine prepare2 (in1, in2) + implicit none + double complex in1, in2 + + in1 = (1.3d0, 2.4d0) + in2 = (3.5d0, 7.1d0) + + end + + subroutine check (expect, got) + implicit none + double complex expect, got + + if (dimag(expect) .ne. dimag(got)) call abort + if (dble(expect) .ne. dble(expect)) call abort + + end diff --git a/gcc/testsuite/g77.f-torture/execute/970625-2.f b/gcc/testsuite/g77.f-torture/execute/970625-2.f new file mode 100644 index 00000000000..3ef6f46cb79 --- /dev/null +++ b/gcc/testsuite/g77.f-torture/execute/970625-2.f @@ -0,0 +1,84 @@ +* Date: Wed, 25 Jun 1997 12:48:26 +0200 (MET DST) +* MIME-Version: 1.0 +* From: R.Hooft@EuroMail.com (Rob Hooft) +* To: g77-alpha@gnu.ai.mit.edu +* Subject: Re: testing 970624. +* In-Reply-To: <199706251027.GAA07892@churchy.gnu.ai.mit.edu> +* References: <199706251018.MAA21538@nu> +* <199706251027.GAA07892@churchy.gnu.ai.mit.edu> +* X-Mailer: VM 6.30 under Emacs 19.34.1 +* Content-Type: text/plain; charset=US-ASCII +* +* >>>>> "CB" == Craig Burley <burley@gnu.ai.mit.edu> writes: +* +* CB> but OTOH I'd like to see more problems like this on other +* CB> applications, and especially other systems +* +* How about this one: An application that prints "112." on all +* compilers/platforms I have tested, except with the new g77 on ALPHA (I +* don't have the new g77 on any other platform here to test)? +* +* Application Appended. Source code courtesy of my boss..... +* Disclaimer: I do not know the right answer, or even whether there is a +* single right answer..... +* +* Regards, +* -- +* ===== R.Hooft@EuroMail.com http://www.Sander.EMBL-Heidelberg.DE/rob/ == +* ==== In need of protein modeling? http://www.Sander.EMBL-Heidelberg.DE/whatif/ +* Validation of protein structures? http://biotech.EMBL-Heidelberg.DE:8400/ ==== +* == PGPid 0xFA19277D == Use Linux! Free Software Rules The World! ============= +* +* nu[152]for% cat humor.f + PROGRAM SUBROUTINE + LOGICAL ELSE IF + INTEGER REAL, GO TO PROGRAM, WHILE + REAL FORMAT(2) + DATA IF,REAL,END DO,WHILE,FORMAT(2),I2/2,6,7,1,112.,1/ + DO THEN=1, END DO, WHILE + CALL = END DO - IF + PROGRAM = THEN - IF + ELSE IF = THEN .GT. IF + IF (THEN.GT.REAL) THEN + CALL FUNCTION PROGRAM (ELSE IF, GO TO PROGRAM, THEN) + ELSE IF (ELSE IF) THEN + REAL = THEN + END DO + END IF + END DO + 10 FORMAT(I2/I2) = WHILE*REAL*THEN + IF (FORMAT(I2) .NE. FORMAT(I2+I2)) CALL ABORT + END ! DO + SUBROUTINE FUNCTION PROGRAM (REAL,INTEGER, LOGICAL) + LOGICAL REAL + REAL LOGICAL + INTEGER INTEGER, STOP, RETURN, GO TO + ASSIGN 9 TO STOP + ASSIGN = 9 + LOGICAL + ASSIGN 7 TO RETURN + ASSIGN 9 TO GO TO + GO TO = 5 + STOP = 8 + IF (.NOT.REAL) GOTO STOP + IF (LOGICAL.GT.INTEGER) THEN + IF = LOGICAL +5 + IF (LOGICAL.EQ.5) ASSIGN 5 TO IF + INTEGER=IF + ELSE + IF (ASSIGN.GT.STOP) ASSIGN 9 TO GOTO + ELSE = GO TO + END IF = ELSE + GO TO + IF (.NOT.REAL.AND.GOTO.GT.ELSE) GOTO RETURN + END IF + 5 CONTINUE + 7 LOGICAL=LOGICAL+STOP + 9 RETURN + END ! IF +* nu[153]for% f77 humor.f +* nu[154]for% ./a.out +* 112.0000 +* nu[155]for% f90 humor.f +* nu[156]for% ./a.out +* 112.0000 +* nu[157]for% g77 humor.f +* nu[158]for% ./a.out +* 40. diff --git a/gcc/testsuite/g77.f-torture/execute/labug1.f b/gcc/testsuite/g77.f-torture/execute/labug1.f new file mode 100644 index 00000000000..032fa41f899 --- /dev/null +++ b/gcc/testsuite/g77.f-torture/execute/labug1.f @@ -0,0 +1,57 @@ + PROGRAM LABUG1 + +* This program core dumps on mips-sgi-irix6.2 when compiled +* with egcs-19981101, egcs-19981109 and egcs-19981122 snapshots +* with -O2 +* +* Originally derived from LAPACK test suite. +* Almost any change allows it to run. +* +* David Billinghurst, (David.Billinghurst@riotinto.com.au) +* 25 November 1998 +* +* .. Parameters .. + INTEGER LDA, LDE + PARAMETER ( LDA = 2500, LDE = 50 ) + COMPLEX CZERO + PARAMETER ( CZERO = ( 0.0E+0, 0.0E+0 ) ) + + INTEGER I, J, M, N + REAL V + COMPLEX A(LDA),B(LDA),C(LDA),E(LDE,LDE),F(LDE,LDE) + COMPLEX Z + + N=2 + M=1 +* + do i = 1, m + do j = 1, n + e(i,j) = czero + f(i,j) = czero + end do + end do +* + DO J = 1, N + DO I = 1, M + V = ABS( E(I,J) - F(I,J) ) + END DO + END DO + + CALL SUB2(M,Z) + + END + + subroutine SUB2(I,A) + integer i + complex a + end + + + + + + + + + + diff --git a/gcc/testsuite/g77.f-torture/noncompile/19981216-0.f b/gcc/testsuite/g77.f-torture/noncompile/19981216-0.f new file mode 100644 index 00000000000..0cc9087d6cb --- /dev/null +++ b/gcc/testsuite/g77.f-torture/noncompile/19981216-0.f @@ -0,0 +1,89 @@ +* Resent-From: Craig Burley <burley@gnu.org> +* Resent-To: craig@jcb-sc.com +* X-Delivered: at request of burley on mescaline.gnu.org +* Date: Wed, 16 Dec 1998 18:31:24 +0100 +* From: Dieter Stueken <stueken@conterra.de> +* Organization: con terra GmbH +* To: fortran@gnu.org +* Subject: possible bug +* Content-Type: text/plain; charset=iso-8859-1 +* X-Mime-Autoconverted: from 8bit to quoted-printable by mescaline.gnu.org id KAA09085 +* X-UIDL: 72293bf7f9fac8378ec7feca2bccbce2 +* +* Hi, +* +* I'm about to compile a very old, very ugly Fortran program. +* For one part I got: +* +* f77: Internal compiler error: program f771 got fatal signal 6 +* +* instead of any detailed error message. I was able to break down the +* problem to the following source fragment: +* +* ------------------------------------------- + PROGRAM WAP + + integer*2 ios + character*80 name + + name = 'blah' + open(unit=8,status='unknown',file=name,form='formatted', + F iostat=ios) + + END +* ------------------------------------------- +* +* The problem seems to be caused by the "integer*2 ios" declaration. +* So far I solved it by simply using a plain integer instead. +* +* I'm running gcc on a Linux system compiled/installed +* with no special options: +* +* -> g77 -v +* g77 version 0.5.23 +* Driving: g77 -v -c -xf77-version /dev/null -xnone +* Reading specs from /usr/lib/gcc-lib/i686-pc-linux-gnulibc1/2.8.1/specs +* gcc version 2.8.1 +* /usr/lib/gcc-lib/i686-pc-linux-gnulibc1/2.8.1/cpp -lang-c -v -undef +* -D__GNUC__=2 -D__GNUC_MINOR__=8 -D__ELF__ -D__unix__ -D__linux__ +* -D__unix -D__linux -Asystem(posix) -D_LANGUAGE_FORTRAN -traditional +* -Di386 -Di686 -Asystem(unix) -Acpu(i386) -Amachine(i386) -D__i386__ +* -D__i686__ -Asystem(unix) -Acpu(i386) -Amachine(i386) /dev/null +* /dev/null +* GNU CPP version 2.8.1 (i386 GNU/Linux with ELF) +* #include "..." search starts here: +* #include <...> search starts here: +* /usr/local/include +* /usr/i686-pc-linux-gnulibc1/include +* /usr/lib/gcc-lib/i686-pc-linux-gnulibc1/2.8.1/include +* /usr/include +* End of search list. +* /usr/lib/gcc-lib/i686-pc-linux-gnulibc1/2.8.1/f771 -fnull-version +* -quiet -dumpbase g77-version.f -version -fversion -o /tmp/cca24911.s +* /dev/null +* GNU F77 version 2.8.1 (i686-pc-linux-gnulibc1) compiled by GNU C version +* 2.8.1. +* GNU Fortran Front End version 0.5.23 +* as -V -Qy -o /tmp/cca24911.o /tmp/cca24911.s +* GNU assembler version 2.8.1 (i486-linux), using BFD version 2.8.1 +* ld -m elf_i386 -dynamic-linker /lib/ld-linux.so.1 -o /tmp/cca24911 +* /tmp/cca24911.o /usr/lib/crt1.o /usr/lib/crti.o +* /usr/lib/gcc-lib/i686-pc-linux-gnulibc1/2.8.1/crtbegin.o +* -L/usr/lib/gcc-lib/i686-pc-linux-gnulibc1/2.8.1 -L/usr -lg2c -lm -lgcc +* -lc -lgcc /usr/lib/gcc-lib/i686-pc-linux-gnulibc1/2.8.1/crtend.o +* /usr/lib/crtn.o +* /tmp/cca24911 +* __G77_LIBF77_VERSION__: 0.5.23 +* @(#)LIBF77 VERSION 19970919 +* __G77_LIBI77_VERSION__: 0.5.23 +* @(#) LIBI77 VERSION pjw,dmg-mods 19980405 +* __G77_LIBU77_VERSION__: 0.5.23 +* @(#) LIBU77 VERSION 19970919 +* +* +* Regards, Dieter. +* -- +* Dieter Stüken, con terra GmbH, Münster +* stueken@conterra.de stueken@qgp.uni-muenster.de +* http://www.conterra.de/ http://qgp.uni-muenster.de/~stueken +* (0)251-980-2027 (0)251-83-334974 diff --git a/gcc/testsuite/g77.f-torture/noncompile/19990218-1.f b/gcc/testsuite/g77.f-torture/noncompile/19990218-1.f new file mode 100644 index 00000000000..25b7c5b2b52 --- /dev/null +++ b/gcc/testsuite/g77.f-torture/noncompile/19990218-1.f @@ -0,0 +1,13 @@ + double precision function fun(a,b) + double precision a,b + print*,'in sub: a,b=',a,b + fun=a*b + print*,'in sub: fun=',fun + return + end + program test + double precision a,b,c + data a,b/1.0d-46,1.0d0/ + c=fun(a,b) + print*,'in main: fun=',c + end diff --git a/gcc/testsuite/gcc.c-torture/compile/981022-1.c b/gcc/testsuite/gcc.c-torture/compile/981022-1.c new file mode 100644 index 00000000000..6256673804a --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/981022-1.c @@ -0,0 +1,9 @@ +/* This tests a combination of two gcc extensions. Omitting the middle + operand of ?: and using ?: as an lvalue. */ +int x, y; + +int main () +{ + (x ?: y) = 0; + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/981022-1.x b/gcc/testsuite/gcc.c-torture/compile/981022-1.x new file mode 100644 index 00000000000..f41cdc29913 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/981022-1.x @@ -0,0 +1,2 @@ +set torture_compile_xfail "*-*-*" +return 0 diff --git a/gcc/testsuite/gcc.c-torture/compile/981107-1.c b/gcc/testsuite/gcc.c-torture/compile/981107-1.c new file mode 100644 index 00000000000..987ec180f9f --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/981107-1.c @@ -0,0 +1,9 @@ +unsigned long seed(void) +{ + unsigned long u; + + call(); + + u = 26107 * (unsigned long)&u; + return u; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/981211-1.c b/gcc/testsuite/gcc.c-torture/compile/981211-1.c new file mode 100644 index 00000000000..92c9cfb7013 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/981211-1.c @@ -0,0 +1,43 @@ +/* Basic tests of the #assert preprocessor extension. */ + +#define fail int fail + +#assert abc (def) +#assert abc (ghi) +#assert abc (jkl) +#assert space ( s p a c e ) + +/* Basic: */ +#if !#abc (def) || !#abc (ghi) || !#abc (jkl) +fail +#endif + +/* any answer for #abc */ +#if !#abc +fail +#endif + +/* internal whitespace is collapsed, + external whitespace is deleted */ +#if !#space (s p a c e) || !#space ( s p a c e ) || #space (space) +fail +#endif + +/* removing assertions */ +#unassert abc (jkl) +#if !#abc || !#abc (def) || !#abc (ghi) || #abc (jkl) +fail +#endif + +#unassert abc +#if #abc || #abc (def) || #abc (ghi) || #abc (jkl) +fail +#endif + +int gobble + +/* make sure it can succeed too. + also check space before open paren isn't significant */ +#if #space(s p a c e) +; +#endif diff --git a/gcc/testsuite/gcc.c-torture/compile/981223-1.c b/gcc/testsuite/gcc.c-torture/compile/981223-1.c new file mode 100644 index 00000000000..d207ff10bb3 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/981223-1.c @@ -0,0 +1,8 @@ +__complex__ float +func (__complex__ float x) +{ + if (__real__ x == 0.0) + return 1.0; + else + return 0.0; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/990107-1.c b/gcc/testsuite/gcc.c-torture/compile/990107-1.c new file mode 100644 index 00000000000..a123ce9cbf3 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/990107-1.c @@ -0,0 +1,7 @@ +static int +java_double_finite (d) + double d; +{ + long long *ip = (long long *) &d; + return (*ip & 0x7ff0000000000000LL ) != 0x7ff0000000000000LL ; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/990117-1.c b/gcc/testsuite/gcc.c-torture/compile/990117-1.c new file mode 100644 index 00000000000..dda52205988 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/990117-1.c @@ -0,0 +1,13 @@ +static void +__bb_init_prg () +{ + const char *p; + + { + unsigned long l; + + (__extension__ (__builtin_constant_p (p) && __builtin_constant_p (l) + ? 5 : 2)); + } + +} diff --git a/gcc/testsuite/gcc.c-torture/compile/990203-1.c b/gcc/testsuite/gcc.c-torture/compile/990203-1.c new file mode 100644 index 00000000000..2c69a8fe086 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/990203-1.c @@ -0,0 +1,7 @@ +int +f (f) + float f; +{ + long long *ip = (long long *) &f; + return (*ip & 0x7ff0000000000000LL ) != 0x7ff0000000000000LL ; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/941014-1.x b/gcc/testsuite/gcc.c-torture/execute/941014-1.x new file mode 100644 index 00000000000..90775849832 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/941014-1.x @@ -0,0 +1,6 @@ +# This doesn't work for thumb-elf + +if { [istarget "thumb-*-elf"] } { + set torture_execute_xfail "thumb-*-elf" +} +return 0 diff --git a/gcc/testsuite/gcc.c-torture/execute/981019-1.c b/gcc/testsuite/gcc.c-torture/execute/981019-1.c new file mode 100644 index 00000000000..5d1f009009b --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/981019-1.c @@ -0,0 +1,44 @@ +extern int f2(void); +extern int f3(void); +extern void f1(void); + +void +ff(int fname, int part, int nparts) +{ + if (fname) /* bb 0 */ + { + if (nparts) /* bb 1 */ + f1(); /* bb 2 */ + } + else + fname = 2; /* bb 3 */ + + /* bb 4 is the branch to bb 10 + (bb 10 is physically at the end of the loop) */ + while (f3() /* bb 10 */) + { + if (nparts /* bb 5 */ && f2() /* bb 6 */) + { + f1(); /* bb 7 ... */ + nparts = part; + if (f3()) /* ... bb 7 */ + f1(); /* bb 8 */ + f1(); /* bb 9 */ + break; + } + } + + if (nparts) /* bb 11 */ + f1(); /* bb 12 */ + return; /* bb 13 */ +} + +int main(void) +{ + ff(0, 1, 0); + return 0; +} + +int f3(void) { static int x = 0; x = !x; return x; } +void f1(void) { abort(); } +int f2(void) { abort(); } diff --git a/gcc/testsuite/gcc.c-torture/execute/981130-1.c b/gcc/testsuite/gcc.c-torture/execute/981130-1.c new file mode 100644 index 00000000000..72630b07ec8 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/981130-1.c @@ -0,0 +1,30 @@ +struct s { int a; int b;}; +struct s s1; +struct s s2 = { 1, 2, }; + +void +check (a, b) + int a; + int b; +{ + if (a == b) + exit (0); + else + abort (); +} + +int +main () +{ + int * p; + int x; + + s1.a = 9; + p = & s1.a; + s1 = s2; + x = * p; + + check (x, 1); +} + + diff --git a/gcc/testsuite/gcc.c-torture/execute/981130-1.x b/gcc/testsuite/gcc.c-torture/execute/981130-1.x new file mode 100644 index 00000000000..1565c68adc7 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/981130-1.x @@ -0,0 +1,22 @@ +# This test is known to fail on targets that use the instruction scheduler +# at optimisation levels of 2 or more because the alias analysis is confused +# by the reassignment of a variable structure to a fixed structure. The +# failure could be suppressed by preventing instruction scheduling: +# +# set additional_flags "-fno-schedule-insns2"; +# +# but this would disguise the fact that there is a problem. Instead we use +# we generate an xfail result and explain that it is alias analysis that +# is at fault. + +set torture_eval_before_execute { + + set compiler_conditional_xfail_data { + "alias analysis conflicts with instruction scheduling" \ + "m32r-*-*" \ + { "-O2" "-O1" "-O0" "-Os"} \ + { "" } + } +} + +return 0 diff --git a/gcc/testsuite/gcc.c-torture/execute/981206-1.c b/gcc/testsuite/gcc.c-torture/execute/981206-1.c new file mode 100644 index 00000000000..12ec0ab1897 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/981206-1.c @@ -0,0 +1,17 @@ +/* Verify unaligned address aliasing on Alpha EV[45]. */ + +static unsigned short x, y; + +void foo() +{ + x = 0x345; + y = 0x567; +} + +int main() +{ + foo (); + if (x != 0x345 || y != 0x567) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/990106-1.c b/gcc/testsuite/gcc.c-torture/execute/990106-1.c new file mode 100644 index 00000000000..6631bfd96cb --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/990106-1.c @@ -0,0 +1,16 @@ +foo(bufp) +char *bufp; +{ + int x = 80; + return (*bufp++ = x ? 'a' : 'b'); +} + +main() +{ + char x; + + if (foo (&x) != 'a') + abort (); + + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/990106-2.c b/gcc/testsuite/gcc.c-torture/execute/990106-2.c new file mode 100644 index 00000000000..c2791efaae6 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/990106-2.c @@ -0,0 +1,22 @@ +unsigned calc_mp(unsigned mod) +{ + unsigned a,b,c; + c=-1; + a=c/mod; + b=0-a*mod; + if (b > mod) { a += 1; b-=mod; } + return b; +} + +int main(int argc, char *argv[]) +{ + unsigned x = 1234; + unsigned y = calc_mp(x); + + if ((sizeof (y) == 4 && y != 680) + || (sizeof (y) == 2 && y != 134)) + abort (); + exit (0); +} + + diff --git a/gcc/testsuite/gcc.c-torture/execute/990117-1.c b/gcc/testsuite/gcc.c-torture/execute/990117-1.c new file mode 100644 index 00000000000..9589ae746f8 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/990117-1.c @@ -0,0 +1,16 @@ +int +foo (int x, int y, int i, int j) +{ + double tmp1 = ((double) x / y); + double tmp2 = ((double) i / j); + + return tmp1 < tmp2; +} + +main () +{ + if (foo (2, 24, 3, 4) == 0) + abort (); + return 0; +} + diff --git a/gcc/testsuite/gcc.c-torture/execute/990127-1.c b/gcc/testsuite/gcc.c-torture/execute/990127-1.c new file mode 100644 index 00000000000..c49584820c2 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/990127-1.c @@ -0,0 +1,31 @@ +main() +{ + int a,b,c; + int *pa, *pb, *pc; + int **ppa, **ppb, **ppc; + int i,j,k,x,y,z; + + a = 10; + b = 20; + c = 30; + pa = &a; pb = &b; pc = &c; + ppa = &pa; ppb = &pb; ppc = &pc; + x = 0; y = 0; z = 0; + + for(i=0;i<10;i++){ + if( pa == &a ) pa = &b; + else pa = &a; + while( (*pa)-- ){ + x++; + if( (*pa) < 3 ) break; + else pa = &b; + } + x++; + pa = &b; + } + + if ((*pa) != -5 || (*pb) != -5 || x != 43) + abort (); + + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/990127-2.c b/gcc/testsuite/gcc.c-torture/execute/990127-2.c new file mode 100644 index 00000000000..0d0f495124a --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/990127-2.c @@ -0,0 +1,20 @@ +void +fpEq (double x, double y) +{ + if (x != y) + abort (); +} + +void +fpTest (double x, double y) +{ + double result1 = (35.7 * 100.0) / 45.0; + double result2 = (x * 100.0) / y; + fpEq (result1, result2); +} + +main () +{ + fpTest (35.7, 45.0); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/990128-1.c b/gcc/testsuite/gcc.c-torture/execute/990128-1.c new file mode 100644 index 00000000000..cfdab3e87e5 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/990128-1.c @@ -0,0 +1,50 @@ +extern int printf (const char *,...); + +struct s { struct s *n; } *p; +struct s ss; +#define MAX 10 +struct s sss[MAX]; +int count = 0; + +void sub( struct s *p, struct s **pp ); +int look( struct s *p, struct s **pp ); + +main() +{ + struct s *pp; + struct s *next; + int i; + + p = &ss; + next = p; + for ( i = 0; i < MAX; i++ ) { + next->n = &sss[i]; + next = next->n; + } + next->n = 0; + + sub( p, &pp ); + if (count != MAX+2) + abort (); + + exit( 0 ); +} + +void sub( struct s *p, struct s **pp ) +{ + for ( ; look( p, pp ); ) { + if ( p ) + p = p->n; + else + break; + } +} + +int look( struct s *p, struct s **pp ) +{ + for ( ; p; p = p->n ) + ; + *pp = p; + count++; + return( 1 ); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/990130-1.c b/gcc/testsuite/gcc.c-torture/execute/990130-1.c new file mode 100644 index 00000000000..c38ecddbe59 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/990130-1.c @@ -0,0 +1,23 @@ +int count = 0; +int dummy; + +static int * +bar(void) +{ + ++count; + return &dummy; +} + +static void +foo(void) +{ + asm("" : "+r"(*bar())); +} + +main() +{ + foo(); + if (count != 1) + abort(); + exit(0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/990208-1.c b/gcc/testsuite/gcc.c-torture/execute/990208-1.c new file mode 100644 index 00000000000..37a11472962 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/990208-1.c @@ -0,0 +1,46 @@ +/* As a quality of implementation issue, we should not prevent inlining + of function explicitly marked inline just because a label therein had + its address taken. */ + +#ifndef NO_LABEL_VALUES +static void *ptr1, *ptr2; + +static __inline__ void doit(void **pptr, int cond) +{ + if (cond) { + here: + *pptr = &&here; + } +} + +static void f(int cond) +{ + doit (&ptr1, cond); +} + +static void g(int cond) +{ + doit (&ptr2, cond); +} + +static void bar(void); + +int main() +{ + f (1); + bar(); + g (1); + +#ifdef __OPTIMIZE__ + if (ptr1 == ptr2) + abort (); +#endif + + exit (0); +} + +void bar(void) { } + +#else /* NO_LABEL_VALUES */ +int main() { exit(0); } +#endif diff --git a/gcc/testsuite/gcc.c-torture/execute/990211-1.c b/gcc/testsuite/gcc.c-torture/execute/990211-1.c new file mode 100644 index 00000000000..e2fe7eea398 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/990211-1.c @@ -0,0 +1,61 @@ +/* Copyright (C) 1999 Free Software Foundation, Inc. + Contributed by Nathan Sidwell 20 Jan 1999 <nathan@acm.org> */ + +/* check range combining boolean operations work */ + +extern void abort(); + +#define N 77 + +void func(int i) +{ + /* fold-const does some clever things with range tests. Make sure + we get (some of) them right */ + + /* these must fail, regardless of the value of i */ + if ((i < 0) && (i >= 0)) + abort(); + if ((i > 0) && (i <= 0)) + abort(); + if ((i >= 0) && (i < 0)) + abort(); + if ((i <= 0) && (i > 0)) + abort(); + + if ((i < N) && (i >= N)) + abort(); + if ((i > N) && (i <= N)) + abort(); + if ((i >= N) && (i < N)) + abort(); + if ((i <= N) && (i > N)) + abort(); + + /* these must pass, regardless of the value of i */ + if (! ((i < 0) || (i >= 0))) + abort(); + if (! ((i > 0) || (i <= 0))) + abort(); + if (! ((i >= 0) || (i < 0))) + abort(); + if (! ((i <= 0) || (i > 0))) + abort(); + + if (! ((i < N) || (i >= N))) + abort(); + if (! ((i > N) || (i <= N))) + abort(); + if (! ((i >= N) || (i < N))) + abort(); + if (! ((i <= N) || (i > N))) + abort(); + + return; +} + +int main() +{ + func(0); + func(1); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/990222-1.c b/gcc/testsuite/gcc.c-torture/execute/990222-1.c new file mode 100644 index 00000000000..98b94f39860 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/990222-1.c @@ -0,0 +1,11 @@ +char line[4] = { '1', '9', '9', '\0' }; + +int main() +{ + char *ptr = line + 3; + + while ((*--ptr += 1) > '9') *ptr = '0'; + if (line[0] != '2' || line[1] != '0' || line[2] != '0') + abort(); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/990324-1.c b/gcc/testsuite/gcc.c-torture/execute/990324-1.c new file mode 100644 index 00000000000..d9baa0885f5 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/990324-1.c @@ -0,0 +1,13 @@ +void f(long i) +{ + if ((signed char)i < 0 || (signed char)i == 0) + abort (); + else + exit (0); +} + +main() +{ + f(0xffffff01); +} + diff --git a/gcc/testsuite/gcc.c-torture/execute/990326-1.c b/gcc/testsuite/gcc.c-torture/execute/990326-1.c new file mode 100644 index 00000000000..1b8e5d80550 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/990326-1.c @@ -0,0 +1,392 @@ +struct a { + char a, b; + short c; +}; + +int +a1() +{ + static struct a x = { 1, 2, ~1 }, y = { 65, 2, ~2 }; + + return (x.a == (y.a & ~64) && x.b == y.b); +} + +int +a2() +{ + static struct a x = { 1, 66, ~1 }, y = { 1, 2, ~2 }; + + return (x.a == y.a && (x.b & ~64) == y.b); +} + +int +a3() +{ + static struct a x = { 9, 66, ~1 }, y = { 33, 18, ~2 }; + + return ((x.a & ~8) == (y.a & ~32) && (x.b & ~64) == (y.b & ~16)); +} + +struct b { + int c; + short b, a; +}; + +int +b1() +{ + static struct b x = { ~1, 2, 1 }, y = { ~2, 2, 65 }; + + return (x.a == (y.a & ~64) && x.b == y.b); +} + +int +b2() +{ + static struct b x = { ~1, 66, 1 }, y = { ~2, 2, 1 }; + + return (x.a == y.a && (x.b & ~64) == y.b); +} + +int +b3() +{ + static struct b x = { ~1, 66, 9 }, y = { ~2, 18, 33 }; + + return ((x.a & ~8) == (y.a & ~32) && (x.b & ~64) == (y.b & ~16)); +} + +struct c { + unsigned int c:4, b:14, a:14; +}; + +int +c1() +{ + static struct c x = { ~1, 2, 1 }, y = { ~2, 2, 65 }; + + return (x.a == (y.a & ~64) && x.b == y.b); +} + +int +c2() +{ + static struct c x = { ~1, 66, 1 }, y = { ~2, 2, 1 }; + + return (x.a == y.a && (x.b & ~64) == y.b); +} + +int +c3() +{ + static struct c x = { ~1, 66, 9 }, y = { ~2, 18, 33 }; + + return ((x.a & ~8) == (y.a & ~32) && (x.b & ~64) == (y.b & ~16)); +} + +struct d { + unsigned int a:14, b:14, c:4; +}; + +int +d1() +{ + static struct d x = { 1, 2, ~1 }, y = { 65, 2, ~2 }; + + return (x.a == (y.a & ~64) && x.b == y.b); +} + +int +d2() +{ + static struct d x = { 1, 66, ~1 }, y = { 1, 2, ~2 }; + + return (x.a == y.a && (x.b & ~64) == y.b); +} + +int +d3() +{ + static struct d x = { 9, 66, ~1 }, y = { 33, 18, ~2 }; + + return ((x.a & ~8) == (y.a & ~32) && (x.b & ~64) == (y.b & ~16)); +} + +struct e { + int c:4, b:14, a:14; +}; + +int +e1() +{ + static struct e x = { ~1, -2, -65 }, y = { ~2, -2, -1 }; + + return (x.a == (y.a & ~64) && x.b == y.b); +} + +int +e2() +{ + static struct e x = { ~1, -2, -1 }, y = { ~2, -66, -1 }; + + return (x.a == y.a && (x.b & ~64) == y.b); +} + +int +e3() +{ + static struct e x = { ~1, -18, -33 }, y = { ~2, -66, -9 }; + + return ((x.a & ~8) == (y.a & ~32) && (x.b & ~64) == (y.b & ~16)); +} + +struct f { + int a:14, b:14, c:4; +}; + +int +f1() +{ + static struct f x = { -65, -2, ~1 }, y = { -1, -2, ~2 }; + + return (x.a == (y.a & ~64) && x.b == y.b); +} + +int +f2() +{ + static struct f x = { -1, -2, ~1 }, y = { -1, -66, ~2 }; + + return (x.a == y.a && (x.b & ~64) == y.b); +} + +int +f3() +{ + static struct f x = { -33, -18, ~1 }, y = { -9, -66, ~2 }; + + return ((x.a & ~8) == (y.a & ~32) && (x.b & ~64) == (y.b & ~16)); +} + +struct gx { + int c:4, b:14, a:14; +}; +struct gy { + int b:14, a:14, c:4; +}; + +int +g1() +{ + static struct gx x = { ~1, -2, -65 }; + static struct gy y = { -2, -1, ~2 }; + + return (x.a == (y.a & ~64) && x.b == y.b); +} + +int +g2() +{ + static struct gx x = { ~1, -2, -1 }; + static struct gy y = { -66, -1, ~2 }; + + return (x.a == y.a && (x.b & ~64) == y.b); +} + +int +g3() +{ + static struct gx x = { ~1, -18, -33 }; + static struct gy y = { -66, -9, ~2 }; + + return ((x.a & ~8) == (y.a & ~32) && (x.b & ~64) == (y.b & ~16)); +} + +int +g4() +{ + static struct gx x = { ~1, 0x0020, 0x0010 }; + static struct gy y = { 0x0200, 0x0100, ~2 }; + + return ((x.a & 0x00f0) == (y.a & 0x0f00) && + (x.b & 0x00f0) == (y.b & 0x0f00)); +} + +int +g5() +{ + static struct gx x = { ~1, 0x0200, 0x0100 }; + static struct gy y = { 0x0020, 0x0010, ~2 }; + + return ((x.a & 0x0f00) == (y.a & 0x00f0) && + (x.b & 0x0f00) == (y.b & 0x00f0)); +} + +int +g6() +{ + static struct gx x = { ~1, 0xfe20, 0xfd10 }; + static struct gy y = { 0xc22f, 0xc11f, ~2 }; + + return ((x.a & 0x03ff) == (y.a & 0x3ff0) && + (x.b & 0x03ff) == (y.b & 0x3ff0)); +} + +int +g7() +{ + static struct gx x = { ~1, 0xc22f, 0xc11f }; + static struct gy y = { 0xfe20, 0xfd10, ~2 }; + + return ((x.a & 0x3ff0) == (y.a & 0x03ff) && + (x.b & 0x3ff0) == (y.b & 0x03ff)); +} + +struct hx { + int a:14, b:14, c:4; +}; +struct hy { + int c:4, a:14, b:14; +}; + +int +h1() +{ + static struct hx x = { -65, -2, ~1 }; + static struct hy y = { ~2, -1, -2 }; + + return (x.a == (y.a & ~64) && x.b == y.b); +} + +int +h2() +{ + static struct hx x = { -1, -2, ~1 }; + static struct hy y = { ~2, -1, -66 }; + + return (x.a == y.a && (x.b & ~64) == y.b); +} + +int +h3() +{ + static struct hx x = { -33, -18, ~1 }; + static struct hy y = { ~2, -9, -66 }; + + return ((x.a & ~8) == (y.a & ~32) && (x.b & ~64) == (y.b & ~16)); +} + +int +h4() +{ + static struct hx x = { 0x0010, 0x0020, ~1 }; + static struct hy y = { ~2, 0x0100, 0x0200 }; + + return ((x.a & 0x00f0) == (y.a & 0x0f00) && + (x.b & 0x00f0) == (y.b & 0x0f00)); +} + +int +h5() +{ + static struct hx x = { 0x0100, 0x0200, ~1 }; + static struct hy y = { ~2, 0x0010, 0x0020 }; + + return ((x.a & 0x0f00) == (y.a & 0x00f0) && + (x.b & 0x0f00) == (y.b & 0x00f0)); +} + +int +h6() +{ + static struct hx x = { 0xfd10, 0xfe20, ~1 }; + static struct hy y = { ~2, 0xc11f, 0xc22f }; + + return ((x.a & 0x03ff) == (y.a & 0x3ff0) && + (x.b & 0x03ff) == (y.b & 0x3ff0)); +} + +int +h7() +{ + static struct hx x = { 0xc11f, 0xc22f, ~1 }; + static struct hy y = { ~2, 0xfd10, 0xfe20 }; + + return ((x.a & 0x3ff0) == (y.a & 0x03ff) && + (x.b & 0x3ff0) == (y.b & 0x03ff)); +} + +struct foo { + int junk; /* this is to force alignment */ + unsigned char w, x, y, z; +}; + +int +main() +{ + if (!a1 ()) + abort (); + if (!a2 ()) + abort (); + if (!a3 ()) + abort (); + if (!b1 ()) + abort (); + if (!b2 ()) + abort (); + if (!b3 ()) + abort (); + if (!c1 ()) + abort (); + if (!c2 ()) + abort (); + if (!c3 ()) + abort (); + if (!d1 ()) + abort (); + if (!d2 ()) + abort (); + if (!d3 ()) + abort (); + if (!e1 ()) + abort (); + if (!e2 ()) + abort (); + if (!e3 ()) + abort (); + if (!f1 ()) + abort (); + if (!f2 ()) + abort (); + if (!f3 ()) + abort (); + if (!g1 ()) + abort (); + if (!g2 ()) + abort (); + if (!g3 ()) + abort (); + if (g4 ()) + abort (); + if (g5 ()) + abort (); + if (!g6 ()) + abort (); + if (!g7 ()) + abort (); + if (!h1 ()) + abort (); + if (!h2 ()) + abort (); + if (!h3 ()) + abort (); + if (h4 ()) + abort (); + if (h5 ()) + abort (); + if (!h6 ()) + abort (); + if (!h7 ()) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/ieee/980619-1.x b/gcc/testsuite/gcc.c-torture/execute/ieee/980619-1.x new file mode 100644 index 00000000000..de72f0385c7 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/ieee/980619-1.x @@ -0,0 +1,11 @@ +set torture_eval_before_execute { + + set compiler_conditional_xfail_data { + "ia32 fp rounding isn't pedantic" \ + "i?86-*-*" \ + { "-O3" "-O2" "-O1" "-Os"} \ + { "" } + } +} + +return 0 diff --git a/gcc/testsuite/gcc.c-torture/execute/memcpy-bi.c b/gcc/testsuite/gcc.c-torture/execute/memcpy-bi.c new file mode 100644 index 00000000000..c6d6e035346 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/memcpy-bi.c @@ -0,0 +1,52 @@ +/* Test builtin-memcpy (which may emit different code for different N). */ + +#define TESTSIZE 80 + +char src[TESTSIZE] __attribute__ ((aligned)); +char dst[TESTSIZE] __attribute__ ((aligned)); + +void +check (char *test, char *match, int n) +{ + if (memcmp (test, match, n)) + abort (); +} + +#define TN(n) \ +{ memset (dst, 0, n); memcpy (dst, src, n); check (dst, src, n); } +#define T(n) \ +TN (n) \ +TN ((n) + 1) \ +TN ((n) + 2) \ +TN ((n) + 3) + +main () +{ + int i,j; + + for (i = 0; i < sizeof (src); ++i) + src[i] = 'a' + i % 26; + + T (0); + T (4); + T (8); + T (12); + T (16); + T (20); + T (24); + T (28); + T (32); + T (36); + T (40); + T (44); + T (48); + T (52); + T (56); + T (60); + T (64); + T (68); + T (72); + T (76); + + return 0; +} diff --git a/gcc/testsuite/gcc.dg/990117-1.c b/gcc/testsuite/gcc.dg/990117-1.c new file mode 100644 index 00000000000..2e7ea5a1551 --- /dev/null +++ b/gcc/testsuite/gcc.dg/990117-1.c @@ -0,0 +1,21 @@ +/* { dg-do compile { target i?86-*-* } } */ +/* { dg-options "-O2 -march=pentiumpro" } */ + +extern __inline double +fabs (double __x) +{ + register double __value; + __asm __volatile__ + ("fabs" + : "=t" (__value) : "0" (__x)); + return __value; +} +int +foo () +{ + int i, j, k; + double x = 0, y = ((i == j) ? 1 : 0); + for (i = 0; i < 10; i++) + ; + fabs (x - y); +} diff --git a/gcc/testsuite/gcc.dg/990119-1.c b/gcc/testsuite/gcc.dg/990119-1.c new file mode 100644 index 00000000000..7e33518a35c --- /dev/null +++ b/gcc/testsuite/gcc.dg/990119-1.c @@ -0,0 +1,15 @@ +/* This checks for two things: + - an obscure corner case in the standard rules for __LINE__ + - regression of an associated bug in cpplib where the semicolon got lost */ +/* { dg-do run } */ + +int i = __LINE__\ +; + +int main (void) /* { dg-bogus "parse error" "semicolon eaten" } */ +{ + if (i != 6) + abort(); + else + return 0; +} diff --git a/gcc/testsuite/gcc.dg/990130-1.c b/gcc/testsuite/gcc.dg/990130-1.c new file mode 100644 index 00000000000..3e711c2febb --- /dev/null +++ b/gcc/testsuite/gcc.dg/990130-1.c @@ -0,0 +1,24 @@ +/* { dg-do compile { target i?86-*-* } } */ +/* { dg-options -O0 } */ + +typedef int SItype __attribute__ ((mode (SI))); +typedef int DItype __attribute__ ((mode (DI))); +typedef unsigned int USItype __attribute__ ((mode (SI))); + struct DIstruct {SItype low, high;}; +typedef union +{ + struct DIstruct s; + DItype ll; +} DIunion; +DItype +__muldi3 (DItype u, DItype v) +{ + DIunion w; + DIunion uu, vv; + uu.ll = u, + vv.ll = v; + w.ll = ({DIunion __w; __asm__ ("mull %3" : "=a" ((USItype) ( __w.s.low )), "=d" ((USItype) ( __w.s.high )) : "%0" ((USItype) ( uu.s.low )), "rm" ((USItype) ( vv.s.low ))) ; __w.ll; }) ; + w.s.high += ((USItype) uu.s.low * (USItype) vv.s.high + + (USItype) uu.s.high * (USItype) vv.s.low); + return w.ll; +} diff --git a/gcc/testsuite/gcc.dg/990213-1.c b/gcc/testsuite/gcc.dg/990213-1.c new file mode 100644 index 00000000000..a7c9f24898a --- /dev/null +++ b/gcc/testsuite/gcc.dg/990213-1.c @@ -0,0 +1,12 @@ +/* { dg-do compile } */ +/* { dg-options "-W -Wall -Werror" } */ + +static inline int unused_fn(int dummyarg) +{ + return dummyarg*dummyarg; +} + +int main() +{ + return 0; +} diff --git a/gcc/testsuite/gcc.dg/990213-2.c b/gcc/testsuite/gcc.dg/990213-2.c new file mode 100644 index 00000000000..6e6b924ed89 --- /dev/null +++ b/gcc/testsuite/gcc.dg/990213-2.c @@ -0,0 +1,15 @@ +/* { dg-do compile { target i?86-*-* } } */ +/* { dg-options "-fPIC" } */ + +struct normal_encoding {}; +struct unknown_encoding {}; +static const struct normal_encoding latin1_encoding = {}; + +struct encoding* +XmlInitUnknownEncoding(void *mem) +{ + int i; + struct unknown_encoding *e = mem; + for (i = 0; i < sizeof(struct normal_encoding); i++) + ((char *)mem)[i] = ((char *)&latin1_encoding)[i]; +} diff --git a/gcc/testsuite/gcc.dg/990214-1.c b/gcc/testsuite/gcc.dg/990214-1.c new file mode 100644 index 00000000000..5701b5df713 --- /dev/null +++ b/gcc/testsuite/gcc.dg/990214-1.c @@ -0,0 +1,15 @@ +/* { dg-do compile { target i?86-*-* } } */ +/* { dg-options "-fPIC" } */ + +typedef int int64_t __attribute__ ((__mode__ ( __DI__ ))) ; +unsigned * +bar (int64_t which) +{ + switch (which & 15 ) { + case 0 : + break; + case 1 : + case 5 : + case 2 : + } +} diff --git a/gcc/testsuite/gcc.dg/990228-1.c b/gcc/testsuite/gcc.dg/990228-1.c new file mode 100644 index 00000000000..4b846ea219f --- /dev/null +++ b/gcc/testsuite/gcc.dg/990228-1.c @@ -0,0 +1,29 @@ +/* Regression test for cpp. The following input may cause core dumps + or # line markers in the middle of the line. */ +/* { dg-do preprocess } */ + +#define foo(string, arg) bar(2, string, arg) + +foo ("\ +\ +\ +\ +\ +\ +\ +\ +\ +\ +\ +", +NULL); + +/* + { dg-final { if ![file exists 990228-1.i] { return } } } + { dg-final { set tmp [grep 990228-1.i ".#"] } } + { dg-final { if { [string length $tmp] == 0 } \{ } } + { dg-final { pass "990228-1.c: linemarkers in middle of line" } } + { dg-final { \} else \{ } } + { dg-final { fail "990228-1.c: linemarkers in middle of line" } } + { dg-final { \} } } + */ diff --git a/gcc/testsuite/gcc.dg/cpp-if1.c b/gcc/testsuite/gcc.dg/cpp-if1.c new file mode 100644 index 00000000000..be0f6182836 --- /dev/null +++ b/gcc/testsuite/gcc.dg/cpp-if1.c @@ -0,0 +1,34 @@ +/* { dg-do preprocess } */ +/* { dg-options "-pedantic-errors" } */ + +#if 0xa != 10 +#error 0xa != 10 /* { dg-bogus "#error" "normal conversion" } */ +#endif + +#if 077 != 63 +#error 077 != 63 /* { dg-bogus "#error" "normal conversion" } */ +#endif + +#if 12wrt /* { dg-error "nvalid number" "invalid number" } */ +#endif + +#if 0abc /* { dg-error "nvalid number" "invalid number" } */ +#endif + +#if 42abc /* { dg-error "nvalid number" "invalid number" } */ +#endif + +#if 1.2 /* { dg-error "floating point numbers" "floating point in #if" } */ +#endif + +#if 4uu /* { dg-error "too many `u' suffixes" "too many suffixes" } */ +#endif + +#if 124123231lll /* { dg-error "too many `l' suffixes" "too many suffixes" } */ +#endif + +#if 099 /* { dg-error "digits beyond the radix" "decimal in octal constant" } */ +#endif + +#if 0xfffffffffffffffff /* { dg-error "integer constant out of range" "range error" } */ +#endif diff --git a/gcc/testsuite/gcc.dg/cpp-if2.c b/gcc/testsuite/gcc.dg/cpp-if2.c new file mode 100644 index 00000000000..60e8ffd22dc --- /dev/null +++ b/gcc/testsuite/gcc.dg/cpp-if2.c @@ -0,0 +1,19 @@ +/* { dg-do preprocess } */ +/* { dg-options -pedantic-errors } */ + +#if 'a' != 'a' || '\001' != 1 || '\x12' != 0x12 +#error a,1,0x12 /* { dg-bogus "#error" "basic charconst recognition" } */ +#endif + +#if 'a' != L'a' || L'\xfeed' != 0xfeed +#error L'a',0xfeed /* { dg-bogus "#error" "wide charconst recognition" } */ +#endif + +#if 'abcd' /* { dg-warning "multi-character character constant" "multi-character charconst" } */ +#endif + +#if 'abcdefghi' /* { dg-error "character constant (is )?too long" "charconst too long" } */ +#endif + +#if '' /* { dg-error "empty character constant" "empty charconst" } */ +#endif diff --git a/gcc/testsuite/gcc.dg/cpp-if3.c b/gcc/testsuite/gcc.dg/cpp-if3.c new file mode 100644 index 00000000000..6dfe39d3932 --- /dev/null +++ b/gcc/testsuite/gcc.dg/cpp-if3.c @@ -0,0 +1,23 @@ +/* { dg-do preprocess } */ +/* { dg-options -pedantic-errors } */ + +#define U_MAX 4294967295U +#define ULL_MAX 18446744073709551615ULL +#define LL_MAX 9223372036854775807LL +#define LL_MIN (-LL_MAX-1) + +/* Check simple truncation. */ +#if U_MAX == ULL_MAX || LL_MIN == 0 || LL_MAX == -1 +#error "simple truncation" /* { dg-bogus "trunc" "simple truncation" } */ +#endif + +/* Check left/right shifting with all bits set and with one bit set. */ +#if !(~0ULL >> 63) || !(~0ULL << 63) || !(~0LL >> 63) || !(~0LL << 63) || \ + !(LL_MIN >> 63) || !(1LL << 62) || !(ULL_MAX >> 63) || !(1ULL << 63) +#error "bit shift truncation" /* { dg-bogus "trunc" "bit shift truncation" } */ +#endif + +/* Check math expressions. */ +#if (2ULL * U_MAX < U_MAX) || (1ULL + U_MAX < U_MAX) +#error "math truncation" /* { dg-bogus "trunc" "math truncation" } */ +#endif diff --git a/gcc/testsuite/gcc.dg/setjmp-1.c b/gcc/testsuite/gcc.dg/setjmp-1.c new file mode 100644 index 00000000000..85e0fb4261f --- /dev/null +++ b/gcc/testsuite/gcc.dg/setjmp-1.c @@ -0,0 +1,36 @@ +/* Test for bogus "variable `x' may be clobbered by longjmp" warnings. + Inspired by cse.c:simplify_relational_operation. */ + +/* { dg-do compile } */ +/* { dg-options "-O -W -Wall" } */ + +#include <setjmp.h> + +extern void set_float_handler (jmp_buf *); + +#define EQ 0x01 +#define LT 0x02 +#define GT 0x04 + +int +compare_float (double a, double b) /* { dg-bogus "clobbered" "spurious clobbered warning" { xfail *-*-* } } */ +{ + jmp_buf handler; + int result; + + a += 1.0; + + if (setjmp (handler)) + { + set_float_handler (0); + return 0; + } + + set_float_handler (&handler); + if (a == b) result = EQ; + else if (a > b) result = LT; + else if (a < b) result = GT; + else result = 0; + set_float_handler (0); + return result; +} diff --git a/gcc/testsuite/gcc.dg/ultrasp1.c b/gcc/testsuite/gcc.dg/ultrasp1.c new file mode 100644 index 00000000000..853c72d35ab --- /dev/null +++ b/gcc/testsuite/gcc.dg/ultrasp1.c @@ -0,0 +1,9 @@ +/* Simplified from testcase by David Staepelaere <staapa@ultimatech.com> */ + +/* { dg-do compile { xfail sparc-*-* } } */ +/* { dg-options "" } */ +/* { dg-options -mcpu=ultrasparc { target sparc-*-*-* } } */ + +int foo(long long y) { + return -1 * y; +} diff --git a/gcc/testsuite/gcc.dg/uninit-1.c b/gcc/testsuite/gcc.dg/uninit-1.c new file mode 100644 index 00000000000..91838810fda --- /dev/null +++ b/gcc/testsuite/gcc.dg/uninit-1.c @@ -0,0 +1,30 @@ +/* Spurious uninitialized variable warnings, case 1. + Taken from cppfiles.c (merge_include_chains) */ +/* { dg-do compile } */ +/* { dg-options "-O -Wuninitialized" } */ + +struct list +{ + struct list *next; + int id; +}; + +extern void free (void *); + +void remove_dupes (struct list *el) +{ + struct list *p, *q, *r; /* { dg-bogus "r" "uninitialized variable warning" { xfail *-*-* } } */ + + for (p = el; p; p = p->next) + { + for (q = el; q != p; q = q->next) + if (q->id == p->id) + { + r->next = p->next; + free (p); + p = r; + break; + } + r = p; + } +} diff --git a/gcc/testsuite/gcc.dg/uninit-2.c b/gcc/testsuite/gcc.dg/uninit-2.c new file mode 100644 index 00000000000..5035a309ebd --- /dev/null +++ b/gcc/testsuite/gcc.dg/uninit-2.c @@ -0,0 +1,52 @@ +/* Spurious uninitialized variable warnings, case 2. + Taken from cpphash.c (macroexpand) */ +/* { dg-do compile } */ +/* { dg-options "-O -Wuninitialized" } */ + +struct definition +{ + int nargs; + int rest_args; +}; + +struct cpp_reader; + +enum cpp_token +{ + CPP_EOF, CPP_POP, CPP_COMMA, CPP_RPAREN +}; + +extern enum cpp_token macarg (struct cpp_reader *, int); + +void +macroexpand (struct cpp_reader *pfile, struct definition *defn) +{ + int nargs = defn->nargs; + + if (nargs >= 0) + { + enum cpp_token token; /* { dg-bogus "token" "uninitialized variable warning" { xfail *-*-* } } */ + int i, rest_args; + i = 0; + rest_args = 0; + do + { + if (rest_args) + continue; + if (i < nargs || (nargs == 0 && i == 0)) + { + /* if we are working on last arg which absorbs rest of args... */ + if (i == nargs - 1 && defn->rest_args) + rest_args = 1; + token = macarg (pfile, rest_args); + } + else + token = macarg (pfile, 0); + if (token == CPP_EOF || token == CPP_POP) + return; + + i++; + } + while (token == CPP_COMMA); + } +} diff --git a/gcc/testsuite/gcc.dg/uninit-3.c b/gcc/testsuite/gcc.dg/uninit-3.c new file mode 100644 index 00000000000..78c4254dea5 --- /dev/null +++ b/gcc/testsuite/gcc.dg/uninit-3.c @@ -0,0 +1,33 @@ +/* Spurious uninit variable warnings, case 3. + Inspired by cppexp.c (parse_charconst) */ +/* { dg-do compile } */ +/* { dg-options "-O -Wuninitialized" } */ + +extern void error (char *); + +int +parse_charconst (const char *start, const char *end) +{ + int c; /* { dg-bogus "c" "uninitialized variable warning" { xfail *-*-* } } */ + int nchars, retval; + + nchars = 0; + retval = 0; + while (start < end) + { + c = *start++; + if (c == '\'') + break; + nchars++; + retval += c; + retval <<= 8; + } + + if (nchars == 0) + return 0; + + if (c != '\'') + error ("malformed character constant"); + + return retval; +} diff --git a/gcc/testsuite/gcc.dg/uninit-4.c b/gcc/testsuite/gcc.dg/uninit-4.c new file mode 100644 index 00000000000..34973532c57 --- /dev/null +++ b/gcc/testsuite/gcc.dg/uninit-4.c @@ -0,0 +1,50 @@ +/* Spurious uninit variable warnings, case 4. + Simplified version of cppexp.c (cpp_parse_expr). + + This one is really fragile, it gets it right if you take out case + 1, or if the structure is replaced by an int, or if the structure + has fewer members (!) */ + +/* { dg-do compile } */ +/* { dg-options "-O -Wuninitialized" } */ + +struct operation { + short op; + char rprio; + char flags; + char unsignedp; + long value; +}; + +extern struct operation cpp_lex (void); + +void +cpp_parse_expr (void) +{ + int rprio; /* { dg-bogus "rprio" "uninitialized variable warning" { xfail *-*-* } } */ + struct operation op; + + for (;;) + { + op = cpp_lex (); + + switch (op.op) + { + case 0: + break; + case 1: + return; + case 2: + rprio = 1; + break; + default: + return; + } + + if (op.op == 0) + return; + + if (rprio != 1) + abort(); + } +} diff --git a/gcc/testsuite/gcc.dg/uninit-5.c b/gcc/testsuite/gcc.dg/uninit-5.c new file mode 100644 index 00000000000..ac760d69e03 --- /dev/null +++ b/gcc/testsuite/gcc.dg/uninit-5.c @@ -0,0 +1,40 @@ +/* Spurious uninitialized-variable warnings. + These cases are documented as not working in the gcc manual. */ + +/* { dg-do compile } */ +/* { dg-options "-O -Wuninitialized" } */ + +extern void use(int); +extern void foo(void); + +void +func1(int cond) +{ + int x; /* { dg-bogus "x" "uninitialized variable warning" { xfail *-*-* } } */ + + if(cond) + x = 1; + + foo(); + + if(cond) + use(x); +} + +void +func2 (int cond) +{ + int x; /* { dg-bogus "x" "uninitialized variable warning" { xfail *-*-* } } */ + int flag = 0; + + if(cond) + { + x = 1; + flag = 1; + } + + foo(); + + if(flag) + use(x); +} diff --git a/gcc/testsuite/gcc.dg/uninit-6.c b/gcc/testsuite/gcc.dg/uninit-6.c new file mode 100644 index 00000000000..2c428df79b6 --- /dev/null +++ b/gcc/testsuite/gcc.dg/uninit-6.c @@ -0,0 +1,47 @@ +/* Spurious uninitialized variable warnings. + This one inspired by java/class.c:build_utf8_ref. */ + +/* { dg-do compile } */ +/* { dg-options "-O -Wuninitialized" } */ + +#include <stddef.h> + +struct tree +{ + struct tree *car; + struct tree *cdr; + int type, data; +}; + +extern void *malloc(size_t); + +#define INTEGER_T 1 +#define PTR_T 2 + +#define APPEND(TREE, LAST, TYPE, VALUE) \ +do { \ + struct tree *tmp = malloc (sizeof (struct tree)); \ + tmp->car = 0; tmp->cdr = 0; tmp->type = TYPE; \ + tmp->data = VALUE; \ + if (TREE->car) \ + LAST->cdr = tmp; \ + else \ + TREE->car = tmp; \ + LAST = tmp; \ +} while(0) + +struct tree * +make_something(int a, int b, int c) +{ + struct tree *rv; + struct tree *field; /* { dg-bogus "field" "uninitialized variable warning" { xfail *-*-* } } */ + + rv = malloc (sizeof (struct tree)); + rv->car = 0; + + APPEND(rv, field, INTEGER_T, a); + APPEND(rv, field, PTR_T, b); + APPEND(rv, field, INTEGER_T, c); + + return rv; +} diff --git a/gcc/testsuite/gcc.dg/uninit-8.c b/gcc/testsuite/gcc.dg/uninit-8.c new file mode 100644 index 00000000000..94117da37c9 --- /dev/null +++ b/gcc/testsuite/gcc.dg/uninit-8.c @@ -0,0 +1,32 @@ +/* Uninitialized variable warning tests... + Inspired by part of optabs.c:expand_binop. + May be the same as uninit-1.c. */ + +/* { dg-do compile } */ +/* { dg-options "-O -Wuninitialized" } */ + +#include <limits.h> + +void +add_bignums (int *out, int *x, int *y) +{ + int p, sum; + int carry; /* { dg-bogus "carry" "uninitialized variable warning" { xfail *-*-* } } */ + + p = 0; + for (; *x; x++, y++, out++, p++) + { + if (p) + sum = *x + *y + carry; + else + sum = *x + *y; + + if (sum < 0) + { + carry = 1; + sum -= INT_MAX; + } + else + carry = 0; + } +} diff --git a/gcc/testsuite/gcc.dg/uninit-9.c b/gcc/testsuite/gcc.dg/uninit-9.c new file mode 100644 index 00000000000..8b439a4512d --- /dev/null +++ b/gcc/testsuite/gcc.dg/uninit-9.c @@ -0,0 +1,41 @@ +/* Spurious uninitialized variable warnings. Slight variant on the + documented case, inspired by reg-stack.c:record_asm_reg_life. */ + +/* { dg-do compile } */ +/* { dg-options "-O -Wuninitialized" } */ + +struct foo +{ + int type; + struct foo *car; + struct foo *cdr; + char *data; + int data2; +}; + +extern void use(struct foo *); + +#define CLOBBER 6 +#define PARALLEL 3 + +void +func(struct foo *list, int count) +{ + int n_clobbers = 0; + int i; + struct foo **clob_list; /* { dg-bogus "clob_list" "uninitialized variable warning" { xfail *-*-* } } */ + + if(list[0].type == PARALLEL) + { + clob_list = alloca(count * sizeof(struct foo *)); + + for(i = 1; i < count; i++) + { + if(list[i].type == CLOBBER) + clob_list[n_clobbers++] = &list[i]; + } + } + + for(i = 0; i < n_clobbers; i++) + use(clob_list[i]); +} diff --git a/gcc/testsuite/lib/g++-dg.exp b/gcc/testsuite/lib/g++-dg.exp new file mode 100644 index 00000000000..cad429e729e --- /dev/null +++ b/gcc/testsuite/lib/g++-dg.exp @@ -0,0 +1,83 @@ +# Copyright (C) 1997, 1999 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +# Please email any bugs, comments, and/or additions to this file to: +# bug-g++@prep.ai.mit.edu + +# Define g++ callbacks for dg.exp. + +load_lib dg.exp + +proc g++-dg-test { prog do_what extra_tool_flags } { + # Set up the compiler flags, based on what we're going to do. + + switch $do_what { + "preprocess" { + set compile_type "preprocess" + set output_file "[file rootname [file tail $prog]].i" + } + "compile" { + set compile_type "assembly" + set output_file "[file rootname [file tail $prog]].s" + } + "assemble" { + set compile_type "object" + set output_file "[file rootname [file tail $prog]].o" + } + "link" { + set compile_type "executable" + set output_file "a.out" + # The following line is needed for targets like the i960 where + # the default output file is b.out. Sigh. + } + "run" { + set compile_type "executable" + # FIXME: "./" is to cope with "." not being in $PATH. + # Should this be handled elsewhere? + # YES. + set output_file "./a.out" + # This is the only place where we care if an executable was + # created or not. If it was, dg.exp will try to run it. + remote_file build delete $output_file; + } + default { + perror "$do_what: not a valid dg-do keyword" + return "" + } + } + set options "" + if { $extra_tool_flags != "" } { + lappend options "additional_flags=$extra_tool_flags" + } + + set comp_output [g++_target_compile "$prog" "$output_file" "$compile_type" $options]; + + return [list $comp_output $output_file] +} + + +proc g++-dg-prune { system text } { + + # If we see "region xxx is full" then the testcase is too big for ram. + # This is tricky to deal with in a large testsuite like c-torture so + # deal with it here. Just mark the testcase as unsupported. + if [regexp "(^|\n)\[^\n\]*: region \[^\n\]* is full" $text] { + # The format here is important. See dg.exp. + return "::unsupported::memory full" + } + + return $text +} |