Deleted Added
full compact
decl.c (260075) decl.c (260140)
1/* Process declarations and variables for C++ compiler.
2 Copyright (C) 1988, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
3 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
4 Contributed by Michael Tiemann (tiemann@cygnus.com)
5
6This file is part of GCC.
7
8GCC is free software; you can redistribute it and/or modify

--- 744 unchanged lines hidden (view full) ---

753 BIND_EXPR for the block, and insert it into the stream. */
754 stmt = pop_stmt_list (current_binding_level->statement_list);
755 stmt = c_build_bind_expr (block, stmt);
756 add_stmt (stmt);
757 }
758
759 leave_scope ();
760 if (functionbody)
1/* Process declarations and variables for C++ compiler.
2 Copyright (C) 1988, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
3 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
4 Contributed by Michael Tiemann (tiemann@cygnus.com)
5
6This file is part of GCC.
7
8GCC is free software; you can redistribute it and/or modify

--- 744 unchanged lines hidden (view full) ---

753 BIND_EXPR for the block, and insert it into the stream. */
754 stmt = pop_stmt_list (current_binding_level->statement_list);
755 stmt = c_build_bind_expr (block, stmt);
756 add_stmt (stmt);
757 }
758
759 leave_scope ();
760 if (functionbody)
761 DECL_INITIAL (current_function_decl) = block;
761 {
762 /* The current function is being defined, so its DECL_INITIAL
763 should be error_mark_node. */
764 gcc_assert (DECL_INITIAL (current_function_decl) == error_mark_node);
765 DECL_INITIAL (current_function_decl) = block;
766 }
762 else if (block)
763 current_binding_level->blocks
764 = chainon (current_binding_level->blocks, block);
765
766 /* If we did not make a block for the level just exited,
767 any blocks made for inner levels
768 (since they cannot be recorded as subblocks in that level)
769 must be carried forward so they will later become subblocks

--- 860 unchanged lines hidden (view full) ---

1630 DECL_INLINE (old_result)
1631 |= DECL_INLINE (new_result);
1632 DECL_DECLARED_INLINE_P (old_result)
1633 |= DECL_DECLARED_INLINE_P (new_result);
1634 check_redeclaration_exception_specification (newdecl, olddecl);
1635 }
1636
1637 /* If the new declaration is a definition, update the file and
767 else if (block)
768 current_binding_level->blocks
769 = chainon (current_binding_level->blocks, block);
770
771 /* If we did not make a block for the level just exited,
772 any blocks made for inner levels
773 (since they cannot be recorded as subblocks in that level)
774 must be carried forward so they will later become subblocks

--- 860 unchanged lines hidden (view full) ---

1635 DECL_INLINE (old_result)
1636 |= DECL_INLINE (new_result);
1637 DECL_DECLARED_INLINE_P (old_result)
1638 |= DECL_DECLARED_INLINE_P (new_result);
1639 check_redeclaration_exception_specification (newdecl, olddecl);
1640 }
1641
1642 /* If the new declaration is a definition, update the file and
1638 line information on the declaration. */
1643 line information on the declaration, and also make
1644 the old declaration the same definition. */
1639 if (DECL_INITIAL (old_result) == NULL_TREE
1640 && DECL_INITIAL (new_result) != NULL_TREE)
1641 {
1642 DECL_SOURCE_LOCATION (olddecl)
1643 = DECL_SOURCE_LOCATION (old_result)
1644 = DECL_SOURCE_LOCATION (newdecl);
1645 if (DECL_INITIAL (old_result) == NULL_TREE
1646 && DECL_INITIAL (new_result) != NULL_TREE)
1647 {
1648 DECL_SOURCE_LOCATION (olddecl)
1649 = DECL_SOURCE_LOCATION (old_result)
1650 = DECL_SOURCE_LOCATION (newdecl);
1651 DECL_INITIAL (old_result) = DECL_INITIAL (new_result);
1645 if (DECL_FUNCTION_TEMPLATE_P (newdecl))
1646 DECL_ARGUMENTS (old_result)
1647 = DECL_ARGUMENTS (new_result);
1648 }
1649
1650 return olddecl;
1651 }
1652

--- 8851 unchanged lines hidden (view full) ---

10504 indicating that the function is an inline defined in-class.
10505
10506 This function creates a binding context for the function body
10507 as well as setting up the FUNCTION_DECL in current_function_decl.
10508
10509 For C++, we must first check whether that datum makes any sense.
10510 For example, "class A local_a(1,2);" means that variable local_a
10511 is an aggregate of type A, which should have a constructor
1652 if (DECL_FUNCTION_TEMPLATE_P (newdecl))
1653 DECL_ARGUMENTS (old_result)
1654 = DECL_ARGUMENTS (new_result);
1655 }
1656
1657 return olddecl;
1658 }
1659

--- 8851 unchanged lines hidden (view full) ---

10511 indicating that the function is an inline defined in-class.
10512
10513 This function creates a binding context for the function body
10514 as well as setting up the FUNCTION_DECL in current_function_decl.
10515
10516 For C++, we must first check whether that datum makes any sense.
10517 For example, "class A local_a(1,2);" means that variable local_a
10518 is an aggregate of type A, which should have a constructor
10512 applied to it with the argument list [1, 2]. */
10519 applied to it with the argument list [1, 2].
10513
10520
10521 On entry, DECL_INITIAL (decl1) should be NULL_TREE or error_mark_node,
10522 or may be a BLOCK if the function has been defined previously
10523 in this translation unit. On exit, DECL_INITIAL (decl1) will be
10524 error_mark_node if the function has never been defined, or
10525 a BLOCK if the function has been defined somewhere. */
10526
10514void
10515start_preparsed_function (tree decl1, tree attrs, int flags)
10516{
10517 tree ctype = NULL_TREE;
10518 tree fntype;
10519 tree restype;
10520 int doing_friend = 0;
10521 struct cp_binding_level *bl;

--- 111 unchanged lines hidden (view full) ---

10633 resdecl = build_decl (RESULT_DECL, 0, TYPE_MAIN_VARIANT (restype));
10634 DECL_ARTIFICIAL (resdecl) = 1;
10635 DECL_IGNORED_P (resdecl) = 1;
10636 DECL_RESULT (decl1) = resdecl;
10637
10638 cp_apply_type_quals_to_decl (cp_type_quals (restype), resdecl);
10639 }
10640
10527void
10528start_preparsed_function (tree decl1, tree attrs, int flags)
10529{
10530 tree ctype = NULL_TREE;
10531 tree fntype;
10532 tree restype;
10533 int doing_friend = 0;
10534 struct cp_binding_level *bl;

--- 111 unchanged lines hidden (view full) ---

10646 resdecl = build_decl (RESULT_DECL, 0, TYPE_MAIN_VARIANT (restype));
10647 DECL_ARTIFICIAL (resdecl) = 1;
10648 DECL_IGNORED_P (resdecl) = 1;
10649 DECL_RESULT (decl1) = resdecl;
10650
10651 cp_apply_type_quals_to_decl (cp_type_quals (restype), resdecl);
10652 }
10653
10641 /* Initialize RTL machinery. We cannot do this until
10642 CURRENT_FUNCTION_DECL and DECL_RESULT are set up. We do this
10643 even when processing a template; this is how we get
10644 CFUN set up, and our per-function variables initialized.
10645 FIXME factor out the non-RTL stuff. */
10646 bl = current_binding_level;
10647 allocate_struct_function (decl1);
10648 current_binding_level = bl;
10649
10650 /* Even though we're inside a function body, we still don't want to
10651 call expand_expr to calculate the size of a variable-sized array.
10652 We haven't necessarily assigned RTL to all variables yet, so it's
10653 not safe to try to expand expressions involving them. */
10654 cfun->x_dont_save_pending_sizes_p = 1;
10655
10656 /* Start the statement-tree, start the tree now. */
10657 DECL_SAVED_TREE (decl1) = push_stmt_list ();
10658
10659 /* Let the user know we're compiling this function. */
10660 announce_function (decl1);
10661
10662 /* Record the decl so that the function name is defined.
10663 If we already have a decl for this name, and it is a FUNCTION_DECL,
10664 use the old decl. */
10665 if (!processing_template_decl && !(flags & SF_PRE_PARSED))
10666 {

--- 29 unchanged lines hidden (view full) ---

10696 apply the pragma until after we have merged this declaration
10697 with any previous declarations; if the original declaration
10698 has a linkage specification, that specification applies to
10699 the definition as well, and may affect the mangled name. */
10700 if (!DECL_CONTEXT (decl1))
10701 maybe_apply_pragma_weak (decl1);
10702 }
10703
10654 /* Let the user know we're compiling this function. */
10655 announce_function (decl1);
10656
10657 /* Record the decl so that the function name is defined.
10658 If we already have a decl for this name, and it is a FUNCTION_DECL,
10659 use the old decl. */
10660 if (!processing_template_decl && !(flags & SF_PRE_PARSED))
10661 {

--- 29 unchanged lines hidden (view full) ---

10691 apply the pragma until after we have merged this declaration
10692 with any previous declarations; if the original declaration
10693 has a linkage specification, that specification applies to
10694 the definition as well, and may affect the mangled name. */
10695 if (!DECL_CONTEXT (decl1))
10696 maybe_apply_pragma_weak (decl1);
10697 }
10698
10704 /* Reset these in case the call to pushdecl changed them. */
10699 /* Reset this in case the call to pushdecl changed it. */
10705 current_function_decl = decl1;
10700 current_function_decl = decl1;
10706 cfun->decl = decl1;
10707
10701
10702 gcc_assert (DECL_INITIAL (decl1));
10703
10704 /* This function may already have been parsed, in which case just
10705 return; our caller will skip over the body without parsing. */
10706 if (DECL_INITIAL (decl1) != error_mark_node)
10707 return;
10708
10709 /* Initialize RTL machinery. We cannot do this until
10710 CURRENT_FUNCTION_DECL and DECL_RESULT are set up. We do this
10711 even when processing a template; this is how we get
10712 CFUN set up, and our per-function variables initialized.
10713 FIXME factor out the non-RTL stuff. */
10714 bl = current_binding_level;
10715 allocate_struct_function (decl1);
10716 current_binding_level = bl;
10717
10718 /* Even though we're inside a function body, we still don't want to
10719 call expand_expr to calculate the size of a variable-sized array.
10720 We haven't necessarily assigned RTL to all variables yet, so it's
10721 not safe to try to expand expressions involving them. */
10722 cfun->x_dont_save_pending_sizes_p = 1;
10723
10724 /* Start the statement-tree, start the tree now. */
10725 DECL_SAVED_TREE (decl1) = push_stmt_list ();
10726
10708 /* If we are (erroneously) defining a function that we have already
10709 defined before, wipe out what we knew before. */
10710 if (!DECL_PENDING_INLINE_P (decl1))
10711 DECL_SAVED_FUNCTION_DATA (decl1) = NULL;
10712
10713 if (ctype && !doing_friend && !DECL_STATIC_FUNCTION_P (decl1))
10714 {
10715 /* We know that this was set up by `grokclassfn'. We do not

--- 491 unchanged lines hidden (view full) ---

11207 nested = function_depth > 1;
11208 fntype = TREE_TYPE (fndecl);
11209
11210 /* TREE_READONLY (fndecl) = 1;
11211 This caused &foo to be of type ptr-to-const-function
11212 which then got a warning when stored in a ptr-to-function variable. */
11213
11214 gcc_assert (building_stmt_tree ());
10727 /* If we are (erroneously) defining a function that we have already
10728 defined before, wipe out what we knew before. */
10729 if (!DECL_PENDING_INLINE_P (decl1))
10730 DECL_SAVED_FUNCTION_DATA (decl1) = NULL;
10731
10732 if (ctype && !doing_friend && !DECL_STATIC_FUNCTION_P (decl1))
10733 {
10734 /* We know that this was set up by `grokclassfn'. We do not

--- 491 unchanged lines hidden (view full) ---

11226 nested = function_depth > 1;
11227 fntype = TREE_TYPE (fndecl);
11228
11229 /* TREE_READONLY (fndecl) = 1;
11230 This caused &foo to be of type ptr-to-const-function
11231 which then got a warning when stored in a ptr-to-function variable. */
11232
11233 gcc_assert (building_stmt_tree ());
11234 /* The current function is being defined, so its DECL_INITIAL should
11235 be set, and unless there's a multiple definition, it should be
11236 error_mark_node. */
11237 gcc_assert (DECL_INITIAL (fndecl) == error_mark_node);
11215
11216 /* For a cloned function, we've already got all the code we need;
11217 there's no need to add any extra bits. */
11218 if (!DECL_CLONED_FUNCTION_P (fndecl))
11219 {
11220 if (DECL_MAIN_P (current_function_decl))
11221 {
11222 tree stmt;

--- 553 unchanged lines hidden ---
11238
11239 /* For a cloned function, we've already got all the code we need;
11240 there's no need to add any extra bits. */
11241 if (!DECL_CLONED_FUNCTION_P (fndecl))
11242 {
11243 if (DECL_MAIN_P (current_function_decl))
11244 {
11245 tree stmt;

--- 553 unchanged lines hidden ---