aboutsummaryrefslogtreecommitdiff
path: root/gcc/c-common.c
diff options
context:
space:
mode:
authorJason Merrill <merrill@gnu.org>1995-04-16 06:14:00 +0000
committerJason Merrill <merrill@gnu.org>1995-04-16 06:14:00 +0000
commit4b8af8d9841c37c89a7eae9d4f831ce4cc00801f (patch)
tree84e2fb5271a2abf2b906a48c8ee5704a2f8d7184 /gcc/c-common.c
parent822e3422fb522797881e6212ffe124690cf0b04a (diff)
downloadgcc-4b8af8d9841c37c89a7eae9d4f831ce4cc00801f.zip
gcc-4b8af8d9841c37c89a7eae9d4f831ce4cc00801f.tar.gz
gcc-4b8af8d9841c37c89a7eae9d4f831ce4cc00801f.tar.bz2
attributes weak and alias
From-SVN: r9391
Diffstat (limited to 'gcc/c-common.c')
-rw-r--r--gcc/c-common.c27
1 files changed, 26 insertions, 1 deletions
diff --git a/gcc/c-common.c b/gcc/c-common.c
index 1c1a5da..18d6265 100644
--- a/gcc/c-common.c
+++ b/gcc/c-common.c
@@ -30,7 +30,7 @@ extern struct obstack permanent_obstack;
enum attrs {A_PACKED, A_NOCOMMON, A_NORETURN, A_CONST, A_T_UNION,
A_CONSTRUCTOR, A_DESTRUCTOR, A_MODE, A_SECTION, A_ALIGNED,
- A_FORMAT};
+ A_FORMAT, A_WEAK, A_ALIAS};
static void declare_hidden_char_array PROTO((char *, char *));
static void add_attribute PROTO((enum attrs, char *,
@@ -258,6 +258,8 @@ init_attributes ()
add_attribute (A_SECTION, "section", 1, 1, 1);
add_attribute (A_ALIGNED, "aligned", 0, 1, 0);
add_attribute (A_FORMAT, "format", 3, 3, 1);
+ add_attribute (A_WEAK, "weak", 0, 0, 1);
+ add_attribute (A_ALIAS, "alias", 1, 1, 1);
}
/* Process the attributes listed in ATTRIBUTES and PREFIX_ATTRIBUTES
@@ -606,6 +608,29 @@ decl_attributes (node, attributes, prefix_attributes)
is_scan, format_num, first_arg_num);
break;
}
+
+ case A_WEAK:
+ declare_weak (decl);
+ break;
+
+ case A_ALIAS:
+ if ((TREE_CODE (decl) == FUNCTION_DECL && DECL_INITIAL (decl))
+ || TREE_CODE (decl) != FUNCTION_DECL && ! DECL_EXTERNAL (decl))
+ error_with_decl (decl,
+ "`%s' defined both normally and as an alias");
+ else if (decl_function_context (decl) == 0)
+ {
+ tree id = get_identifier (TREE_STRING_POINTER
+ (TREE_VALUE (args)));
+ if (TREE_CODE (decl) == FUNCTION_DECL)
+ DECL_INITIAL (decl) = error_mark_node;
+ else
+ DECL_EXTERNAL (decl) = 0;
+ assemble_alias (decl, id);
+ }
+ else
+ warning ("`%s' attribute ignored", IDENTIFIER_POINTER (name));
+ break;
}
}
}