aboutsummaryrefslogtreecommitdiff
path: root/gcc/c-decl.c
diff options
context:
space:
mode:
authorJoseph Myers <jsm@polyomino.org.uk>2004-08-21 23:49:46 +0100
committerJoseph Myers <jsm28@gcc.gnu.org>2004-08-21 23:49:46 +0100
commit00325bce05275038af47ee3aa48800720817b686 (patch)
tree0bc86a46dabfe5f3217a90c3285ceb99d445d1c3 /gcc/c-decl.c
parent60919bce329ac4f5f398f9e9343ac12b859fdab9 (diff)
downloadgcc-00325bce05275038af47ee3aa48800720817b686.zip
gcc-00325bce05275038af47ee3aa48800720817b686.tar.gz
gcc-00325bce05275038af47ee3aa48800720817b686.tar.bz2
c-decl.c (set_array_declarator_type): Rename to set_array_declarator_inner.
* c-decl.c (set_array_declarator_type): Rename to set_array_declarator_inner. (build_c_parm, build_attrs_declarator, build_function_declarator): New functions. (make_pointer_declarator): Call build_attrs_declarator. * c-tree.h (set_array_declarator_type): Rename to set_array_declarator_inner. (build_c_parm, build_attrs_declarator, build_function_declarator): New prototypes. * c-parse.in (after_type_declarator, parm_declarator_starttypename, parm_declarator_nostarttypename, notype_declarator, absdcl_maybe_attribute, direct_absdcl1, parm, firstparm): Use these functions From-SVN: r86367
Diffstat (limited to 'gcc/c-decl.c')
-rw-r--r--gcc/c-decl.c34
1 files changed, 31 insertions, 3 deletions
diff --git a/gcc/c-decl.c b/gcc/c-decl.c
index 28f265e..9220194 100644
--- a/gcc/c-decl.c
+++ b/gcc/c-decl.c
@@ -2629,7 +2629,7 @@ shadow_tag_warned (tree declspecs, int warned)
nevertheless a complete type (not currently implemented by GCC),
false otherwise. The declarator is constructed as an ARRAY_REF
(to be decoded by grokdeclarator), whose operand 0 is what's on the
- left of the [] (filled by in set_array_declarator_type) and operand 1
+ left of the [] (filled by in set_array_declarator_inner) and operand 1
is the expression inside; whose TREE_TYPE is the type qualifiers and
which has TREE_STATIC set if "static" is used. */
@@ -2661,7 +2661,7 @@ build_array_declarator (tree expr, tree quals, bool static_p,
C99 grammar. */
tree
-set_array_declarator_type (tree decl, tree type, bool abstract_p)
+set_array_declarator_inner (tree decl, tree type, bool abstract_p)
{
TREE_OPERAND (decl, 0) = type;
if (abstract_p && (TREE_TYPE (decl) != NULL_TREE || TREE_STATIC (decl)))
@@ -6640,6 +6640,34 @@ build_void_list_node (void)
return t;
}
+/* Return a structure for a parameter with the given SPECS, ATTRS and
+ DECLARATOR. */
+
+tree
+build_c_parm (tree specs, tree attrs, tree declarator)
+{
+ return build_tree_list (build_tree_list (specs, declarator), attrs);
+}
+
+/* Return a declarator with nested attributes. TARGET is the inner
+ declarator to which these attributes apply. ATTRS are the
+ attributes. */
+
+tree
+build_attrs_declarator (tree attrs, tree target)
+{
+ return tree_cons (attrs, target, NULL_TREE);
+}
+
+/* Return a declarator for a function with arguments specified by ARGS
+ and return type specified by TARGET. */
+
+tree
+build_function_declarator (tree args, tree target)
+{
+ return build_nt (CALL_EXPR, target, args, NULL_TREE);
+}
+
/* Return something to represent absolute declarators containing a *.
TARGET is the absolute declarator that the * contains.
TYPE_QUALS_ATTRS is a list of modifiers such as const or volatile
@@ -6656,7 +6684,7 @@ make_pointer_declarator (tree type_quals_attrs, tree target)
tree itarget = target;
split_specs_attrs (type_quals_attrs, &quals, &attrs);
if (attrs != NULL_TREE)
- itarget = tree_cons (attrs, target, NULL_TREE);
+ itarget = build_attrs_declarator (attrs, target);
return build1 (INDIRECT_REF, quals, itarget);
}