aboutsummaryrefslogtreecommitdiff
path: root/gcc/c-family/c-attribs.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/c-family/c-attribs.c')
-rw-r--r--gcc/c-family/c-attribs.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/gcc/c-family/c-attribs.c b/gcc/c-family/c-attribs.c
index f168082..24bcd70 100644
--- a/gcc/c-family/c-attribs.c
+++ b/gcc/c-family/c-attribs.c
@@ -158,6 +158,7 @@ static tree handle_patchable_function_entry_attribute (tree *, tree, tree,
int, bool *);
static tree handle_copy_attribute (tree *, tree, tree, int, bool *);
static tree handle_nsobject_attribute (tree *, tree, tree, int, bool *);
+static tree handle_objc_root_class_attribute (tree *, tree, tree, int, bool *);
/* Helper to define attribute exclusions. */
#define ATTR_EXCL(name, function, type, variable) \
@@ -513,6 +514,8 @@ const struct attribute_spec c_common_attribute_table[] =
/* Attributes used by Objective-C. */
{ "NSObject", 0, 0, true, false, false, false,
handle_nsobject_attribute, NULL },
+ { "objc_root_class", 0, 0, true, false, false, false,
+ handle_objc_root_class_attribute, NULL },
{ NULL, 0, 0, false, false, false, false, NULL, NULL }
};
@@ -5163,6 +5166,22 @@ handle_nsobject_attribute (tree *node, tree name, tree args,
return NULL_TREE;
}
+/* Handle a "objc_root_class" attributes; arguments as in
+ struct attribute_spec.handler. */
+
+static tree
+handle_objc_root_class_attribute (tree */*node*/, tree name, tree /*args*/,
+ int /*flags*/, bool *no_add_attrs)
+{
+ /* This has no meaning outside Objective-C. */
+ if (!c_dialect_objc())
+ warning (OPT_Wattributes, "%qE is only applicable to Objective-C"
+ " class interfaces, attribute ignored", name);
+
+ *no_add_attrs = true;
+ return NULL_TREE;
+}
+
/* Attempt to partially validate a single attribute ATTR as if
it were to be applied to an entity OPER. */