aboutsummaryrefslogtreecommitdiff
path: root/gcc/c-family/c-common.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/c-family/c-common.c')
-rw-r--r--gcc/c-family/c-common.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/gcc/c-family/c-common.c b/gcc/c-family/c-common.c
index 818c32d..a9e0191 100644
--- a/gcc/c-family/c-common.c
+++ b/gcc/c-family/c-common.c
@@ -328,6 +328,8 @@ static tree handle_used_attribute (tree *, tree, tree, int, bool *);
static tree handle_unused_attribute (tree *, tree, tree, int, bool *);
static tree handle_externally_visible_attribute (tree *, tree, tree, int,
bool *);
+static tree handle_no_reorder_attribute (tree *, tree, tree, int,
+ bool *);
static tree handle_const_attribute (tree *, tree, tree, int, bool *);
static tree handle_transparent_union_attribute (tree *, tree, tree,
int, bool *);
@@ -652,6 +654,8 @@ const struct attribute_spec c_common_attribute_table[] =
handle_unused_attribute, false },
{ "externally_visible", 0, 0, true, false, false,
handle_externally_visible_attribute, false },
+ { "no_reorder", 0, 0, true, false, false,
+ handle_no_reorder_attribute, false },
/* The same comments as for noreturn attributes apply to const ones. */
{ "const", 0, 0, true, false, false,
handle_const_attribute, false },
@@ -6953,6 +6957,30 @@ handle_externally_visible_attribute (tree *pnode, tree name,
return NULL_TREE;
}
+/* Handle the "no_reorder" attribute. Arguments as in
+ struct attribute_spec.handler. */
+
+static tree
+handle_no_reorder_attribute (tree *pnode,
+ tree name,
+ tree,
+ int,
+ bool *no_add_attrs)
+{
+ tree node = *pnode;
+
+ if ((TREE_CODE (node) != FUNCTION_DECL && TREE_CODE (node) != VAR_DECL)
+ && !(TREE_STATIC (node) || DECL_EXTERNAL (node)))
+ {
+ warning (OPT_Wattributes,
+ "%qE attribute only affects top level objects",
+ name);
+ *no_add_attrs = true;
+ }
+
+ return NULL_TREE;
+}
+
/* Handle a "const" attribute; arguments as in
struct attribute_spec.handler. */