diff options
author | Jason Merrill <merrill@gnu.org> | 1995-01-14 01:09:01 +0000 |
---|---|---|
committer | Jason Merrill <merrill@gnu.org> | 1995-01-14 01:09:01 +0000 |
commit | 2c5f4139a91db294f1ab34da9bbae585d8c65eb2 (patch) | |
tree | 9af815a0feebeea5b32fc5a358886913ab5dd30e /gcc/c-common.c | |
parent | 34cd1bd74c2afe5a0e14182e7275836d91ed462d (diff) | |
download | gcc-2c5f4139a91db294f1ab34da9bbae585d8c65eb2.zip gcc-2c5f4139a91db294f1ab34da9bbae585d8c65eb2.tar.gz gcc-2c5f4139a91db294f1ab34da9bbae585d8c65eb2.tar.bz2 |
__attribute__ ((constructor))
From-SVN: r8747
Diffstat (limited to 'gcc/c-common.c')
-rw-r--r-- | gcc/c-common.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/gcc/c-common.c b/gcc/c-common.c index e420756..8b3b887 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 |