summaryrefslogtreecommitdiff
path: root/gcc/c-common.c
diff options
context:
space:
mode:
authorjsm28 <jsm28@138bc75d-0d04-0410-961f-82ee72b054a4>2001-07-13 20:40:43 +0000
committerjsm28 <jsm28@138bc75d-0d04-0410-961f-82ee72b054a4>2001-07-13 20:40:43 +0000
commit9581e01c5a90b689f5d6af5378b5c1c7305b1688 (patch)
tree7344925821f5f63d7da1217406a45dd134918cfd /gcc/c-common.c
parentcb3d02c0ed928b1c1a98a7df49274835eb4e6133 (diff)
downloadgcc-9581e01c5a90b689f5d6af5378b5c1c7305b1688.tar.gz
* c-common.c (decl_attributes): Take a pointer to the node to
which attributes are to be attached, and a flags argument. * c-common.h (enum attribute_flags): New. (decl_attributes): Update prototype. * c-decl.c (start_decl, push_parm_decl, finish_struct, finish_enum, start_function): Update calls to decl_attributes. * c-parse.in (component_declarator, component_notype_declarator, label): Update calls to decl_attributes. cp: * decl2.c (cplus_decl_attributes): Take a pointer to the node to which attributes are to be attached, and a flags argument. Update call to decl_attributes. (grokfield): Update call to decl_attributes. * class.c (finish_struct): Update call to cplus_decl_attributes. * cp-tree.h (cplus_decl_attributes): Update prototype. * decl.c (start_decl, grokdeclarator, start_function): Update calls to decl_attributes and cplus_decl_attributes. * friend.c (do_friend): Update call to cplus_decl_attributes. * parse.y (parse_bitfield): Update call to cplus_decl_attributes. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@43995 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/c-common.c')
-rw-r--r--gcc/c-common.c36
1 files changed, 22 insertions, 14 deletions
diff --git a/gcc/c-common.c b/gcc/c-common.c
index 0213843be9e..751ba267c98 100644
--- a/gcc/c-common.c
+++ b/gcc/c-common.c
@@ -723,12 +723,19 @@ default_valid_lang_attribute (attr_name, attr_args, decl, type)
int (*valid_lang_attribute) PARAMS ((tree, tree, tree, tree))
= default_valid_lang_attribute;
-/* Process the attributes listed in ATTRIBUTES and install them in NODE,
- which is either a DECL (including a TYPE_DECL) or a TYPE. */
+/* Process the attributes listed in ATTRIBUTES and install them in *NODE,
+ which is either a DECL (including a TYPE_DECL) or a TYPE. If a DECL,
+ it should be modified in place; if a TYPE, a copy should be created.
+ FLAGS gives further information, in the form of a bitwise OR of flags
+ in enum attribute_flags from c-common.h. Depending on these flags,
+ some attributes may be returned to be applied at a later stage (for
+ example, to apply a decl attribute to the declaration rather than to
+ its type). */
-void
-decl_attributes (node, attributes)
- tree node, attributes;
+tree
+decl_attributes (node, attributes, flags)
+ tree *node, attributes;
+ int flags ATTRIBUTE_UNUSED;
{
tree decl = 0, type = 0;
int is_type = 0;
@@ -737,16 +744,16 @@ decl_attributes (node, attributes)
if (attrtab_idx == 0)
init_attributes ();
- if (DECL_P (node))
+ if (DECL_P (*node))
{
- decl = node;
+ decl = *node;
type = TREE_TYPE (decl);
- is_type = TREE_CODE (node) == TYPE_DECL;
+ is_type = TREE_CODE (*node) == TYPE_DECL;
}
- else if (TYPE_P (node))
- type = node, is_type = 1;
+ else if (TYPE_P (*node))
+ type = *node, is_type = 1;
- (*targetm.insert_attributes) (node, &attributes);
+ (*targetm.insert_attributes) (*node, &attributes);
for (a = attributes; a; a = TREE_CHAIN (a))
{
@@ -979,16 +986,16 @@ decl_attributes (node, attributes)
else if (DECL_SECTION_NAME (decl) != NULL_TREE
&& strcmp (TREE_STRING_POINTER (DECL_SECTION_NAME (decl)),
TREE_STRING_POINTER (TREE_VALUE (args))) != 0)
- error_with_decl (node,
+ error_with_decl (*node,
"section of `%s' conflicts with previous declaration");
else
DECL_SECTION_NAME (decl) = TREE_VALUE (args);
}
else
- error_with_decl (node,
+ error_with_decl (*node,
"section attribute not allowed for `%s'");
#else
- error_with_decl (node,
+ error_with_decl (*node,
"section attributes are not supported for this target");
#endif
break;
@@ -1140,6 +1147,7 @@ decl_attributes (node, attributes)
break;
}
}
+ return NULL_TREE;
}
/* Split SPECS_ATTRS, a list of declspecs and prefix attributes, into two