OSDN Git Service

(c_sizeof, build_c_cast): Set TREE_OVERFLOW in addition
[pf3gnuchains/gcc-fork.git] / gcc / toplev.c
index 655aa80..05fef4d 100644 (file)
@@ -1,5 +1,5 @@
 /* Top level of GNU C compiler
-   Copyright (C) 1987, 1988, 1989, 1992 Free Software Foundation, Inc.
+   Copyright (C) 1987, 1988, 1989, 1992, 1993 Free Software Foundation, Inc.
 
 This file is part of GNU CC.
 
@@ -52,6 +52,7 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
 #include "rtl.h"
 #include "flags.h"
 #include "insn-attr.h"
+#include "defaults.h"
 
 #ifdef XCOFF_DEBUGGING_INFO
 #include "xcoffout.h"
@@ -218,6 +219,11 @@ char *(*decl_printable_name) ();
 
 struct rtx_def *(*lang_expand_expr) ();
 
+/* Pointer to function to finish handling an incomplete decl at the
+   end of compilation.  */
+
+void (*incomplete_decl_finalize_hook) () = 0;
+
 /* Nonzero if generating code to do profiling.  */
 
 int profile_flag = 0;
@@ -266,9 +272,18 @@ int flag_caller_saves = 1;
 int flag_caller_saves = 0;
 #endif
 
+/* Nonzero if structures and unions should be returned in memory.
+
+   This should only be defined if compatibility with another compiler or
+   with an ABI is needed, because it results in slower code.  */
+
+#ifndef DEFAULT_PCC_STRUCT_RETURN
+#define DEFAULT_PCC_STRUCT_RETURN 1
+#endif
+
 /* Nonzero for -fpcc-struct-return: return values the same way PCC does.  */
 
-int flag_pcc_struct_return = 0;
+int flag_pcc_struct_return = DEFAULT_PCC_STRUCT_RETURN;
 
 /* Nonzero for -fforce-mem: load memory value into a register
    before arithmetic on it.  This makes better cse but slower compilation.  */
@@ -283,7 +298,7 @@ int flag_force_addr = 0;
 /* Nonzero for -fdefer-pop: don't pop args after each function call;
    instead save them up to pop many calls' args with one insns.  */
 
-int flag_defer_pop = 1;
+int flag_defer_pop = 0;
 
 /* Nonzero for -ffloat-store: don't allocate floats and doubles
    in extended-precision registers.  */
@@ -355,6 +370,10 @@ int flag_fast_math = 0;
 
 int flag_volatile;
 
+/* Nonzero means treat all global and extern variables as global.  */
+
+int flag_volatile_global;
+
 /* Nonzero means just do syntax checking; don't output anything.  */
 
 int flag_syntax_only = 0;
@@ -461,6 +480,7 @@ struct { char *string; int *variable; int on_value;} f_options[] =
 {
   {"float-store", &flag_float_store, 1},
   {"volatile", &flag_volatile, 1},
+  {"volatile-global", &flag_volatile_global, 1},
   {"defer-pop", &flag_defer_pop, 1},
   {"omit-frame-pointer", &flag_omit_frame_pointer, 1},
   {"cse-follow-jumps", &flag_cse_follow_jumps, 1},
@@ -482,6 +502,7 @@ struct { char *string; int *variable; int on_value;} f_options[] =
   {"shared-data", &flag_shared_data, 1},
   {"caller-saves", &flag_caller_saves, 1},
   {"pcc-struct-return", &flag_pcc_struct_return, 1},
+  {"reg-struct-return", &flag_pcc_struct_return, 0},
   {"delayed-branch", &flag_delayed_branch, 1},
   {"rerun-cse-after-loop", &flag_rerun_cse_after_loop, 1},
   {"pretend-float", &flag_pretend_float, 1},
@@ -524,6 +545,8 @@ char *lang_options[] =
   "-fno-builtin",
   "-fno-ident",
   "-fident",
+  "-fdollars-in-identifiers",
+  "-fnodollars-in-identifiers",
   "-ansi",
   "-Wimplicit",
   "-Wno-implicit",
@@ -559,6 +582,8 @@ char *lang_options[] =
   "-Wno-trigraphs",
   "-Wimport",
   "-Wno-import",
+  "-Wmissing-braces",
+  "-Wno-missing-braces",
   "-Wall",
 
   /* These are for C++.  */
@@ -567,8 +592,6 @@ char *lang_options[] =
   "-+e2",
   "-fsave-memoized",
   "-fno-save-memoized",
-  "-fSOS",
-  "-fno-SOS",
   "-fcadillac",
   "-fno-cadillac",
   "-fgc",
@@ -605,6 +628,10 @@ char *lang_options[] =
   "-fno-xref",
   "-fnonnull-objects",
   "-fno-nonnull-objects",
+  "-fimplement-inlines",
+  "-fno-implement-inlines",
+  "-fexternal-templates",
+  "-fno-external-templates",
 
   "-Wreturn-type",
   "-Wno-return-type",
@@ -614,12 +641,20 @@ char *lang_options[] =
   "-Wno-enum-clash",
   "-Wtemplate-debugging",
   "-Wno-template-debugging",
+  "-Wctor-dtor-privacy",
+  "-Wno-ctor-dtor-privacy",
 
   /* these are for obj c */
   "-lang-objc",
   "-gen-decls",
+  "-fgnu-runtime",
+  "-fno-gnu-runtime",
+  "-fnext-runtime",
+  "-fno-next-runtime",
   "-Wselector",
   "-Wno-selector",
+  "-Wprotocol",
+  "-Wno-protocol",
   0
 };
 \f
@@ -973,7 +1008,7 @@ report_error_function (file)
        {
          fprintf (stderr, " from %s:%d", p->name, p->line);
          if (p->next)
-           fprintf (stderr, ",");
+           fprintf (stderr, ",\n                ");
        }
       fprintf (stderr, ":\n");
       last_error_tick = input_file_stack_tick;
@@ -1446,6 +1481,8 @@ strip_off_ending (name, len)
     name[len - 2] = 0;
   else if (len > 4 && ! strcmp (".ada", name + len - 4))
     name[len - 4] = 0;
+  else if (len > 4 && ! strcmp (".atr", name + len - 4))
+    name[len - 4] = 0;
 }
 
 /* Output a file name in the form wanted by System V.  */
@@ -1477,6 +1514,17 @@ output_file_directive (asm_file, input_name)
 #endif
 }
 \f
+/* Routine to build language identifier for object file. */
+static void
+output_lang_identify (asm_out_file)
+     FILE *asm_out_file;
+{
+  int len = strlen (lang_identify ()) + sizeof ("__gnu_compiled_") + 1;
+  char *s = (char *) alloca (len);
+  sprintf (s, "__gnu_compiled_%s", lang_identify ());
+  ASM_OUTPUT_LABEL (asm_out_file, s);
+}
+
 /* Compile an entire file of output from cpp, named NAME.
    Write a file of assembly output and various debugging dumps.  */
 
@@ -1771,6 +1819,22 @@ compile_file (name)
 #else
   ASM_IDENTIFY_GCC (asm_out_file);
 #endif
+
+  /* Output something to identify which front-end produced this file. */
+#ifdef ASM_IDENTIFY_LANGUAGE
+  ASM_IDENTIFY_LANGUAGE (asm_out_file);
+#endif
+
+/* ??? Note: There used to be a conditional here
+   to call assemble_zeros without fail if DBX_DEBUGGING_INFO is defined.
+   This was to guarantee separation between gcc_compiled. and
+   the first function, for the sake of dbx on Suns.
+   However, having the extra zero here confused the Emacs
+   code for unexec, and might confuse other programs too.
+   Therefore, I took out that change.
+   In future versions we should find another way to solve
+   that dbx problem.  -- rms, 23 May 93.  */
+
   /* Don't let the first function fall at the same address
      as gcc_compiled., if profiling.  */
   if (profile_flag || profile_block_flag)
@@ -1835,6 +1899,10 @@ compile_file (name)
     for (i = 0; i < len; i++)
       {
        decl = vec[i];
+       if (TREE_CODE (decl) == VAR_DECL && DECL_SIZE (decl) == 0
+           && incomplete_decl_finalize_hook != 0)
+         (*incomplete_decl_finalize_hook) (decl);
+
        if (TREE_CODE (decl) == VAR_DECL && TREE_STATIC (decl)
            && ! TREE_ASM_WRITTEN (decl))
          {
@@ -1862,7 +1930,11 @@ compile_file (name)
            && (TREE_ADDRESSABLE (decl)
                || TREE_ADDRESSABLE (DECL_ASSEMBLER_NAME (decl)))
            && ! DECL_EXTERNAL (decl))
-         output_inline_function (decl);
+         {
+           temporary_allocation ();
+           output_inline_function (decl);
+           permanent_allocation ();
+         }
 
        /* Warn about any function
           declared static but not defined.
@@ -1876,7 +1948,18 @@ compile_file (name)
            && DECL_INITIAL (decl) == 0
            && DECL_EXTERNAL (decl)
            && ! TREE_PUBLIC (decl))
-         warning_with_decl (decl, "`%s' declared `static' but never defined");
+         {
+           /* This should be a pedwarn, except that there is
+              no easy way to prevent it from happening when the
+              name is used only inside a sizeof.
+              This at least avoids being incorrect.  */
+           warning_with_decl (decl, 
+                              "`%s' declared `static' but never defined");
+           /* This symbol is effectively an "extern" declaration now.  */
+           TREE_PUBLIC (decl) = 1;
+           assemble_external (decl);
+
+         }
        /* Warn about static fns or vars defined but not used,
           but not about inline functions
           since unused inline statics is normal practice.  */
@@ -1888,6 +1971,7 @@ compile_file (name)
            && ! TREE_PUBLIC (decl)
            && ! TREE_USED (decl)
            && ! DECL_INLINE (decl)
+           && ! DECL_REGISTER (decl)
            /* The TREE_USED bit for file-scope decls
               is kept in the identifier, to handle multiple
               external decls in different scopes.  */
@@ -2772,7 +2856,9 @@ main (argc, argv, envp)
 
   signal (SIGFPE, float_signal);
 
+#ifdef SIGPIPE
   signal (SIGPIPE, pipe_closed);
+#endif
 
   decl_printable_name = decl_name;
   lang_expand_expr = (struct rtx_def *(*)()) do_abort;
@@ -2815,6 +2901,7 @@ main (argc, argv, envp)
 
   if (optimize >= 1)
     {
+      flag_defer_pop = 1;
       flag_thread_jumps = 1;
 #ifdef DELAY_SLOTS
       flag_delayed_branch = 1;
@@ -3238,6 +3325,15 @@ You Lose!  You must define PREFERRED_DEBUGGING_TYPE!
        warning ("-Wuninitialized is not supported without -O");
     }
 
+#if defined(DWARF_DEBUGGING_INFO)
+  if (write_symbols == DWARF_DEBUG
+      && strcmp (language_string, "GNU C++") == 0)
+    {
+      warning ("-g option not supported for C++ on SVR4 systems");
+      write_symbols = NO_DEBUG;
+    }
+#endif /* defined(DWARF_DEBUGGING_INFO) */
+
 #ifdef OVERRIDE_OPTIONS
   /* Some machines may reject certain combinations of options.  */
   OVERRIDE_OPTIONS;