summaryrefslogtreecommitdiff
path: root/gcc/c-common.c
diff options
context:
space:
mode:
authormerrill <merrill@138bc75d-0d04-0410-961f-82ee72b054a4>1995-01-14 01:09:01 +0000
committermerrill <merrill@138bc75d-0d04-0410-961f-82ee72b054a4>1995-01-14 01:09:01 +0000
commitaa5ec236cf31ff5a76ef0440a181a8036a849017 (patch)
tree9af815a0feebeea5b32fc5a358886913ab5dd30e /gcc/c-common.c
parentf377226ecebe6b5c95b73996ae121bc78c8bff01 (diff)
downloadgcc-aa5ec236cf31ff5a76ef0440a181a8036a849017.tar.gz
__attribute__ ((constructor))
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@8747 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/c-common.c')
-rw-r--r--gcc/c-common.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/gcc/c-common.c b/gcc/c-common.c
index e4207569c96..8b3b887f8fd 100644
--- a/gcc/c-common.c
+++ b/gcc/c-common.c
@@ -271,6 +271,32 @@ decl_attributes (decl, attributes)
else
warning_with_decl (decl, "`transparent_union' attribute ignored");
}
+ else if (TREE_VALUE (a) == get_identifier ("constructor")
+ || TREE_VALUE (a) == get_identifier ("__constructor__"))
+ {
+ if (TREE_CODE (decl) != FUNCTION_DECL
+ || TREE_CODE (TREE_TYPE (decl)) != FUNCTION_TYPE
+ || decl_function_context (decl))
+ {
+ error_with_decl (decl,
+ "`constructor' attribute meaningless for non-function %s");
+ continue;
+ }
+ DECL_STATIC_CONSTRUCTOR (decl) = 1;
+ }
+ else if (TREE_VALUE (a) == get_identifier ("destructor")
+ || TREE_VALUE (a) == get_identifier ("__destructor__"))
+ {
+ if (TREE_CODE (decl) != FUNCTION_DECL
+ || TREE_CODE (TREE_TYPE (decl)) != FUNCTION_TYPE
+ || decl_function_context (decl))
+ {
+ error_with_decl (decl,
+ "`destructor' attribute meaningless for non-function %s");
+ continue;
+ }
+ DECL_STATIC_DESTRUCTOR (decl) = 1;
+ }
else if (TREE_CODE (name) != TREE_LIST)
{
#ifdef VALID_MACHINE_ATTRIBUTE