OSDN Git Service

gcc/cp/
[pf3gnuchains/gcc-fork.git] / gcc / c-decl.c
index 4e9564d..89fdf3d 100644 (file)
@@ -931,16 +931,6 @@ pop_file_scope (void)
   cgraph_finalize_compilation_unit ();
 }
 
-/* Insert BLOCK at the end of the list of subblocks of the current
-   scope.  This is used when a BIND_EXPR is expanded, to handle the
-   BLOCK node inside the BIND_EXPR.  */
-
-void
-insert_block (tree block)
-{
-  TREE_USED (block) = 1;
-  SCOPE_LIST_APPEND (current_scope, blocks, block);
-}
 \f
 /* Push a definition or a declaration of struct, union or enum tag "name".
    "type" should be the type node.
@@ -1667,7 +1657,7 @@ merge_decls (tree newdecl, tree olddecl, tree newtype, tree oldtype)
       if (DECL_ALIGN (olddecl) > DECL_ALIGN (newdecl))
        {
          DECL_ALIGN (newdecl) = DECL_ALIGN (olddecl);
-         DECL_USER_ALIGN (newdecl) |= DECL_ALIGN (olddecl);
+         DECL_USER_ALIGN (newdecl) |= DECL_USER_ALIGN (olddecl);
        }
     }
 
@@ -1739,10 +1729,10 @@ merge_decls (tree newdecl, tree olddecl, tree newtype, tree oldtype)
          DECL_NO_INSTRUMENT_FUNCTION_ENTRY_EXIT (newdecl)
            |= DECL_NO_INSTRUMENT_FUNCTION_ENTRY_EXIT (olddecl);
          TREE_THIS_VOLATILE (newdecl) |= TREE_THIS_VOLATILE (olddecl);
-         TREE_READONLY (newdecl) |= TREE_READONLY (olddecl);
          DECL_IS_MALLOC (newdecl) |= DECL_IS_MALLOC (olddecl);
          DECL_IS_OPERATOR_NEW (newdecl) |= DECL_IS_OPERATOR_NEW (olddecl);
-         DECL_IS_PURE (newdecl) |= DECL_IS_PURE (olddecl);
+         TREE_READONLY (newdecl) |= TREE_READONLY (olddecl);
+         DECL_PURE_P (newdecl) |= DECL_PURE_P (olddecl);
          DECL_IS_NOVOPS (newdecl) |= DECL_IS_NOVOPS (olddecl);
        }
 
@@ -1773,7 +1763,9 @@ merge_decls (tree newdecl, tree olddecl, tree newtype, tree oldtype)
          || !DECL_DECLARED_INLINE_P (olddecl)
          || !DECL_EXTERNAL (olddecl))
       && DECL_EXTERNAL (newdecl)
-      && !lookup_attribute ("gnu_inline", DECL_ATTRIBUTES (newdecl)))
+      && !lookup_attribute ("gnu_inline", DECL_ATTRIBUTES (newdecl))
+      && (DECL_CONTEXT (newdecl) == NULL_TREE
+         || TREE_CODE (DECL_CONTEXT (newdecl)) != FUNCTION_DECL))
     DECL_EXTERNAL (newdecl) = 0;
 
   if (DECL_EXTERNAL (newdecl))
@@ -2760,12 +2752,7 @@ c_init_decl_processing (void)
   /* Declarations from c_common_nodes_and_builtins must not be associated
      with this input file, lest we get differences between using and not
      using preprocessed headers.  */
-#ifdef USE_MAPPED_LOCATION
   input_location = BUILTINS_LOCATION;
-#else
-  input_location.file = "<built-in>";
-  input_location.line = 0;
-#endif
 
   build_common_tree_nodes (flag_signed_char, false);
 
@@ -3279,7 +3266,8 @@ start_decl (struct c_declarator *declarator, struct c_declspecs *declspecs,
   if (declspecs->inline_p
       && !flag_gnu89_inline
       && TREE_CODE (decl) == FUNCTION_DECL
-      && lookup_attribute ("gnu_inline", DECL_ATTRIBUTES (decl)))
+      && (lookup_attribute ("gnu_inline", DECL_ATTRIBUTES (decl))
+         || current_function_decl))
     {
       if (declspecs->storage_class == csc_auto && current_scope != file_scope)
        ;
@@ -3496,7 +3484,10 @@ finish_decl (tree decl, tree init, tree asmspec_tree)
          if (TREE_CODE (DECL_SIZE (decl)) == INTEGER_CST)
            constant_expression_warning (DECL_SIZE (decl));
          else
-           error ("storage size of %q+D isn%'t constant", decl);
+           {
+             error ("storage size of %q+D isn%'t constant", decl);
+             TREE_TYPE (decl) = error_mark_node;
+           }
        }
 
       if (TREE_USED (type))
@@ -4080,7 +4071,7 @@ grokdeclarator (const struct c_declarator *declarator,
      declaration contains the `const'.  A third possibility is that
      there is a type qualifier on the element type of a typedefed
      array type, in which case we should extract that qualifier so
-     that c_apply_type_quals_to_decls receives the full list of
+     that c_apply_type_quals_to_decl receives the full list of
      qualifiers to work with (C90 is not entirely clear about whether
      duplicate qualifiers should be diagnosed in this case, but it
      seems most appropriate to do so).  */
@@ -6106,7 +6097,8 @@ start_function (struct c_declspecs *declspecs, struct c_declarator *declarator,
   if (declspecs->inline_p
       && !flag_gnu89_inline
       && TREE_CODE (decl1) == FUNCTION_DECL
-      && lookup_attribute ("gnu_inline", DECL_ATTRIBUTES (decl1)))
+      && (lookup_attribute ("gnu_inline", DECL_ATTRIBUTES (decl1))
+         || current_function_decl))
     {
       if (declspecs->storage_class != csc_static)
        DECL_EXTERNAL (decl1) = !DECL_EXTERNAL (decl1);
@@ -6488,8 +6480,10 @@ store_parm_decls_oldstyle (tree fndecl, const struct c_arg_info *arg_info)
          /* Type for passing arg must be consistent with that
             declared for the arg.  ISO C says we take the unqualified
             type for parameters declared with qualified type.  */
-         if (!comptypes (TYPE_MAIN_VARIANT (DECL_ARG_TYPE (parm)),
-                         TYPE_MAIN_VARIANT (TREE_VALUE (type))))
+         if (TREE_TYPE (parm) != error_mark_node
+             && TREE_TYPE (type) != error_mark_node
+             && !comptypes (TYPE_MAIN_VARIANT (DECL_ARG_TYPE (parm)),
+                            TYPE_MAIN_VARIANT (TREE_VALUE (type))))
            {
              if (TYPE_MAIN_VARIANT (TREE_TYPE (parm))
                  == TYPE_MAIN_VARIANT (TREE_VALUE (type)))
@@ -6647,7 +6641,7 @@ store_parm_decls (void)
      call expand_expr to calculate the size of a variable-sized array.
      We haven't necessarily assigned RTL to all variables yet, so it's
      not safe to try to expand expressions involving them.  */
-  cfun->x_dont_save_pending_sizes_p = 1;
+  cfun->dont_save_pending_sizes_p = 1;
 }
 \f
 /* Emit diagnostics that require gimple input for detection.  Operate on
@@ -6721,7 +6715,6 @@ finish_function (void)
          if (flag_isoc99)
            {
              tree stmt = c_finish_return (integer_zero_node);
-#ifdef USE_MAPPED_LOCATION
              /* Hack.  We don't want the middle-end to warn that this return
                 is unreachable, so we mark its location as special.  Using
                 UNKNOWN_LOCATION has the problem that it gets clobbered in
@@ -6729,12 +6722,6 @@ finish_function (void)
                 ensure ! should_carry_locus_p (stmt), but that needs a flag.
              */
              SET_EXPR_LOCATION (stmt, BUILTINS_LOCATION);
-#else
-             /* Hack.  We don't want the middle-end to warn that this
-                return is unreachable, so put the statement on the
-                special line 0.  */
-             annotate_with_file_line (stmt, input_filename, 0);
-#endif
            }
        }
     }
@@ -6896,11 +6883,11 @@ check_for_loop_decls (void)
    used during compilation of a C function.  */
 
 void
-c_push_function_context (struct function *f)
+c_push_function_context (void)
 {
   struct language_function *p;
   p = GGC_NEW (struct language_function);
-  f->language = p;
+  cfun->language = p;
 
   p->base.x_stmt_tree = c_stmt_tree;
   p->x_break_label = c_break_label;
@@ -6911,14 +6898,20 @@ c_push_function_context (struct function *f)
   p->returns_null = current_function_returns_null;
   p->returns_abnormally = current_function_returns_abnormally;
   p->warn_about_return_type = warn_about_return_type;
+
+  push_function_context ();
 }
 
 /* Restore the variables used during compilation of a C function.  */
 
 void
-c_pop_function_context (struct function *f)
+c_pop_function_context (void)
 {
-  struct language_function *p = f->language;
+  struct language_function *p;
+
+  pop_function_context ();
+  p = cfun->language;
+  cfun->language = NULL;
 
   if (DECL_STRUCT_FUNCTION (current_function_decl) == 0
       && DECL_SAVED_TREE (current_function_decl) == NULL_TREE)
@@ -6939,8 +6932,6 @@ c_pop_function_context (struct function *f)
   current_function_returns_null = p->returns_null;
   current_function_returns_abnormally = p->returns_abnormally;
   warn_about_return_type = p->warn_about_return_type;
-
-  f->language = NULL;
 }
 
 /* Copy the DECL_LANG_SPECIFIC data associated with DECL.  */