aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2002-02-04 11:28:40 -0500
committerJason Merrill <jason@gcc.gnu.org>2002-02-04 11:28:40 -0500
commite89a607588d6a34db572bb0277d65ec8334500ce (patch)
treeab16aa8a8162f23b1c774a65b1b2091e6a4919c5 /gcc
parent3335fcacb0f0e1dc4541ee56b206132fe4f3a21b (diff)
downloadgcc-e89a607588d6a34db572bb0277d65ec8334500ce.zip
gcc-e89a607588d6a34db572bb0277d65ec8334500ce.tar.gz
gcc-e89a607588d6a34db572bb0277d65ec8334500ce.tar.bz2
decl.c (start_function): Call cplus_decl_attributes immediately after grokdeclarator.
* decl.c (start_function): Call cplus_decl_attributes immediately after grokdeclarator. * decl.c (start_function): Combine DECL_RESULT handling code. From-SVN: r49480
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/ChangeLog7
-rw-r--r--gcc/cp/decl.c38
2 files changed, 19 insertions, 26 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 6787e88..6179739 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,10 @@
+2002-02-04 Jason Merrill <jason@redhat.com>
+
+ * decl.c (start_function): Call cplus_decl_attributes immediately
+ after grokdeclarator.
+
+ * decl.c (start_function): Combine DECL_RESULT handling code.
+
2002-02-03 Jason Merrill <jason@redhat.com>
* xref.c: Remove.
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index 4909985..c1c254d 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -13481,7 +13481,10 @@ start_function (declspecs, declarator, attrs, flags)
decl1 = grokdeclarator (declarator, declspecs, FUNCDEF, 1, NULL);
/* If the declarator is not suitable for a function definition,
cause a syntax error. */
- if (decl1 == NULL_TREE || TREE_CODE (decl1) != FUNCTION_DECL) return 0;
+ if (decl1 == NULL_TREE || TREE_CODE (decl1) != FUNCTION_DECL)
+ return 0;
+
+ cplus_decl_attributes (&decl1, attrs, 0);
fntype = TREE_TYPE (decl1);
@@ -13595,19 +13598,16 @@ start_function (declspecs, declarator, attrs, flags)
/* Build the return declaration for the function. */
restype = TREE_TYPE (fntype);
- if (!processing_template_decl)
+ /* Promote the value to int before returning it. */
+ if (c_promoting_integer_type_p (restype))
+ restype = type_promotes_to (restype);
+ if (DECL_RESULT (decl1) == NULL_TREE)
{
- if (!DECL_RESULT (decl1))
- {
- DECL_RESULT (decl1)
- = build_decl (RESULT_DECL, 0, TYPE_MAIN_VARIANT (restype));
- c_apply_type_quals_to_decl (cp_type_quals (restype),
- DECL_RESULT (decl1));
- }
+ DECL_RESULT (decl1)
+ = build_decl (RESULT_DECL, 0, TYPE_MAIN_VARIANT (restype));
+ c_apply_type_quals_to_decl (cp_type_quals (restype),
+ DECL_RESULT (decl1));
}
- else
- /* Just use `void'. Nobody will ever look at this anyhow. */
- DECL_RESULT (decl1) = build_decl (RESULT_DECL, 0, void_type_node);
/* Initialize RTL machinery. We cannot do this until
CURRENT_FUNCTION_DECL and DECL_RESULT are set up. We do this
@@ -13768,20 +13768,6 @@ start_function (declspecs, declarator, attrs, flags)
pushlevel (0);
current_binding_level->parm_flag = 1;
- cplus_decl_attributes (&decl1, attrs, 0);
-
- /* Promote the value to int before returning it. */
- if (c_promoting_integer_type_p (restype))
- restype = type_promotes_to (restype);
-
- if (DECL_RESULT (decl1) == NULL_TREE)
- {
- DECL_RESULT (decl1)
- = build_decl (RESULT_DECL, 0, TYPE_MAIN_VARIANT (restype));
- TREE_READONLY (DECL_RESULT (decl1)) = CP_TYPE_CONST_P (restype);
- TREE_THIS_VOLATILE (DECL_RESULT (decl1)) = CP_TYPE_VOLATILE_P (restype);
- }
-
++function_depth;
if (DECL_DESTRUCTOR_P (decl1))